490. File Comparison Report

Produced on Mon May 12 13:06:13 2008 UTC. This report uses XHTML and CSS2, and is best viewed with a reasonably standards compliant browser such as the latest version of Firefox or Internet Explorer. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.

490.1 Files compared

# Location File Last Modified
1 Dolphin-v.6.0.5\plugins\tiny_mce\plugins\media editor_plugin_src.js Thu Sep 20 08:58:54 2007 UTC
2 Dolphin-v.6.1.0\plugins\tiny_mce\plugins\media editor_plugin_src.js Thu Mar 27 13:53:24 2008 UTC

490.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 82 228
Changed 77 535
Inserted 3 3
Removed 2 22

490.3 Comparison options

Whitespace
Character case Differences in character case are significant
Line endings Differences in line endings (CR and LF characters) are ignored
CR/LF characters Not shown in the comparison detail

490.4 Active regular expressions

No regular expressions were active.

490.5 Comparison detail

1   /**   1   /**
2     *   $Id:   editor_plu gin_src.js   27 5   200 7 -0 5 -
0 1   15: 3 5 : 0 8
Z   spocke   $
  2     *   $Id:   editor_plu gin_src.js   61 5   200 8 -0 2 - 2 0   2 3
: 1 8 :01 Z   spocke   $
3    *   3    *
4    * @author  Moxiecode   4    * @author  Moxiecode
5     *   @copyright   Copyright   ©   2004-200 7 ,   Moxiecode   Systems   AB,   All   rights   reserved.   5     *   @copyright   Copyright   ©   2004-200 8 ,   Moxiecode   Systems   AB,   All   rights   reserved.
6    */   6    */
7     7  
8   /* Import  plugin spe cific lang uage pack  */   8   (function( ) {
9   tinyMCE.im portPlugin LanguagePa ck('media' );   9       var ea ch = tinym ce.each;
10     10  
11   var TinyMC E_MediaPlu gin = {   11       tinymc e.create(' tinymce.pl ugins.Medi aPlugin',  {
12       getInf o : functi on() {   12            init  
:   function( ed,   url )   {
13           re turn {   13                var t =  this;
14                longname  : 'Media' ,    
15                author :  'Moxiecod e Systems  AB',    
16                authorur l : 'http: //tinymce. moxiecode. com',    
17                infourl  : 'http:// wiki.moxie code.com/i ndex.php/T inyMCE:Plu gins/media ',    
18                version  : tinyMCE. majorVersi on + "." +  tinyMCE.m inorVersio n    
19           };    
20       },    
21      
22        init Instance   :   function( inst )   {    
23           //  Warn if u ser has fl ash plugin  and media  plugin at  the same  time    
24           if  (inst.has Plugin('fl ash') && ! tinyMCE.fl ashWarn) {    
25                alert('F lash plugi n is depre cated and  should not  be used t ogether wi th the med ia plugin. ');    
26                tinyMCE. flashWarn  = true;    
27           }    
28     14                
29           if  (!tinyMCE .settings[ 'media_ski p_plugin_c ss'])   15                t.editor  = ed;
30                tinyMCE. importCSS( inst.getDo c(), tinyM CE.baseURL  + "/plugi ns/media/c ss/content .css");   16                t.url =  url;
31       },    
32      
33       getCon trolHTML :  function( cn) {    
34           sw itch (cn)  {    
35                case "me dia":    
36                    retu rn tinyMCE .getButton HTML(cn, ' lang_media _desc', '{ $pluginurl }/images/m edia.gif',  'mceMedia ');    
37           }    
38     17  
39           re turn "";   18                function  isMediaEl m(n) {
40        } ,   19                    retu rn /^(mceI temFlash|m ceItemShoc kWave|mceI temWindows Media|mceI temQuickTi me|mceItem RealMedia) $/.test(n. className) ;
    20                 } ;
41     21  
42       execCo mmand : fu nction(edi tor_id, el ement, com mand, user _interface , value) {   22                 //   Reg i s t er   command s
43           //  Handle co mmands   23                ed.addCo mmand('mce Media', fu nction() {
44            sw i
t ch   ( command )   {
  24                    ed.w indowManag er.open({
45                case "mc eMedia":   25                         file   :  
u rl   +   ' /media.htm ',
46                    tiny MCE.openWi ndow({   26                         width   :   430   +   parseI n t(ed .getLang('
media . delta_widt h',   0) ) ,
47                              file   :   '../../pl u gins/media /media.htm ',   27                         height   :   470   +   parseI n t(ed .getLang('
media . delta_heig ht',   0) ),
48                              width   :   430   +   ti n yMCE .getLang(' lang_ media _ delta_widt h',   0)
,
  28                         inline : 1
49                              height   :   470   +   ti n yMCE .getLang(' lang_ media _ delta_heig ht',   0)
   
50                         }, {   29                    }, {
51                             editor _id : edit or_id,   30                         plugin_url  : url
52                             inline  : "yes"   31                    });
53                    });   32                });
54     33  
55                    retu rn true;   34                // Regis ter button s
56          }   35                ed.addBu tton('medi a', {title  : 'media. desc', cmd  : 'mceMed ia'});
57     36  
58          //  Pass to ne xt handler  in chain   37                ed.onNod eChange.ad d(function (ed, cm, n ) {
59          ret urn false;   38                    cm.s etActive(' media', n. nodeName = = 'IMG' &&  isMediaEl m(n));
60       } ,   39                } );
61     40  
62       cleanu p : functi on(type, c ontent, in st) {   41                ed.onIni t.add(func tion() {
63           va r nl, img,  i, ne, d,  s, ci;   42                    var  lo = {
    43                         mceItemFla sh : 'flas h',
    44                         mceItemSho ckWave : ' shockwave' ,
    45                         mceItemWin dowsMedia  : 'windows media',
    46                         mceItemQui ckTime : ' quicktime' ,
    47                         mceItemRea lMedia : ' realmedia'
    48                    };
64     49  
65           sw itch (type ) {   50                    ed.d om.loadCSS (url + "/c ss/content .css");
66                case "in sert_to_ed itor":    
67                    img  = tinyMCE. getParam(" theme_href ") + '/ima ges/spacer .gif';    
68                    cont ent = cont ent.replac e(/<script [^>]*>\s*w rite(Flash |ShockWave |WindowsMe dia|QuickT ime|RealMe dia)\(\{([ ^\)]*)\}\) ;\s*<\/scr ipt>/gi, ' <img class ="mceItem$ 1" title=" $2" src="'  + img + ' " />');    
69                    cont ent = cont ent.replac e(/<object ([^>]*)>/g i, '<div c lass="mceI temObject"  $1>');    
70                    cont ent = cont ent.replac e(/<embed( [^>]*)>/gi , '<div cl ass="mceIt emObjectEm bed" $1>') ;    
71                    cont ent = cont ent.replac e(/<\/(obj ect|embed) ([^>]*)>/g i, '</div> ');    
72                    cont ent = cont ent.replac e(/<param( [^>]*)>/gi , '<div $1  class="mc eItemParam "></div>') ;    
73                    cont ent = cont ent.replac e(new RegE xp('\\/ cl ass="mceIt emParam">< \\/div>',  'gi'), 'cl ass="mceIt emParam">< /div>');    
74                    brea k;    
75     51  
76                case "in sert_to_ed itor_dom":   52                    if ( ed.theme.o nResolveNa me) {
77                    d =  inst.getDo c();   53                         ed.theme.o nResolveNa me.add(fun ction(th,  o) {
78                    nl =  content.g etElements ByTagName( "img");   54                             if (o. name == 'i mg') {
79                    for  (i=0; i<nl .length; i ++) {   55                                 ea ch(lo, fun ction(v, k ) {
80                         if (/mceIt em(Flash|S hockWave|W indowsMedi a|QuickTim e|RealMedi a)/.test(n l[i].class Name)) {   56                                      if (ed.d om.hasClas s(o.node,  k)) {
81                             nl[i]. width = nl [i].title. replace(/. *width:[^0 -9]?([0-9] +)%?.*/g,  '$1');   57                                          o.na me = v;
82                             nl[i]. height = n l[i].title .replace(/ .*height:[ ^0-9]?([0- 9]+)%?.*/g , '$1');   58                                          o.ti tle = ed.d om.getAttr ib(o.node,  'title');
83                             //nl[i ].align =  nl[i].titl e.replace( /.*align:( [a-z]+).*/ gi, '$1');   59                                          retu rn false;
    60                                      }
    61                                 }) ;
84                         }   62                             }
    63                         });
85                    }   64                    }
86     65  
87                    nl =  tinyMCE.s electEleme nts(conten t, 'DIV',  function ( n) {return  tinyMCE.h asCSSClass (n, 'mceIt emObject') ;});   66                    if ( ed && ed.p lugins.con textmenu)  {
88                    for  (i=0; i<nl .length; i ++) {   67                         ed.plugins .contextme nu.onConte xtMenu.add (function( th, m, e)  {
89                         ci = tinyM CE.getAttr ib(nl[i],  "classid") .toLowerCa se().repla ce(/\s+/g,  '');   68                             if (e. nodeName = = 'IMG' &&  /mceItem( Flash|Shoc kWave|Wind owsMedia|Q uickTime|R ealMedia)/ .test(e.cl assName))  {
    69                                 m. add({title  : 'media. edit', ico n : 'media ', cmd : ' mceMedia'} );
    70                             }
    71                         });
    72                    }
    73                });
90     74  
91                         switch (ci ) {   75                ed.onBef oreSetCont ent.add(fu nction(ed,  o) {
92                             case ' clsid:d27c db6e-ae6d- 11cf-96b8- 4445535400 00':   76                    var  h = o.cont ent;
93                                 nl [i].parent Node.repla ceChild(Ti nyMCE_Medi aPlugin._c reateImg(' mceItemFla sh', d, nl [i]), nl[i ]);    
94                                 br eak;    
95     77  
96                             case ' clsid:166b 1bca-3f9c- 11cf-8075- 4445535400 00':   78                    h =  h.replace( /<script[^ >]*>\s*wri te(Flash|S hockWave|W indowsMedi a|QuickTim e|RealMedi a)\(\{([^\ )]*)\}\);\ s*<\/scrip t>/gi, fun ction(a, b , c) {
97                                 nl [i].parent Node.repla ceChild(Ti nyMCE_Medi aPlugin._c reateImg(' mceItemSho ckWave', d , nl[i]),  nl[i]);   79                         var o = t. _parse(c);
98                                 br eak;    
99     80  
100                             case ' clsid:6bf5 2a52-394a- 11d3-b153- 00c04f79fa a6':   81                         return '<i mg class=" mceItem' +  b + '" ti tle="' + e d.dom.enco de(c) + '"  src="' +  url + '/im g/trans.gi f" width=" ' + o.widt h + '" hei ght="' + o .height +  '" />'
101                             case ' clsid:22d6 f312-b0f6- 11d0-94ab- 0080c74c7e 95':   82                     }) ;
102                             case ' clsid:0558 9fa1-c356- 11ce-bf01- 00aa005559 5a':    
103                                 nl [i].parent Node.repla ceChild(Ti nyMCE_Medi aPlugin._c reateImg(' mceItemWin dowsMedia' , d, nl[i] ), nl[i]);    
104                                  break ;    
105     83  
106                             case ' clsid:02bf 25d5-8c17- 4b23-bc80- d3488abddc 6b':   84                    h =  h.replace( /<object([ ^>]*)>/gi,  '<span cl ass="mceIt emObject"  $1>');
107                                 nl [i].parent Node.repla ceChild(Ti nyMCE_Medi aPlugin._c reateImg(' mceItemQui ckTime', d , nl[i]),  nl[i]);   85                    h =  h.replace( /<embed([^ >]*)>/gi,  '<span cla ss="mceIte mEmbed" $1 >');
108                                 br eak;   86                    h =  h.replace( /<\/(objec t|embed)([ ^>]*)>/gi,  '</span>' );
    87                    h =  h.replace( /<param([^ >]*)>/gi,  function(a , b) {retu rn '<span  ' + b.repl ace(/value =/gi, '_va lue=') + '  class="mc eItemParam "></span>' });
    88                    h =  h.replace( /\/ class= \"mceItemP aram\"><\/ span>/gi,  'class="mc eItemParam "></span>' );
109     89  
110                             case ' clsid:cfcd aa03-8be4- 11cf-b84b- 0020afbbcc fa':   90                    o.co ntent = h;
111                                 nl [i].parent Node.repla ceChild(Ti nyMCE_Medi aPlugin._c reateImg(' mceItemRea lMedia', d , nl[i]),  nl[i]);   91                 } );
112                                 br eak;    
113                         }    
114                     }
   
115     92  
116                    // H andle embe d (if any)   93                ed.onSet Content.ad d(function () {
117                    nl =  tinyMCE.s electNodes (content,  function ( n) {return  n.classNa me == 'mce ItemObject Embed';});   94                    t._s pansToImgs (ed.getBod y());
118                    for  (i=0; i<nl .length; i ++) {   95                 }) ;
119                         switch (ti nyMCE.getA ttrib(nl[i ], 'type') ) {    
120                             case ' applicatio n/x-shockw ave-flash' :    
121                                 Ti nyMCE_Medi aPlugin._c reateImgFr omEmbed(nl [i], d, 'm ceItemFlas h');    
122                                  break ;    
123     96  
124                             case ' applicatio n/x-direct or':   97                ed.onPre Process.ad d(function (ed, o) {
125                                 Ti nyMCE_Medi aPlugin._c reateImgFr omEmbed(nl [i], d, 'm ceItemShoc kWave');   98                    var  dom = ed.d om;
126                                 br eak;    
127     99  
128                             case ' applicatio n/x-mplaye r2':   100                    if ( o.set) {
129                                 Ti nyMCE_Medi aPlugin._c reateImgFr omEmbed(nl [i], d, 'm ceItemWind owsMedia') ;   101                         t._spansTo Imgs(o.nod e);
130                                 br eak;    
131     102  
132                             case ' video/quic ktime':   103                         each(dom.s elect('IMG ', o.node) , function (n) {
133                                 Ti nyMCE_Medi aPlugin._c reateImgFr omEmbed(nl [i], d, 'm ceItemQuic kTime');   104                              var p ;
134                                  break ;    
135     105  
136                             case ' audio/x-pn -realaudio -plugin':   106                             if (is MediaElm(n )) {
137                                 Ti nyMCE_Medi aPlugin._c reateImgFr omEmbed(nl [i], d, 'm ceItemReal Media');   107                                 p  = t._parse (n.title);
138                                 br eak;   108                                 do m.setAttri b(n, 'widt h', dom.ge tAttrib(n,  'width',  p.width ||  100));
    109                                 do m.setAttri b(n, 'heig ht', dom.g etAttrib(n , 'height' , p.height  || 100));
139                         }   110                             }
    111                         });
140                    }   112                    }
141                    brea k;    
142      
143                case "ge t_from_edi tor":    
144                    var  startPos =  -1, endPo s, attribs , chunkBef ore, chunk After, emb edHTML, at , pl, cb,  mt, ex;    
145      
146                    whil e ((startP os = conte nt.indexOf ('<img', s tartPos+1) ) != -1) {    
147                         endPos = c ontent.ind exOf('/>',  startPos) ;    
148                         attribs =  TinyMCE_Me diaPlugin. _parseAttr ibutes(con tent.subst ring(start Pos + 4, e ndPos));    
149      
150                         // Is not  flash, ski p it    
151                         if (!/mceI tem(Flash| ShockWave| WindowsMed ia|QuickTi me|RealMed ia)/.test( attribs['c lass']))    
152                             contin ue;    
153     113  
154                         endPos +=  2;   114                    if ( o.get) {
    115                         each(dom.s elect('IMG ', o.node) , function (n) {
    116                             var ci , cb, mt;
155     117  
156                         // Parse a ttributes   118                             if (ed .getParam( 'media_use _script'))  {
157                         at = attri bs['title' ];   119                                 if  ( isMediaElm (n))
158                         if ( at) {   120                                       n.cl a ssName   =   n.cl a ssName .replace(/ mceI t em /g,   ' mceTemp ');
159                             at = a t.replace( /&(#39|apo s);/g, "'" );    
160                             
a t   =  
a t .replace(/ &#quo t ; /g,   ' " ');
   
161     121  
162                              try {   122                                  return;
163                                 pl  = eval('x ={' + at +  '};');    
164                             } catc h (ex) {    
165                                 pl  = {};    
166                             }    
167                         }   123                             }
168     124  
169                         // Use obj ect/embed   125                              switch   ( n. class Name )   {
170                         if (!tinyM CE.getPara m('media_u se_script' , false))  {    
171                              switch   ( attribs[' class '] )   {    
172                                 ca se 'mceIte mFlash':   126                                 ca se 'mceIte mFlash':
173                                      ci = 'd2 7cdb6e-ae6 d-11cf-96b 8-44455354 0000';   127                                      ci = 'd2 7cdb6e-ae6 d-11cf-96b 8-44455354 0000';
174                                      cb = 'ht tp://downl oad.macrom edia.com/p ub/shockwa ve/cabs/fl ash/swflas h.cab#vers ion=6,0,40 ,0';   128                                      cb = 'ht tp://downl oad.macrom edia.com/p ub/shockwa ve/cabs/fl ash/swflas h.cab#vers ion=6,0,40 ,0';
175                                      mt = 'ap plication/ x-shockwav e-flash';   129                                      mt = 'ap plication/ x-shockwav e-flash';
176                                      break;   130                                      break;
177     131  
178                                 ca se 'mceIte mShockWave ':   132                                 ca se 'mceIte mShockWave ':
179                                       ci   =   '166 B 1 BCA -3 F 9 C -11 CF -8075-4445 53540000';   133                                       ci   =   '166 b 1 bca -3 f 9 c -11 cf -8075-4445 53540000';
180                                      cb = 'ht tp://downl oad.macrom edia.com/p ub/shockwa ve/cabs/di rector/sw. cab#versio n=8,5,1,0' ;   134                                      cb = 'ht tp://downl oad.macrom edia.com/p ub/shockwa ve/cabs/di rector/sw. cab#versio n=8,5,1,0' ;
181                                      mt = 'ap plication/ x-director ';   135                                      mt = 'ap plication/ x-director ';
182                                      break;   136                                      break;
183     137  
184                                 ca se 'mceIte mWindowsMe dia':   138                                 ca se 'mceIte mWindowsMe dia':
185                                       ci   =   tinyMCE .getParam( 'media_wmp 6_compatib le')   ?   '05589 FA 1- C 356-11 CE - BF 01-00 AA 0055595 A '   :   '6 BF 52 A 52-394 A -11 D 3- B 153-00 C 04 F 79 FAA 6';   139                                       ci   =   ed .getParam( 'media_wmp 6_compatib le')   ?   '05589 fa 1- c 356-11 ce - bf 01-00 aa 0055595 a '   :   '6 bf 52 a 52-394 a -11 d 3- b 153-00 c 04 f 79 faa 6';
186                                      cb = 'ht tp://activ ex.microso ft.com/act ivex/contr ols/mplaye r/en/nsmp2 inf.cab#Ve rsion=5,1, 52,701';   140                                      cb = 'ht tp://activ ex.microso ft.com/act ivex/contr ols/mplaye r/en/nsmp2 inf.cab#Ve rsion=5,1, 52,701';
187                                      mt = 'ap plication/ x-mplayer2 ';   141                                      mt = 'ap plication/ x-mplayer2 ';
188                                      break;   142                                      break;
189     143  
190                                 ca se 'mceIte mQuickTime ':   144                                 ca se 'mceIte mQuickTime ':
191                                       ci   =   '02 BF 25 D 5-8 C 17-4 B 23- BC 80- D 3488 ABDDC 6 B ';   145                                       ci   =   '02 bf 25 d 5-8 c 17-4 b 23- bc 80- d 3488 abddc 6 b ';
192                                      cb = 'ht tp://www.a pple.com/q tactivex/q tplugin.ca b#version= 6,0,2,0';   146                                      cb = 'ht tp://www.a pple.com/q tactivex/q tplugin.ca b#version= 6,0,2,0';
193                                      mt = 'vi deo/quickt ime';   147                                      mt = 'vi deo/quickt ime';
194                                      break;   148                                      break;
195     149  
196                                 ca se 'mceIte mRealMedia ':   150                                 ca se 'mceIte mRealMedia ':
197                                       ci   =   ' CFCDAA 03-8 BE 4-11cf- B 84 B -0020 AFBBCCFA ';   151                                       ci   =   ' cfcdaa 03-8 be 4-11cf- b 84 b -0020 afbbccfa ';
198                                      cb = 'ht tp://downl oad.macrom edia.com/p ub/shockwa ve/cabs/fl ash/swflas h.cab#vers ion=6,0,40 ,0';   152                                      cb = 'ht tp://downl oad.macrom edia.com/p ub/shockwa ve/cabs/fl ash/swflas h.cab#vers ion=6,0,40 ,0';
199                                      mt = 'au dio/x-pn-r ealaudio-p lugin';   153                                      mt = 'au dio/x-pn-r ealaudio-p lugin';
200                                      break;   154                                      break;
201                             }   155                             }
202     156  
203                             // For ce absolut e URL   157                             if (ci ) {
204                             if (!t inyMCE.get Param("rel ative_urls "))   158                                 do m.replace( t._buildOb j({
205                                 pl .src = tin yMCE.conve rtRelative ToAbsolute URL(tinyMC E.settings ['base_hre f'], pl.sr c);   159                                      classid  : ci,
206     160                                      codebase  : cb,
207                             embedH TML = Tiny MCE_MediaP lugin._get Embed(ci,  cb, mt, pl , attribs) ;   161                                      type : m t
208                         } else {   162                                 },  n), n);
209                             // Use  script ve rsion   163                             }
210                             switch  (attribs[ 'class'])  {   164                         }) ;
211                                 ca se 'mceIte mFlash':    
212                                      s = 'wri teFlash';    
213                                      break;    
214      
215                                 ca se 'mceIte mShockWave ':    
216                                      s = 'wri teShockWav e';    
217                                      break;    
218      
219                                 ca se 'mceIte mWindowsMe dia':    
220                                      s = 'wri teWindowsM edia';    
221                                      break;    
222      
223                                 ca se 'mceIte mQuickTime ':    
224                                      s = 'wri teQuickTim e';    
225                                      break;    
226      
227                                 ca se 'mceIte mRealMedia ':    
228                                      s = 'wri teRealMedi a';    
229                                       break ;    
230                             }   165                    }
    166                });
231     167  
232                             if (at tribs.widt h)   168                ed.onPos tProcess.a dd(functio n(ed, o) {
233                                 at  = at.repl ace(/width :[^0-9]?[0 -9]+%?[^0- 9]?/g, "wi dth:'" + a ttribs.wid th + "'");   169                    o.co ntent = o. content.re place(/_va lue=/g, 'v alue=');
    170                });
234     171  
235                             if (at tribs.heig ht)   172                if (ed.g etParam('m edia_use_s cript')) {
236                                 at  = at.repl ace(/heigh t:[^0-9]?[ 0-9]+%?[^0 -9]?/g, "h eight:'" +  attribs.h eight + "' ");   173                    func tion getAt tr(s, n) {
    174                         n = new Re gExp(n + ' =\"([^\"]+ )\"', 'g') .exec(s);
237     175  
238                             // For ce absolut e URL   176                         return n ?  ed.dom.de code(n[1])  : '';
239                             if (!t inyMCE.get Param("rel ative_urls ")) {   177                     } ;
240                                 pl .src = tin yMCE.conve rtRelative ToAbsolute URL(tinyMC E.settings ['base_hre f'], pl.sr c);    
241                                 at  = at.repl ace(new Re gExp("src: '[^']*'",  "g"), "src :'" + pl.s rc + "'");    
242                              }
   
243     178  
244                             embedH TML = '<sc ript type= "text/java script">'  + s + '({'  + at + '} );</script >';   179                    ed.o nPostProce ss.add(fun ction(ed,  o) {
245                         }   180                         o.content  = o.conten t.replace( /<img[^>]+ >/g, funct ion(im) {
    181                             var cl  = getAttr (im, 'clas s');
246     182  
247                         // Insert  embed/obje ct chunk   183                             if (/^ (mceTempFl ash|mceTem pShockWave |mceTempWi ndowsMedia |mceTempQu ickTime|mc eTempRealM edia)$/.te st(cl)) {
248                         chunkBefor e = conten t.substrin g(0, start Pos);   184                                 at  = t._pars e(getAttr( im, 'title '));
249                         chunkAfter  = content .substring (endPos);   185                                 at .width = g etAttr(im,  'width');
250                         content =  chunkBefor e + embedH TML + chun kAfter;   186                                 at .height =  getAttr(im , 'height' );
251                    }   187                                 im  = '<scrip t type="te xt/javascr ipt">write ' + cl.sub string(7)  + '({' + t ._serializ e(at) + '} );</script >';
252                    brea k;    
253           }   188                             }
254     189  
255            return   content ;   190                              return   im ;
    191                         });
    192                    });
    193                }
256       },   194           },
257     195  
258       handle NodeChange  : functio n(editor_i d, node, u ndo_index,  undo_leve ls, visual _aid, any_ selection)  {   196           ge tInfo : fu nction() {
259           if  (node ==  null)   197                return {
260                 return ;   198                    long name : 'Me dia',
    199                    auth or : 'Moxi ecode Syst ems AB',
    200                    auth orurl : 'h ttp://tiny mce.moxiec ode.com',
    201                    info url : 'htt p://wiki.m oxiecode.c om/index.p hp/TinyMCE :Plugins/m edia',
    202                    vers ion : tiny mce.majorV ersion + " ." + tinym ce.minorVe rsion
    203                 } ;
    204           },
261     205  
262           do  {   206           //  Private m ethods
263                if (node .nodeName  == "IMG" & & /mceItem (Flash|Sho ckWave|Win dowsMedia| QuickTime| RealMedia) /.test(tin yMCE.getAt trib(node,  'class')) ) {    
264                    tiny MCE.switch Class(edit or_id + '_ media', 'm ceButtonSe lected');    
265                    retu rn true;    
266                }    
267           }  while ((no de = node. parentNode ));    
268     207  
269           ti nyMCE.swit chClass(ed itor_id +  '_media',  'mceButton Normal');   208           _b uildObj :  function(o , n) {
    209                var ob,  ed = this. editor, do m = ed.dom , p = this ._parse(n. title);
270     210  
271           re turn true;   211                p.width  = o.width  = dom.getA ttrib(n, ' width') ||  100;
272       },   212                p.height  = o.heigh t = dom.ge tAttrib(n,  'height')  || 100;
273     213  
274       _creat eImgFromEm bed : func tion(n, d,  cl) {   214                ob = dom .create('s pan', {
275           va r ne, at,  i, ti = '' , an;   215                    mce_ name : 'ob ject',
    216                    clas sid : "cls id:" + o.c lassid,
    217                    code base : o.c odebase,
    218                    widt h : o.widt h,
    219                    heig ht : o.hei ght
    220                });
276     221  
277           ne  = d.creat eElement(' img');   222                if (p.sr c)
278           ne .src = tin yMCE.getPa ram("theme _href") +  '/images/s pacer.gif' ;   223                    p.sr c = ed.con vertURL(p. src, 'src' , n);
279           ne .width = t inyMCE.get Attrib(n,  'width');    
280           ne .height =  tinyMCE.ge tAttrib(n,  'height') ;    
281           ne .className  = cl;    
282     224  
283           at  = n.attri butes;   225                each (p,  function( v, k) {
284           fo r (i=0; i< at.length;  i++) {   226                    if ( !/^(width| height|cod ebase|clas sid)$/.tes t(k))
285                if (at[i ].specifie d && at[i] .nodeValue ) {   227                         dom.add(ob , 'span',  {mce_name  : 'param',  name : k,  '_value'  : v});
286                    an =  at[i].nod eName.toLo werCase();   228                });
287     229  
288                    if ( an == 'src ')   230                dom.add( ob, 'span' , tinymce. extend({mc e_name : ' embed', ty pe : o.typ e}, p));
289                         continue;    
290     231  
291                    if ( an == 'mce _src')   232                return o b;
292                         an = 'src' ;   233           },
293     234  
294                    if ( an.indexOf ('mce_') = = -1 && !n ew RegExp( '^(class|t ype)$').te st(an))   235           _s pansToImgs  : functio n(p) {
295                         ti += an.t oLowerCase () + ':\''  + at[i].n odeValue +  "',";   236                var t =  this, dom  = t.editor .dom, im,  ci;
296                }    
297           }    
298     237  
299           ti  = ti.leng th > 0 ? t i.substrin g(0, ti.le ngth - 1)  : ti;   238                each(dom .select('s pan', p),  function(n ) {
300           ne .title = t i;   239                    // C onvert obj ect into i mage
    240                    if ( dom.getAtt rib(n, 'cl ass') == ' mceItemObj ect') {
    241                         ci = dom.g etAttrib(n , "classid ").toLower Case().rep lace(/\s+/ g, '');
301     242  
302           n. parentNode .replaceCh ild(ne, n) ;   243                         switch (ci ) {
303        },   244                             case ' clsid:d27c db6e-ae6d- 11cf-96b8- 4445535400 00':
    245                                 do m.replace( t._createI mg('mceIte mFlash', n ), n);
    246                                  break;
304     247  
305       _creat eImg : fun ction(cl,  d, n) {   248                             case ' clsid:166b 1bca-3f9c- 11cf-8075- 4445535400 00':
306           va r i, nl, t i = "", an , av, al =  new Array ();   249                                 do m.replace( t._createI mg('mceIte mShockWave ', n), n);
    250                                 br eak;
307     251  
308           ne  = d.creat eElement(' img');   252                             case ' clsid:6bf5 2a52-394a- 11d3-b153- 00c04f79fa a6':
309           ne .src = tin yMCE.getPa ram("theme _href") +  '/images/s pacer.gif' ;   253                             case ' clsid:22d6 f312-b0f6- 11d0-94ab- 0080c74c7e 95':
310           ne .width = t inyMCE.get Attrib(n,  'width');   254                             case ' clsid:0558 9fa1-c356- 11ce-bf01- 00aa005559 5a':
311           ne .height =  tinyMCE.ge tAttrib(n,  'height') ;   255                                 do m.replace( t._createI mg('mceIte mWindowsMe dia', n),  n);
312           ne .className  = cl;   256                                 br eak;
313     257  
314           al .id = tiny MCE.getAtt rib(n, 'id ');   258                             case ' clsid:02bf 25d5-8c17- 4b23-bc80- d3488abddc 6b':
315           al .name = ti nyMCE.getA ttrib(n, ' name');   259                                 do m.replace( t._createI mg('mceIte mQuickTime ', n), n);
316           al .width = t inyMCE.get Attrib(n,  'width');   260                                 br eak;
317           al .height =  tinyMCE.ge tAttrib(n,  'height') ;    
318           al .bgcolor =  tinyMCE.g etAttrib(n , 'bgcolor ');    
319           al .align = t inyMCE.get Attrib(n,  'align');    
320           al .class_nam e = tinyMC E.getAttri b(n, 'mce_ class');    
321     261  
322           nl  = n.getEl ementsByTa gName('div ');   262                             case ' clsid:cfcd aa03-8be4- 11cf-b84b- 0020afbbcc fa':
323           fo r (i=0; i< nl.length;  i++) {   263                                 do m.replace( t._createI mg('mceIte mRealMedia ', n), n);
324                av = tin yMCE.getAt trib(nl[i] , 'value') ;   264                                  break;
325                av = av. replace(ne w RegExp(' \\\\', 'g' ), '\\\\') ;    
326                av = av. replace(ne w RegExp(' "', 'g'),  '\\"');    
327                av = av. replace(ne w RegExp(" '", 'g'),  "\\'");    
328                an = tin yMCE.getAt trib(nl[i] , 'name');    
329                al[an] =  av;    
330            }    
331     265  
332           if  (al.movie ) {   266                             defaul t:
333                al.src =  al.movie;   267                                 do m.replace( t._createI mg('mceIte mFlash', n ), n);
334                al.movie  = null;    
335           }   268                         }
336     269                        
337           fo r (an in a l) {   270                         return;
338                if (al[a n] != null  && typeof (al[an]) ! = "functio n" && al[a n] != '')    
339                    ti + = an.toLow erCase() +  ':\'' + a l[an] + "' ,";    
340           }   271                    }
341     272  
342           ti  = ti.leng th > 0 ? t i.substrin g(0, ti.le ngth - 1)  : ti;   273                    // C onvert emb ed into im age
343           ne .title = t i;   274                    if ( dom.getAtt rib(n, 'cl ass') == ' mceItemEmb ed') {
344     275                         switch (do m.getAttri b(n, 'type ')) {
345           re turn ne;   276                             case ' applicatio n/x-shockw ave-flash' :
346        },   277                                 do m.replace( t._createI mg('mceIte mFlash', n ), n);
    278                                  break;
347     279  
348       _getEm bed : func tion(cls,  cb, mt, p,  at) {   280                             case ' applicatio n/x-direct or':
349           va r h = '',  n;   281                                 do m.replace( t._createI mg('mceIte mShockWave ', n), n);
    282                                 br eak;
350     283  
351           p. width = at .width ? a t.width :  p.width;   284                             case ' applicatio n/x-mplaye r2':
352           p. height = a t.height ?  at.height  : p.heigh t;   285                                 do m.replace( t._createI mg('mceIte mWindowsMe dia', n),  n);
    286                                 br eak;
353     287  
354           h  += '<objec t classid= "clsid:' +  cls + '"  codebase=" ' + cb + ' "';   288                             case ' video/quic ktime':
355           h  += typeof( p.id) != " undefined"  ? ' id="'  + p.id +  '"' : '';   289                                 do m.replace( t._createI mg('mceIte mQuickTime ', n), n);
356           h  += typeof( p.name) !=  "undefine d" ? ' nam e="' + p.n ame + '"'  : '';   290                                 br eak;
357           h  += typeof( p.width) ! = "undefin ed" ? ' wi dth="' + p .width + ' "' : '';    
358           h  += typeof( p.height)  != "undefi ned" ? ' h eight="' +  p.height  + '"' : '' ;    
359           h  += typeof( p.align) ! = "undefin ed" ? ' al ign="' + p .align + ' "' : '';    
360           h  += '>';    
361     291  
362           fo r (n in p)  {   292                             case ' audio/x-pn -realaudio -plugin':
363                if (type of(p[n]) ! = "undefin ed" && typ eof(p[n])  != "functi on") {   293                                 do m.replace( t._createI mg('mceIte mRealMedia ', n), n);
364                    h +=  '<param n ame="' + n  + '" valu e="' + p[n ] + '" />' ;   294                                 br eak;
365     295  
366                    // A dd extra u rl paramet er if it's  an absolu te URL on  WMP   296                              default:
367                    if ( n == 'src'  && p[n].i ndexOf(':/ /') != -1  && mt == ' applicatio n/x-mplaye r2')   297                                 do m.replace( t._createI mg('mceIte mFlash', n ), n);
368                         h += '<par am name="u rl" value= "' + p[n]  + '" />';    
369                 }    
370           }   298                         }
371      
372           h  += '<embed  type="' +  mt + '"';    
373      
374           fo r (n in p)  {    
375                if (type of(p[n]) = = "functio n")    
376                    cont inue;    
377      
378                // Skip  url parame ter for em bed tag on  WMP    
379                if (!(n  == 'url' & & mt == 'a pplication /x-mplayer 2'))    
380                    h +=  ' ' + n +  '="' + p[ n] + '"';    
381           }   299                    }            
382  
  300                 });
383           h  += '></emb ed></objec t>';    
384      
385           re turn h;    
386       },   301           },
387     302  
388        _ pa r s e Attribu te s   :   function( attribute_ stri n g )   {   303            _ c r
e a te Img   :   function( cl,   n
)   {
389           va r attribut eName = "" , endChr =  '"';   304                var im,  dom = this .editor.do m, pa = {} , ti = '';
390           va r attribut eValue = " ";    
391           va r withInNa me;    
392           va r withInVa lue;    
393           va r attribut es = new A rray();    
394           va r whiteSpa ceRegExp =  new RegEx p('^[ \n\r \t]+', 'g' );    
395      
396           if  (attribut e_string = = null ||  attribute_ string.len gth < 2)    
397                return n ull;    
398     305  
399           wi thInName =  withInVal ue = false ;   306                // Creat e image
    307                im = dom .create('i mg', {
    308                    src  : this.url  + '/img/t rans.gif',
    309                    widt h : dom.ge tAttrib(n,  'width')  || 100,
    310                    heig ht : dom.g etAttrib(n , 'height' ) || 100,
    311                    'cla ss' : cl
    312                });
400     313  
401           fo r (var i=0 ; i<attrib ute_string .length; i ++) {   314                // Setup  base para meters
402                var chr  = attribut e_string.c harAt(i);   315                each(['i d', 'name' , 'width',  'height',  'bgcolor' , 'align',  'flashvar s', 'src',  'wmode'],  function( na) {
    316                    var  v = dom.ge tAttrib(n,  na);
403     317  
404                if ((chr  == '"' ||  chr == "' ") && !wit hInValue)  {   318                    if ( v)
405                    with InValue =  true;   319                         pa[na] = v ;
406                    endC hr = chr;   320                });
407                } else i f (chr ==  endChr &&  withInValu e) {    
408                    with InValue =  false;    
409     321  
410                    var  pos = attr ibuteName. lastIndexO f(' ');   322                // Add o ptional pa rameters
411                    if ( pos != -1)   323                each(dom .select('s pan', n),  function(n ) {
412                         attributeN ame = attr ibuteName. substring( pos+1);   324                    if ( dom.hasCla ss(n, 'mce ItemParam' ))
    325                         pa[dom.get Attrib(n,  'name')] =  dom.getAt trib(n, '_ value');
    326                });
413     327  
414                    attr ibutes[att ributeName .toLowerCa se()] = at tributeVal ue.substri ng(1);   328                // Use s rc not mov ie
    329                if (pa.m ovie) {
    330                    pa.s rc = pa.mo vie;
    331                    dele te pa.movi e;
    332                }
415     333  
416                    attr ibuteName  = "";   334                delete p a.width;
417                    attr ibuteValue  = "";   335                delete p a.height;
418                } else i f (!whiteS paceRegExp .test(chr)  && !withI nName && ! withInValu e)    
419                    with InName = t rue;    
420     336  
421                if (chr  == '=' &&  withInName )   337                im.title  = this._s erialize(p a);
422                    with InName = f alse;    
423     338  
424                if (with InName)   339                return i m;
425                    attr ibuteName  += chr;   340           },
426     341  
427                if (with InValue)   342           _p arse : fun ction(s) {
428                    attr ibuteValue  += chr;   343                return t inymce.uti l.JSON.par se('{' + s  + '}');
429            }
  344            } ,
430     345  
431           re turn attri butes;   346           _s erialize :  function( o) {
    347                return t inymce.uti l.JSON.ser ialize(o). replace(/[ {}]/g, '') ;
432       }   348           }
433   }
;
  349        } ) ;
434     350  
435   tiny MCE . add Plugin
( " media " ,   T iny MCE_ MediaPlugi n);
  351       // Reg ister plug in
    352        tiny mce .
Plugin Manager.ad d ( ' media ' ,   t iny mce.plugin s. MediaPlugi n);
    353   })();