480. File Comparison Report

Produced on Mon May 12 13:06:10 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.

480.1 Files compared

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

480.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 35 214
Changed 31 235
Inserted 2 3
Removed 2 5

480.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

480.4 Active regular expressions

No regular expressions were active.

480.5 Comparison detail

1   /**   1   /**
2     *   $Id:   editor_plu gin_src.js  
2 01   200 7 -02- 1 2  
1 5 : 56 : 5 6Z   spocke   $
  2     *   $Id:   editor_plu gin_src.js   65 2  
200 8 -02-
2 9   1 3 : 09 : 4 6Z   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('layer' );   9       tinymc e.create(' tinymce.pl ugins.Laye r', {
    10           in it : funct ion(ed, ur l) {
    11                var t =  this;
10     12  
11   var TinyMC E_LayerPlu gin = {   13                t.editor  = ed;
12       getInf o : functi on() {    
13           re turn {    
14                longname  : 'Layer' ,    
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/layer ',    
18                version  : tinyMCE. majorVersi on + "." +  tinyMCE.m inorVersio n    
19           };    
20       },    
21     14  
22       initIn stance : f unction(in st) {   15                // Regis ter comman ds
23           if  (tinyMCE. isMSIE &&  !tinyMCE.i sOpera)   16                ed.addCo mmand('mce InsertLaye r', t._ins ertLayer,  t);
24                inst.get Doc().exec Command('2 D-Position ');    
25       },    
26     17  
27        h and l e E ve nt   :   function( e )   {   18                 ed.addComm and ('mc e Mo ve Forward',   function(
)   {
28           va r inst = t inyMCE.sel ectedInsta nce;   19                    t._m ove(1);
29           va r w = inst .getWin(),  le = inst ._lastStyl eElm, e;   20                });
30     21  
31           if  (tinyMCE. isGecko) {   22                ed.addCo mmand('mce MoveBackwa rd', funct ion() {
32                e = this ._getParen tLayer(ins t.getFocus Element()) ;   23                    t._m ove(-1);
    24                });
33     25  
34                if (e) {   26                ed.addCo mmand('mce MakeAbsolu te', funct ion() {
35                    if ( !inst._las tStyleElm)  {   27                    t._t oggleAbsol ute();
36                         e.style.ov erflow = ' auto';   28                 } );
37                         inst._last StyleElm =  e;    
38                    }    
39                } else i f (le) {    
40                    le =  inst._las tStyleElm;    
41                    le.s tyle.width  = le.scro llWidth +  'px';    
42                    le.s tyle.heigh t = le.scr ollHeight  + 'px';    
43                    le.s tyle.overf low = '';    
44                    inst ._lastStyl eElm = nul l;    
45                }    
46            }
   
47     29  
48           re turn true;   30                // Regis ter button s
49       },   31                ed.addBu tton('move forward',  {title : ' layer.forw ard_desc',  cmd : 'mc eMoveForwa rd'});
    32                ed.addBu tton('move backward',  {title :  'layer.bac kward_desc ', cmd : ' mceMoveBac kward'});
    33                ed.addBu tton('abso lute', {ti tle : 'lay er.absolut e_desc', c md : 'mceM akeAbsolut e'});
    34                ed.addBu tton('inse rtlayer',  {title : ' layer.inse rtlayer_de sc', cmd :  'mceInser tLayer'});
50     35  
51       handle VisualAid  : function (el, deep,  state, in st) {   36                ed.onIni t.add(func tion() {
52           va r nl = ins t.getDoc() .getElemen tsByTagNam e("div"),  i;   37                    if ( tinymce.is IE)
    38                         ed.getDoc( ).execComm and('2D-Po sition', f alse, true );
    39                });
53     40  
54           fo r (i=0; i< nl.length;  i++) {   41                ed.onNod eChange.ad d(t._nodeC hange, t);
55                if (new  RegExp('ab solute|rel ative|stat ic', 'gi') .test(nl[i ].style.po sition)) {   42                ed.onVis ualAid.add (t._visual Aid, t);
56                    if ( state)    
57                         tinyMCE.ad dCSSClass( nl[i], 'mc eVisualAid ');    
58                    else    
59                         tinyMCE.re moveCSSCla ss(nl[i],  'mceVisual Aid');                        
60                }    
61           }    
62       },   43           },
63     44  
64        get Co n tr o lHTML   :   function( cn )   {   45            get I n f o  
:   function(
)   {
65           sw itch (cn)  {   46                 return   {
66                case "mo veforward" :   47                    long name : 'La yer',
67                    retu rn tinyMCE .getButton HTML(cn, ' lang_layer _forward_d esc', '{$p luginurl}/ images/mov eforward.g if', 'mceM oveForward ', true);   48                    auth or : 'Moxi ecode Syst ems AB',
68     49                    auth orurl : 'h ttp://tiny mce.moxiec ode.com',
69                case "mo vebackward ":   50                    info url : 'htt p://wiki.m oxiecode.c om/index.p hp/TinyMCE :Plugins/l ayer',
70                    retu rn tinyMCE .getButton HTML(cn, ' lang_layer _backward_ desc', '{$ pluginurl} /images/mo vebackward .gif', 'mc eMoveBackw ard', true );   51                    vers ion : tiny mce.majorV ersion + " ." + tinym ce.minorVe rsion
71     52                };
72                case "ab solute":    
73                    retu rn tinyMCE .getButton HTML(cn, ' lang_layer _absolute_ desc', '{$ pluginurl} /images/ab solute.gif ', 'mceMak eAbsolute' , true);    
74      
75                case "in sertlayer" :    
76                    retu rn tinyMCE .getButton HTML(cn, ' lang_layer _insertlay er_desc',  '{$pluginu rl}/images /insertlay er.gif', ' mceInsertL ayer', tru e);    
77           }    
78      
79            return   "";    
80       },   53           },
81     54  
82       execCo mmand : fu nction(edi tor_id, el ement, com mand, user _interface , value) {   55           //  Private m ethods
83           //  Handle co mmands    
84           sw itch (comm and) {    
85                case "mc eInsertLay er":    
86                    this ._insertLa yer();    
87                    retu rn true;    
88     56  
89                case "mc eMoveForwa rd":   57           _n odeChange  : function (ed, cm, n ) {
90                    this ._move(1);   58                var le,  p;
91                    retu rn true;    
92     59  
93                case "mc eMoveBackw ard":   60                le = thi s._getPare ntLayer(n) ;
94                    this ._move(-1) ;   61                p = ed.d om.getPare nt(n, 'DIV ,P,IMG');
95                    retu rn true;    
96     62  
97                case "mc eMakeAbsol ute":   63                if (!p)  {
98                    
t h is ._togg le A bsolute ( );
  64                     cm.se t D is ab le d('a bsolute ',   1 );
99                    retu rn true;   65                    cm.s etDisabled ('moveforw ard', 1);
    66                    cm.s etDisabled ('moveback ward', 1);
    67                } else {
    68                    cm.s etDisabled ('absolute ', 0);
    69                    cm.s etDisabled ('moveforw ard', !le) ;
    70                    cm.s etDisabled ('moveback ward', !le );
    71                    cm.s etActive(' absolute',  le && le. style.posi tion.toLow erCase() = = "absolut e");
100           }   72                }
101      
102           //  Pass to n ext handle r in chain    
103           re turn false ;    
104       },   73           },
105     74  
106       handle NodeChange  : functio n(editor_i d, node, u ndo_index,  undo_leve ls, visual _aid, any_ selection)  {   75           //  Private m ethods
107           va r inst = t inyMCE.get InstanceBy Id(editor_ id);    
108           va r le = thi s._getPare ntLayer(in st.getFocu sElement() );    
109           va r p = tiny MCE.getPar entElement (inst.getF ocusElemen t(), 'div, p,img');    
110      
111           ti nyMCE.swit chClass(ed itor_id +  '_absolute ', 'mceBut tonDisable d');    
112           ti nyMCE.swit chClass(ed itor_id +  '_moveforw ard', 'mce ButtonDisa bled');    
113           ti nyMCE.swit chClass(ed itor_id +  '_moveback ward', 'mc eButtonDis abled');    
114     76  
115           if  (p)   77           _v isualAid :  function( ed, e, s)  {
116                tinyMCE. switchClas s(editor_i d + '_abso lute', 'mc eButtonNor mal');   78                var dom  = ed.dom;
117     79  
118           if  (le && le .style.pos ition.toLo werCase()  == "absolu te") {   80                tinymce. each(dom.s elect('div ,p', e), f unction(e)  {
119                tinyMCE. switchClas s(editor_i d + '_abso lute', 'mc eButtonSel ected');   81                    if ( /^(absolut e|relative |static)$/ i.test(e.s tyle.posit ion)) {
120                tinyMCE. switchClas s(editor_i d + '_move forward',  'mceButton Normal');   82                         if (s)
121                tinyMCE. switchClas s(editor_i d + '_move backward',  'mceButto nNormal');   83                             dom.ad dClass(e,  'mceItemVi sualAid');
    84                         else
    85                             dom.re moveClass( e, 'mceIte mVisualAid '); 
122           }   86                    }
    87                });
123       },   88           },
124     89  
125       // Pri vate plugi n specific  methods    
126      
127       _move  : function (d) {   90           _m ove : func tion(d) {
128           va r inst = t inyMCE.sel ectedInsta nce, i, z  = new Arra y();   91                 var   ed   =   this.edito r,   i,   z   =   [],   le   =   this._getP arentLayer ( ed. s elec t ion .get N o d e
()),   ci   =   -1,   fi   =   -1 ,   nl ;
129            var  
le   =   this._getP arentLayer ( in s
t
.get F o cusElem e nt ()),   ci   =   -1,   fi   =   -1
;
  92  
130            var   nl   =   tiny MCE.s e
l
e ctNo d es(inst .getBody() ,   function(n )   {
  93                nl = [];
131                 return   n.nodeType   ==   1   &&   new   RegExp ( ' absolute|r elative|st atic ',   'gi' )
.test(n.st yle.positi on) ;
  94                
tiny mc e .wa l k( e
d
.getBody() ,   function(n )   {
132            } );   95                     if   ( n.nodeType   ==   1   &&   /^ (
absolute|r elative|st atic
) $/i .test(n.st yle.positi on) )
    96                         nl.push(n ); 
    97                }, 'chil dNodes');
133     98  
134           //  Find z-in dexes   99                // Find  z-indexes
135           fo r (i=0; i< nl.length;  i++) {   100                for (i=0 ; i<nl.len gth; i++)  {
136                z[i] = n l[i].style .zIndex ?  parseInt(n l[i].style .zIndex) :  0;   101                    z[i]  = nl[i].s tyle.zInde x ? parseI nt(nl[i].s tyle.zInde x) : 0;
137     102  
138                if (ci <  0 && nl[i ] == le)   103                    if ( ci < 0 &&  nl[i] == l e)
139                    ci =  i;   104                         ci = i;
140           }   105                }
141     106  
142           if  (d < 0) {   107                if (d <  0) {
143                // Move  back   108                    // M ove back
144     109  
145                // Try f ind a lowe r one   110                    // T ry find a  lower one
146                for (i=0 ; i<z.leng th; i++) {   111                    for  (i=0; i<z. length; i+ +) {
147                    if ( z[i] < z[c i]) {   112                         if (z[i] <  z[ci]) {
148                         fi = i;   113                             fi = i ;
149                         break;   114                             break;
150                    }   115                         }
151                }   116                    }
152     117  
153                if (fi >  -1) {   118                    if ( fi > -1) {
154                    nl[c i].style.z Index = z[ fi];   119                         nl[ci].sty le.zIndex  = z[fi];
155                    nl[f i].style.z Index = z[ ci];   120                         nl[fi].sty le.zIndex  = z[ci];
156                } else {   121                    } el se {
157                    if ( z[ci] > 0)   122                         if (z[ci]  > 0)
158                         nl[ci].sty le.zIndex  = z[ci] -  1;   123                             nl[ci] .style.zIn dex = z[ci ] - 1;
159                }   124                    }
160           }  else {   125                } else {
161                // Move  forward   126                    // M ove forwar d
162     127  
163                // Try f ind a high er one   128                    // T ry find a  higher one
164                for (i=0 ; i<z.leng th; i++) {   129                    for  (i=0; i<z. length; i+ +) {
165                    if ( z[i] > z[c i]) {   130                         if (z[i] >  z[ci]) {
166                         fi = i;   131                             fi = i ;
167                         break;   132                             break;
168                    }   133                         }
169                }   134                    }
170     135  
171                if (fi >  -1) {   136                    if ( fi > -1) {
172                    nl[c i].style.z Index = z[ fi];   137                         nl[ci].sty le.zIndex  = z[fi];
173                    nl[f i].style.z Index = z[ ci];   138                         nl[fi].sty le.zIndex  = z[ci];
174                } else   139                    } el se
175                    nl[c i].style.z Index = z[ ci] + 1;   140                         nl[ci].sty le.zIndex  = z[ci] +  1;
176           }   141                }
177     142  
178           in st.repaint ();   143                ed.execC ommand('mc eRepaint') ;
179       },   144           },
180     145  
181       _getPa rentLayer  : function (n) {   146           _g etParentLa yer : func tion(n) {
182            return   t
i nyMCE .getParent Node (n,   function(n )   {
  147                 return   t h i s.editor.d om .getParent
(n,   function(n )   {
183                 return   n.nodeType   ==   1   &&   new   RegExp ( ' absolute|r elative|st atic ',   'gi' )
.test(n.st yle.positi on);
  148                     return   n.nodeType   ==   1   &&   /^ (
absolute|r elative|st atic
) $/i .test(n.st yle.positi on);
184           }) ;   149                });
185       },   150           },
186     151  
187       _inser tLayer : f unction()  {   152           _i nsertLayer  : functio n() {
188           va r inst = t inyMCE.sel ectedInsta nce;   153                var ed =  this.edit or, p = ed .dom.getPo s(ed.dom.g etParent(e d.selectio n.getNode( ), '*'));
189           va r e = tiny MCE.getPar entElement (inst.getF ocusElemen t());    
190           va r p = tiny MCE.getAbs Position(e );    
191           va r d = inst .getDoc();    
192           va r ne = d.c reateEleme nt('div');    
193           va r h = inst .selection .getSelect edHTML();    
194      
195           //  Move div    
196           ne .style.pos ition = 'a bsolute';    
197           ne .style.lef t = p.absL eft + 'px' ;    
198           ne .style.top  = (p.absT op > 20 ?  p.absTop :  20) + 'px ';    
199           ne .style.wid th = '100p x';    
200           ne .style.hei ght = '100 px';    
201           ne .className  = 'mceVis ualAid';    
202      
203           if  (!h)    
204                h = tiny MCE.getLan g('lang_la yer_conten t');    
205     154  
206           ne .innerHTML  = h;   155                ed.dom.a dd(ed.getB ody(), 'di v', {
207  
  156                    styl e : {
208           //  Add it   157                         position :  'absolute ',
209           d. body.appen dChild(ne) ;   158                         left : p.x ,
    159                         top : (p.y  > 20 ? p. y : 20),
    160                         width : 10 0,
    161                         height : 1 00
    162                     },
    163                    'cla ss' : 'mce ItemVisual Aid'
    164                }, ed.se lection.ge tContent()  || ed.get Lang('laye r.content' ));
210       },   165           },
211     166  
212       _toggl eAbsolute  : function () {   167           _t oggleAbsol ute : func tion() {
213           va r inst = t inyMCE.sel ectedInsta nce;   168                 var   ed   =   this.edito r,   le   =   this._getP arentLayer ( ed. s elec t ion .get N o d e
());
214            var  
le   =   this._getP arentLayer ( in s
t
.get F o cusElem e nt ());
   
215     169  
216            if   (
le   ==   null )
  170                 if   ( ! le
)
217                 le   =   tinyMCE .getParent El e m e n t ( i
n st .get F o cusElem e nt (),   ' div , p , img ');
  171                     le   =   ed.dom .getParent ( e d.s e lec t
i o n
.get N o d e
(),   ' DIV , P , IMG ');
218     172  
219           if  (le) {   173                if (le)  {
220                if (le.s tyle.posit ion.toLowe rCase() ==  "absolute ") {   174                    if ( le.style.p osition.to LowerCase( ) == "abso lute") {
221                    le.s tyle.posit ion = "";   175                         ed.dom.set Styles(le,  {
222                    le.s tyle.left  = "";   176                             positi on : '',
223                    le.s tyle.top =  "";   177                             left :  '',
224                }  else {   178                             top :  '',
225                    le.s tyle.posit ion = "abs olute";   179                             width  : '',
    180                             height  : ''
    181                         } );
226     182  
    183                         ed.dom.rem oveClass(l e, 'mceIte mVisualAid ');
    184                    } el se {
227                    if ( le.style.l eft == "")   185                         if (le.sty le.left ==  "")
228                         le.style.l eft = 20 +  'px';   186                             le.sty le.left =  20 + 'px';
229     187  
230                    if ( le.style.t op == "")   188                         if (le.sty le.top ==  "")
231                         le.style.t op = 20 +  'px';   189                             le.sty le.top = 2 0 + 'px';
232     190  
233                    if ( le.style.w idth == "" )   191                         if (le.sty le.width = = "")
234                         le.style.w idth = le. width ? (l e.width +  'px') : '1 00px';   192                             le.sty le.width =  le.width  ? (le.widt h + 'px')  : '100px';
235     193  
236                    if ( le.style.h eight == " ")   194                         if (le.sty le.height  == "")
237                         le.style.h eight = le .height ?  (le.height  + 'px') :  '100px';   195                             le.sty le.height  = le.heigh t ? (le.he ight + 'px ') : '100p x';
238     196  
239                    tiny MCE.handle VisualAid( inst.getBo dy(), true , inst.vis ualAid, in st);   197                         le.style.p osition =  "absolute" ;
    198                         ed.addVisu al(ed.getB ody());
240                }   199                    }
241     200  
242                inst.rep aint();   201                    ed.e xecCommand ('mceRepai nt');
243                 tinyMCE.tr igg e rN odeChange
();
  202                    
e d.n odeChange d ();
244           }   203                }
245       }   204           }
246   }
;
  205        } ) ;
247     206  
248   tiny MCE . add Plugin
( " layer " ,   T iny MCE_Lay e rP lugin
);
  207       // Reg ister plug in
    208        tiny mce .
Plugin Manager.ad d ( ' layer ' ,   t iny mc e .p lugin s.Layer );
    209   })();