JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.6.1
[ckeditor.git] / plugins / find / dialogs / find.js
index efc2086..6fac7c1 100644 (file)
@@ -1,9 +1,10 @@
 /*\r
-Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.\r
+Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.\r
 For licensing, see LICENSE.html or http://ckeditor.com/license\r
 */\r
 \r
-(function(){function a(h){return h.type==CKEDITOR.NODE_TEXT&&h.getLength()>0;};function b(h){return!(h.type==CKEDITOR.NODE_ELEMENT&&h.isBlockBoundary(CKEDITOR.tools.extend({},CKEDITOR.dtd.$empty,CKEDITOR.dtd.$nonEditable)));};var c=function(){var h=this;return{textNode:h.textNode,offset:h.offset,character:h.textNode?h.textNode.getText().charAt(h.offset):null,hitMatchBoundary:h._.matchBoundary};},d=['find','replace'],e=[['txtFindFind','txtFindReplace'],['txtFindCaseChk','txtReplaceCaseChk'],['txtFindWordChk','txtReplaceWordChk'],['txtFindCyclic','txtReplaceCyclic']];function f(h){var i,j,k,l;i=h==='find'?1:0;j=1-i;var m,n=e.length;for(m=0;m<n;m++){k=this.getContentElement(d[i],e[m][i]);l=this.getContentElement(d[j],e[m][j]);l.setValue(k.getValue());}};var g=function(h,i){var j=new CKEDITOR.style(CKEDITOR.tools.extend({fullMatch:true,childRule:function(){return false;}},h.config.find_highlight)),k=function(w,x){var y=new CKEDITOR.dom.walker(w);y.guard=x?b:null;y.evaluator=a;y.breakOnFalse=true;this._={matchWord:x,walker:y,matchBoundary:false};};k.prototype={next:function(){return this.move();},back:function(){return this.move(true);},move:function(w){var y=this;var x=y.textNode;if(x===null)return c.call(y);y._.matchBoundary=false;if(x&&w&&y.offset>0){y.offset--;return c.call(y);}else if(x&&y.offset<x.getLength()-1){y.offset++;return c.call(y);}else{x=null;while(!x){x=y._.walker[w?'previous':'next'].call(y._.walker);if(y._.matchWord&&!x||y._.walker._.end)break;if(!x&&!b(y._.walker.current))y._.matchBoundary=true;}y.textNode=x;if(x)y.offset=w?x.getLength()-1:0;else y.offset=0;}return c.call(y);}};var l=function(w,x){this._={walker:w,cursors:[],rangeLength:x,highlightRange:null,isMatched:false};};l.prototype={toDomRange:function(){var w=new CKEDITOR.dom.range(h.document),x=this._.cursors;if(x.length<1){var y=this._.walker.textNode;if(y)w.setStartAfter(y);else return null;}else{var z=x[0],A=x[x.length-1];w.setStart(z.textNode,z.offset);w.setEnd(A.textNode,A.offset+1);}return w;},updateFromDomRange:function(w){var z=this;var x,y=new k(w);z._.cursors=[];do{x=y.next();if(x.character)z._.cursors.push(x);}while(x.character)z._.rangeLength=z._.cursors.length;},setMatched:function(){this._.isMatched=true;},clearMatched:function(){this._.isMatched=false;},isMatched:function(){return this._.isMatched;},highlight:function(){var y=this;if(y._.cursors.length<1)return;if(y._.highlightRange)y.removeHighlight();var w=y.toDomRange();j.applyToRange(w);y._.highlightRange=w;var x=w.startContainer;\r
-if(x.type!=CKEDITOR.NODE_ELEMENT)x=x.getParent();x.scrollIntoView();y.updateFromDomRange(w);},removeHighlight:function(){var w=this;if(!w._.highlightRange)return;j.removeFromRange(w._.highlightRange);w.updateFromDomRange(w._.highlightRange);w._.highlightRange=null;},moveBack:function(){var y=this;var w=y._.walker.back(),x=y._.cursors;if(w.hitMatchBoundary)y._.cursors=x=[];x.unshift(w);if(x.length>y._.rangeLength)x.pop();return w;},moveNext:function(){var y=this;var w=y._.walker.next(),x=y._.cursors;if(w.hitMatchBoundary)y._.cursors=x=[];x.push(w);if(x.length>y._.rangeLength)x.shift();return w;},getEndCharacter:function(){var w=this._.cursors;if(w.length<1)return null;return w[w.length-1].character;},getNextCharacterRange:function(w){var x,y,z=this._.cursors;if((x=z[z.length-1])&&x.textNode)y=new k(m(x));else y=this._.walker;return new l(y,w);},getCursors:function(){return this._.cursors;}};function m(w,x){var y=new CKEDITOR.dom.range();y.setStart(w.textNode,x?w.offset:w.offset+1);y.setEndAt(h.document.getBody(),CKEDITOR.POSITION_BEFORE_END);return y;};function n(w){var x=new CKEDITOR.dom.range();x.setStartAt(h.document.getBody(),CKEDITOR.POSITION_AFTER_START);x.setEnd(w.textNode,w.offset);return x;};var o=0,p=1,q=2,r=function(w,x){var y=[-1];if(x)w=w.toLowerCase();for(var z=0;z<w.length;z++){y.push(y[z]+1);while(y[z+1]>0&&w.charAt(z)!=w.charAt(y[z+1]-1))y[z+1]=y[y[z+1]-1]+1;}this._={overlap:y,state:0,ignoreCase:!!x,pattern:w};};r.prototype={feedCharacter:function(w){var x=this;if(x._.ignoreCase)w=w.toLowerCase();for(;;){if(w==x._.pattern.charAt(x._.state)){x._.state++;if(x._.state==x._.pattern.length){x._.state=0;return q;}return p;}else if(!x._.state)return o;else x._.state=x._.overlap[x._.state];}return null;},reset:function(){this._.state=0;}};var s=/[.,"'?!;: \u0085\u00a0\u1680\u280e\u2028\u2029\u202f\u205f\u3000]/,t=function(w){if(!w)return true;var x=w.charCodeAt(0);return x>=9&&x<=13||x>=8192&&x<=8202||s.test(w);},u={searchRange:null,matchRange:null,find:function(w,x,y,z,A,B){var K=this;if(!K.matchRange)K.matchRange=new l(new k(K.searchRange),w.length);else{K.matchRange.removeHighlight();K.matchRange=K.matchRange.getNextCharacterRange(w.length);}var C=new r(w,!x),D=o,E='%';while(E!==null){K.matchRange.moveNext();while(E=K.matchRange.getEndCharacter()){D=C.feedCharacter(E);if(D==q)break;if(K.matchRange.moveNext().hitMatchBoundary)C.reset();}if(D==q){if(y){var F=K.matchRange.getCursors(),G=F[F.length-1],H=F[0],I=new k(n(H),true),J=new k(m(G),true);if(!(t(I.back().character)&&t(J.next().character)))continue;\r
-}K.matchRange.setMatched();if(A!==false)K.matchRange.highlight();return true;}}K.matchRange.clearMatched();K.matchRange.removeHighlight();if(z&&!B){K.searchRange=v(true);K.matchRange=null;return arguments.callee.apply(K,Array.prototype.slice.call(arguments).concat([true]));}return false;},replaceCounter:0,replace:function(w,x,y,z,A,B,C){var H=this;var D=false;if(H.matchRange&&H.matchRange.isMatched()&&!H.matchRange._.isReplaced){H.matchRange.removeHighlight();var E=H.matchRange.toDomRange(),F=h.document.createText(y);if(!C){var G=h.getSelection();G.selectRanges([E]);h.fire('saveSnapshot');}E.deleteContents();E.insertNode(F);if(!C){G.selectRanges([E]);h.fire('saveSnapshot');}H.matchRange.updateFromDomRange(E);if(!C)H.matchRange.highlight();H.matchRange._.isReplaced=true;H.replaceCounter++;D=true;}else D=H.find(x,z,A,B,!C);return D;}};function v(w){var x,y=h.getSelection(),z=h.document.getBody();if(y&&!w){x=y.getRanges()[0].clone();x.collapse(true);}else{x=new CKEDITOR.dom.range();x.setStartAt(z,CKEDITOR.POSITION_AFTER_START);}x.setEndAt(z,CKEDITOR.POSITION_BEFORE_END);return x;};return{title:h.lang.findAndReplace.title,resizable:CKEDITOR.DIALOG_RESIZE_NONE,minWidth:350,minHeight:165,buttons:[CKEDITOR.dialog.cancelButton],contents:[{id:'find',label:h.lang.findAndReplace.find,title:h.lang.findAndReplace.find,accessKey:'',elements:[{type:'hbox',widths:['230px','90px'],children:[{type:'text',id:'txtFindFind',label:h.lang.findAndReplace.findWhat,isChanged:false,labelLayout:'horizontal',accessKey:'F'},{type:'button',align:'left',style:'width:100%',label:h.lang.findAndReplace.find,onClick:function(){var w=this.getDialog();if(!u.find(w.getValueOf('find','txtFindFind'),w.getValueOf('find','txtFindCaseChk'),w.getValueOf('find','txtFindWordChk'),w.getValueOf('find','txtFindCyclic')))alert(h.lang.findAndReplace.notFoundMsg);}}]},{type:'vbox',padding:0,children:[{type:'checkbox',id:'txtFindCaseChk',isChanged:false,style:'margin-top:28px',label:h.lang.findAndReplace.matchCase},{type:'checkbox',id:'txtFindWordChk',isChanged:false,label:h.lang.findAndReplace.matchWord},{type:'checkbox',id:'txtFindCyclic',isChanged:false,'default':true,label:h.lang.findAndReplace.matchCyclic}]}]},{id:'replace',label:h.lang.findAndReplace.replace,accessKey:'M',elements:[{type:'hbox',widths:['230px','90px'],children:[{type:'text',id:'txtFindReplace',label:h.lang.findAndReplace.findWhat,isChanged:false,labelLayout:'horizontal',accessKey:'F'},{type:'button',align:'left',style:'width:100%',label:h.lang.findAndReplace.replace,onClick:function(){var w=this.getDialog();\r
-if(!u.replace(w,w.getValueOf('replace','txtFindReplace'),w.getValueOf('replace','txtReplace'),w.getValueOf('replace','txtReplaceCaseChk'),w.getValueOf('replace','txtReplaceWordChk'),w.getValueOf('replace','txtReplaceCyclic')))alert(h.lang.findAndReplace.notFoundMsg);}}]},{type:'hbox',widths:['230px','90px'],children:[{type:'text',id:'txtReplace',label:h.lang.findAndReplace.replaceWith,isChanged:false,labelLayout:'horizontal',accessKey:'R'},{type:'button',align:'left',style:'width:100%',label:h.lang.findAndReplace.replaceAll,isChanged:false,onClick:function(){var w=this.getDialog(),x;u.replaceCounter=0;u.searchRange=v(true);if(u.matchRange){u.matchRange.removeHighlight();u.matchRange=null;}h.fire('saveSnapshot');while(u.replace(w,w.getValueOf('replace','txtFindReplace'),w.getValueOf('replace','txtReplace'),w.getValueOf('replace','txtReplaceCaseChk'),w.getValueOf('replace','txtReplaceWordChk'),false,true)){}if(u.replaceCounter){alert(h.lang.findAndReplace.replaceSuccessMsg.replace(/%1/,u.replaceCounter));h.fire('saveSnapshot');}else alert(h.lang.findAndReplace.notFoundMsg);}}]},{type:'vbox',padding:0,children:[{type:'checkbox',id:'txtReplaceCaseChk',isChanged:false,label:h.lang.findAndReplace.matchCase},{type:'checkbox',id:'txtReplaceWordChk',isChanged:false,label:h.lang.findAndReplace.matchWord},{type:'checkbox',id:'txtReplaceCyclic',isChanged:false,'default':true,label:h.lang.findAndReplace.matchCyclic}]}]}],onLoad:function(){var w=this,x,y,z=false;this.on('hide',function(){z=false;});this.on('show',function(){z=true;});this.selectPage=CKEDITOR.tools.override(this.selectPage,function(A){return function(B){A.call(w,B);var C=w._.tabs[B],D,E,F;E=B==='find'?'txtFindFind':'txtFindReplace';F=B==='find'?'txtFindWordChk':'txtReplaceWordChk';x=w.getContentElement(B,E);y=w.getContentElement(B,F);if(!C.initialized){D=CKEDITOR.document.getById(x._.inputId);C.initialized=true;}if(z)f.call(this,B);};});},onShow:function(){u.searchRange=v();this.selectPage(i);},onHide:function(){var w;if(u.matchRange&&u.matchRange.isMatched()){u.matchRange.removeHighlight();h.focus();w=u.matchRange.toDomRange();if(w)h.getSelection().selectRanges([w]);}delete u.matchRange;},onFocus:function(){if(i=='replace')return this.getContentElement('replace','txtFindReplace');else return this.getContentElement('find','txtFindFind');}};};CKEDITOR.dialog.add('find',function(h){return g(h,'find');});CKEDITOR.dialog.add('replace',function(h){return g(h,'replace');});})();\r
+(function(){var a;function b(i){return i.type==CKEDITOR.NODE_TEXT&&i.getLength()>0&&(!a||!i.isReadOnly());};function c(i){return!(i.type==CKEDITOR.NODE_ELEMENT&&i.isBlockBoundary(CKEDITOR.tools.extend({},CKEDITOR.dtd.$empty,CKEDITOR.dtd.$nonEditable)));};var d=function(){var i=this;return{textNode:i.textNode,offset:i.offset,character:i.textNode?i.textNode.getText().charAt(i.offset):null,hitMatchBoundary:i._.matchBoundary};},e=['find','replace'],f=[['txtFindFind','txtFindReplace'],['txtFindCaseChk','txtReplaceCaseChk'],['txtFindWordChk','txtReplaceWordChk'],['txtFindCyclic','txtReplaceCyclic']];function g(i){var j,k,l,m;j=i==='find'?1:0;k=1-j;var n,o=f.length;for(n=0;n<o;n++){l=this.getContentElement(e[j],f[n][j]);m=this.getContentElement(e[k],f[n][k]);m.setValue(l.getValue());}};var h=function(i,j){var k=new CKEDITOR.style(CKEDITOR.tools.extend({fullMatch:true,childRule:function(){return 0;}},i.config.find_highlight)),l=function(y,z){var A=this,B=new CKEDITOR.dom.walker(y);B.guard=z?c:function(C){!c(C)&&(A._.matchBoundary=true);};B.evaluator=b;B.breakOnFalse=1;if(y.startContainer.type==CKEDITOR.NODE_TEXT){this.textNode=y.startContainer;this.offset=y.startOffset-1;}this._={matchWord:z,walker:B,matchBoundary:false};};l.prototype={next:function(){return this.move();},back:function(){return this.move(true);},move:function(y){var A=this;var z=A.textNode;if(z===null)return d.call(A);A._.matchBoundary=false;if(z&&y&&A.offset>0){A.offset--;return d.call(A);}else if(z&&A.offset<z.getLength()-1){A.offset++;return d.call(A);}else{z=null;while(!z){z=A._.walker[y?'previous':'next'].call(A._.walker);if(A._.matchWord&&!z||A._.walker._.end)break;}A.textNode=z;if(z)A.offset=y?z.getLength()-1:0;else A.offset=0;}return d.call(A);}};var m=function(y,z){this._={walker:y,cursors:[],rangeLength:z,highlightRange:null,isMatched:0};};m.prototype={toDomRange:function(){var y=new CKEDITOR.dom.range(i.document),z=this._.cursors;if(z.length<1){var A=this._.walker.textNode;if(A)y.setStartAfter(A);else return null;}else{var B=z[0],C=z[z.length-1];y.setStart(B.textNode,B.offset);y.setEnd(C.textNode,C.offset+1);}return y;},updateFromDomRange:function(y){var B=this;var z,A=new l(y);B._.cursors=[];do{z=A.next();if(z.character)B._.cursors.push(z);}while(z.character);B._.rangeLength=B._.cursors.length;},setMatched:function(){this._.isMatched=true;},clearMatched:function(){this._.isMatched=false;},isMatched:function(){return this._.isMatched;},highlight:function(){var B=this;if(B._.cursors.length<1)return;\r
+if(B._.highlightRange)B.removeHighlight();var y=B.toDomRange(),z=y.createBookmark();k.applyToRange(y);y.moveToBookmark(z);B._.highlightRange=y;var A=y.startContainer;if(A.type!=CKEDITOR.NODE_ELEMENT)A=A.getParent();A.scrollIntoView();B.updateFromDomRange(y);},removeHighlight:function(){var z=this;if(!z._.highlightRange)return;var y=z._.highlightRange.createBookmark();k.removeFromRange(z._.highlightRange);z._.highlightRange.moveToBookmark(y);z.updateFromDomRange(z._.highlightRange);z._.highlightRange=null;},isReadOnly:function(){if(!this._.highlightRange)return 0;return this._.highlightRange.startContainer.isReadOnly();},moveBack:function(){var A=this;var y=A._.walker.back(),z=A._.cursors;if(y.hitMatchBoundary)A._.cursors=z=[];z.unshift(y);if(z.length>A._.rangeLength)z.pop();return y;},moveNext:function(){var A=this;var y=A._.walker.next(),z=A._.cursors;if(y.hitMatchBoundary)A._.cursors=z=[];z.push(y);if(z.length>A._.rangeLength)z.shift();return y;},getEndCharacter:function(){var y=this._.cursors;if(y.length<1)return null;return y[y.length-1].character;},getNextCharacterRange:function(y){var z,A,B=this._.cursors;if((z=B[B.length-1])&&z.textNode)A=new l(n(z));else A=this._.walker;return new m(A,y);},getCursors:function(){return this._.cursors;}};function n(y,z){var A=new CKEDITOR.dom.range();A.setStart(y.textNode,z?y.offset:y.offset+1);A.setEndAt(i.document.getBody(),CKEDITOR.POSITION_BEFORE_END);return A;};function o(y){var z=new CKEDITOR.dom.range();z.setStartAt(i.document.getBody(),CKEDITOR.POSITION_AFTER_START);z.setEnd(y.textNode,y.offset);return z;};var p=0,q=1,r=2,s=function(y,z){var A=[-1];if(z)y=y.toLowerCase();for(var B=0;B<y.length;B++){A.push(A[B]+1);while(A[B+1]>0&&y.charAt(B)!=y.charAt(A[B+1]-1))A[B+1]=A[A[B+1]-1]+1;}this._={overlap:A,state:0,ignoreCase:!!z,pattern:y};};s.prototype={feedCharacter:function(y){var z=this;if(z._.ignoreCase)y=y.toLowerCase();for(;;){if(y==z._.pattern.charAt(z._.state)){z._.state++;if(z._.state==z._.pattern.length){z._.state=0;return r;}return q;}else if(!z._.state)return p;else z._.state=z._.overlap[z._.state];}return null;},reset:function(){this._.state=0;}};var t=/[.,"'?!;: \u0085\u00a0\u1680\u280e\u2028\u2029\u202f\u205f\u3000]/,u=function(y){if(!y)return true;var z=y.charCodeAt(0);return z>=9&&z<=13||z>=8192&&z<=8202||t.test(y);},v={searchRange:null,matchRange:null,find:function(y,z,A,B,C,D){var M=this;if(!M.matchRange)M.matchRange=new m(new l(M.searchRange),y.length);else{M.matchRange.removeHighlight();M.matchRange=M.matchRange.getNextCharacterRange(y.length);\r
+}var E=new s(y,!z),F=p,G='%';while(G!==null){M.matchRange.moveNext();while(G=M.matchRange.getEndCharacter()){F=E.feedCharacter(G);if(F==r)break;if(M.matchRange.moveNext().hitMatchBoundary)E.reset();}if(F==r){if(A){var H=M.matchRange.getCursors(),I=H[H.length-1],J=H[0],K=new l(o(J),true),L=new l(n(I),true);if(!(u(K.back().character)&&u(L.next().character)))continue;}M.matchRange.setMatched();if(C!==false)M.matchRange.highlight();return true;}}M.matchRange.clearMatched();M.matchRange.removeHighlight();if(B&&!D){M.searchRange=w(1);M.matchRange=null;return arguments.callee.apply(M,Array.prototype.slice.call(arguments).concat([true]));}return false;},replaceCounter:0,replace:function(y,z,A,B,C,D,E){var J=this;a=1;var F=0;if(J.matchRange&&J.matchRange.isMatched()&&!J.matchRange._.isReplaced&&!J.matchRange.isReadOnly()){J.matchRange.removeHighlight();var G=J.matchRange.toDomRange(),H=i.document.createText(A);if(!E){var I=i.getSelection();I.selectRanges([G]);i.fire('saveSnapshot');}G.deleteContents();G.insertNode(H);if(!E){I.selectRanges([G]);i.fire('saveSnapshot');}J.matchRange.updateFromDomRange(G);if(!E)J.matchRange.highlight();J.matchRange._.isReplaced=true;J.replaceCounter++;F=1;}else F=J.find(z,B,C,D,!E);a=0;return F;}};function w(y){var z,A=i.getSelection(),B=i.document.getBody();if(A&&!y){z=A.getRanges()[0].clone();z.collapse(true);}else{z=new CKEDITOR.dom.range();z.setStartAt(B,CKEDITOR.POSITION_AFTER_START);}z.setEndAt(B,CKEDITOR.POSITION_BEFORE_END);return z;};var x=i.lang.findAndReplace;return{title:x.title,resizable:CKEDITOR.DIALOG_RESIZE_NONE,minWidth:350,minHeight:170,buttons:[CKEDITOR.dialog.cancelButton],contents:[{id:'find',label:x.find,title:x.find,accessKey:'',elements:[{type:'hbox',widths:['230px','90px'],children:[{type:'text',id:'txtFindFind',label:x.findWhat,isChanged:false,labelLayout:'horizontal',accessKey:'F'},{type:'button',id:'btnFind',align:'left',style:'width:100%',label:x.find,onClick:function(){var y=this.getDialog();if(!v.find(y.getValueOf('find','txtFindFind'),y.getValueOf('find','txtFindCaseChk'),y.getValueOf('find','txtFindWordChk'),y.getValueOf('find','txtFindCyclic')))alert(x.notFoundMsg);}}]},{type:'vbox',padding:0,children:[{type:'checkbox',id:'txtFindCaseChk',isChanged:false,style:'margin-top:28px',label:x.matchCase},{type:'checkbox',id:'txtFindWordChk',isChanged:false,label:x.matchWord},{type:'checkbox',id:'txtFindCyclic',isChanged:false,'default':true,label:x.matchCyclic}]}]},{id:'replace',label:x.replace,accessKey:'M',elements:[{type:'hbox',widths:['230px','90px'],children:[{type:'text',id:'txtFindReplace',label:x.findWhat,isChanged:false,labelLayout:'horizontal',accessKey:'F'},{type:'button',id:'btnFindReplace',align:'left',style:'width:100%',label:x.replace,onClick:function(){var y=this.getDialog();\r
+if(!v.replace(y,y.getValueOf('replace','txtFindReplace'),y.getValueOf('replace','txtReplace'),y.getValueOf('replace','txtReplaceCaseChk'),y.getValueOf('replace','txtReplaceWordChk'),y.getValueOf('replace','txtReplaceCyclic')))alert(x.notFoundMsg);}}]},{type:'hbox',widths:['230px','90px'],children:[{type:'text',id:'txtReplace',label:x.replaceWith,isChanged:false,labelLayout:'horizontal',accessKey:'R'},{type:'button',id:'btnReplaceAll',align:'left',style:'width:100%',label:x.replaceAll,isChanged:false,onClick:function(){var y=this.getDialog(),z;v.replaceCounter=0;v.searchRange=w(1);if(v.matchRange){v.matchRange.removeHighlight();v.matchRange=null;}i.fire('saveSnapshot');while(v.replace(y,y.getValueOf('replace','txtFindReplace'),y.getValueOf('replace','txtReplace'),y.getValueOf('replace','txtReplaceCaseChk'),y.getValueOf('replace','txtReplaceWordChk'),false,true)){}if(v.replaceCounter){alert(x.replaceSuccessMsg.replace(/%1/,v.replaceCounter));i.fire('saveSnapshot');}else alert(x.notFoundMsg);}}]},{type:'vbox',padding:0,children:[{type:'checkbox',id:'txtReplaceCaseChk',isChanged:false,label:x.matchCase},{type:'checkbox',id:'txtReplaceWordChk',isChanged:false,label:x.matchWord},{type:'checkbox',id:'txtReplaceCyclic',isChanged:false,'default':true,label:x.matchCyclic}]}]}],onLoad:function(){var y=this,z,A,B=0;this.on('hide',function(){B=0;});this.on('show',function(){B=1;});this.selectPage=CKEDITOR.tools.override(this.selectPage,function(C){return function(D){C.call(y,D);var E=y._.tabs[D],F,G,H;G=D==='find'?'txtFindFind':'txtFindReplace';H=D==='find'?'txtFindWordChk':'txtReplaceWordChk';z=y.getContentElement(D,G);A=y.getContentElement(D,H);if(!E.initialized){F=CKEDITOR.document.getById(z._.inputId);E.initialized=true;}if(B)g.call(this,D);};});},onShow:function(){var B=this;v.searchRange=w();var y=B.getParentEditor().getSelection().getSelectedText(),z=j=='find'?'txtFindFind':'txtFindReplace',A=B.getContentElement(j,z);A.setValue(y);A.select();B.selectPage(j);B[(j=='find'&&B._.editor.readOnly?'hide':'show')+'Page']('replace');},onHide:function(){var y;if(v.matchRange&&v.matchRange.isMatched()){v.matchRange.removeHighlight();i.focus();y=v.matchRange.toDomRange();if(y)i.getSelection().selectRanges([y]);}delete v.matchRange;},onFocus:function(){if(j=='replace')return this.getContentElement('replace','txtFindReplace');else return this.getContentElement('find','txtFindFind');}};};CKEDITOR.dialog.add('find',function(i){return h(i,'find');});CKEDITOR.dialog.add('replace',function(i){return h(i,'replace');\r
+});})();\r