src/pyams_skin/resources/js/ext/tinymce/dev/plugins/searchreplace/plugin.min.js
changeset 69 a361355b55c7
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_skin/resources/js/ext/tinymce/dev/plugins/searchreplace/plugin.min.js	Wed Jun 17 10:00:10 2015 +0200
@@ -0,0 +1,1 @@
+(function(){function b(n,f,c,t,h){var g,i=[],s,l=0,o;var r,d,k;o=f.ownerDocument;r=h.getBlockElements();d=h.getWhiteSpaceElements();k=h.getShortEndedElements();function p(u,v){v=v||0;if(!u[0]){throw"findAndReplaceDOMText cannot handle zero-length matches"}var w=u.index;if(v>0){var x=u[v];if(!x){throw"Invalid capture group"}w+=u[0].indexOf(x);u[0]=x}return[w,w+u[0].length,[u[0]]]}function q(u){var m;if(u.nodeType===3){return u.data}if(d[u.nodeName]&&!r[u.nodeName]){return""}m="";if(r[u.nodeName]||k[u.nodeName]){m+="\n"}if((u=u.firstChild)){do{m+=q(u)}while((u=u.nextSibling))}return m}function j(w,y,C){var u,B,z,v,D=[],A=0,x=w,m=y.shift(),E=0;out:while(true){if(r[x.nodeName]||k[x.nodeName]){A++}if(x.nodeType===3){if(!B&&x.length+A>=m[1]){B=x;v=m[1]-A}else{if(u){D.push(x)}}if(!u&&x.length+A>m[0]){u=x;z=m[0]-A}A+=x.length}if(u&&B){x=C({startNode:u,startNodeIndex:z,endNode:B,endNodeIndex:v,innerNodes:D,match:m[2],matchIndex:E});A-=(B.length-v);u=null;B=null;D=[];m=y.shift();E++;if(!m){break}}else{if((!d[x.nodeName]||r[x.nodeName])&&x.firstChild){x=x.firstChild;continue}else{if(x.nextSibling){x=x.nextSibling;continue}}}while(true){if(x.nextSibling){x=x.nextSibling;break}else{if(x.parentNode!==w){x=x.parentNode}else{break out}}}}}function e(v){var m;if(typeof v!="function"){var u=v.nodeType?v:o.createElement(v);m=function(x,w){var y=u.cloneNode(false);y.setAttribute("data-mce-index",w);if(x){y.appendChild(o.createTextNode(x))}return y}}else{m=v}return function(C){var J,w,D,y=C.startNode,F=C.endNode,K=C.matchIndex;if(y===F){var z=y;D=z.parentNode;if(C.startNodeIndex>0){J=o.createTextNode(z.data.substring(0,C.startNodeIndex));D.insertBefore(J,z)}var x=m(C.match[0],K);D.insertBefore(x,z);if(C.endNodeIndex<z.length){w=o.createTextNode(z.data.substring(C.endNodeIndex));D.insertBefore(w,z)}z.parentNode.removeChild(z);return x}else{J=o.createTextNode(y.data.substring(0,C.startNodeIndex));w=o.createTextNode(F.data.substring(C.endNodeIndex));var H=m(y.data.substring(C.startNodeIndex),K);var G=[];for(var B=0,A=C.innerNodes.length;B<A;++B){var L=C.innerNodes[B];var I=m(L.data,K);L.parentNode.replaceChild(I,L);G.push(I)}var E=m(F.data.substring(0,C.endNodeIndex),K);D=y.parentNode;D.insertBefore(J,y);D.insertBefore(H,y);D.removeChild(y);D=F.parentNode;D.insertBefore(E,F);D.insertBefore(w,F);D.removeChild(F);return E}}}s=q(f);if(!s){return}if(n.global){while((g=n.exec(s))){i.push(p(g,t))}}else{g=s.match(n);i.push(p(g,t))}if(i.length){l=i.length;j(f,i,e(c))}return l}function a(f){var l=this,h=-1;function i(){var n={};function m(){o.statusbar.find("#next").disabled(!c(h+1).length);o.statusbar.find("#prev").disabled(!c(h-1).length)}function p(){tinymce.ui.MessageBox.alert("Could not find the specified string.",function(){o.find("#find")[0].focus()})}var o=tinymce.ui.Factory.create({type:"window",layout:"flex",pack:"center",align:"center",onClose:function(){f.focus();l.done()},onSubmit:function(t){var s,q,u,r;t.preventDefault();q=o.find("#case").checked();r=o.find("#words").checked();u=o.find("#find").value();if(!u.length){l.done(false);o.statusbar.items().slice(1).disabled(true);return}if(n.text==u&&n.caseState==q&&n.wholeWord==r){if(c(h+1).length===0){p();return}l.next();m();return}s=l.find(u,q,r);if(!s){p()}o.statusbar.items().slice(1).disabled(s===0);m();n={text:u,caseState:q,wholeWord:r}},buttons:[{text:"Find",onclick:function(){o.submit()}},{text:"Replace",disabled:true,onclick:function(){if(!l.replace(o.find("#replace").value())){o.statusbar.items().slice(1).disabled(true);h=-1;n={}}}},{text:"Replace all",disabled:true,onclick:function(){l.replace(o.find("#replace").value(),true,true);o.statusbar.items().slice(1).disabled(true);n={}}},{type:"spacer",flex:1},{text:"Prev",name:"prev",disabled:true,onclick:function(){l.prev();m()}},{text:"Next",name:"next",disabled:true,onclick:function(){l.next();m()}}],title:"Find and replace",items:{type:"form",padding:20,labelGap:30,spacing:10,items:[{type:"textbox",name:"find",size:40,label:"Find",value:f.selection.getNode().src},{type:"textbox",name:"replace",size:40,label:"Replace with"},{type:"checkbox",name:"case",text:"Match case",label:" "},{type:"checkbox",name:"words",text:"Whole words",label:" "}]}}).renderTo().reflow()}l.init=function(m){m.addMenuItem("searchreplace",{text:"Find and replace",shortcut:"Meta+F",onclick:i,separator:"before",context:"edit"});m.addButton("searchreplace",{tooltip:"Find and replace",shortcut:"Meta+F",onclick:i});m.addCommand("SearchReplace",i);m.shortcuts.add("Meta+F","",i)};function j(n){var m=n.getAttribute("data-mce-index");if(typeof m=="number"){return""+m}return m}function g(o){var n,m;m=f.dom.create("span",{"data-mce-bogus":1});m.className="mce-match-marker";n=f.getBody();l.done(false);return b(o,n,m,false,f.schema)}function e(n){var m=n.parentNode;if(n.firstChild){m.insertBefore(n.firstChild,n)}n.parentNode.removeChild(n)}function c(n){var m,p=[];m=tinymce.toArray(f.getBody().getElementsByTagName("span"));if(m.length){for(var o=0;o<m.length;o++){var q=j(m[o]);if(q===null||!q.length){continue}if(q===n.toString()){p.push(m[o])}}}return p}function k(m){var o=h,p=f.dom;m=m!==false;if(m){o++}else{o--}p.removeClass(c(h),"mce-match-marker-selected");var n=c(o);if(n.length){p.addClass(c(o),"mce-match-marker-selected");f.selection.scrollIntoView(n[0]);return o}return -1}function d(m){m.parentNode.removeChild(m)}l.find=function(p,o,m){p=p.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");p=m?"\\b"+p+"\\b":p;var n=g(new RegExp(p,o?"g":"gi"));if(n){h=-1;h=k(true)}return n};l.next=function(){var m=k(true);if(m!==-1){h=m}};l.prev=function(){var m=k(false);if(m!==-1){h=m}};l.replace=function(w,t,v){var r,m,o,u,q,s=h,n;t=t!==false;o=f.getBody();m=tinymce.toArray(o.getElementsByTagName("span"));for(r=0;r<m.length;r++){var p=j(m[r]);if(p===null||!p.length){continue}u=q=parseInt(p,10);if(v||u===h){if(w.length){m[r].firstChild.nodeValue=w;e(m[r])}else{d(m[r])}while(m[++r]){u=j(m[r]);if(p===null||!p.length){continue}if(u===q){d(m[r])}else{r--;break}}if(t){s--}}else{if(q>h){m[r].setAttribute("data-mce-index",q-1)}}}f.undoManager.add();h=s;if(t){n=c(s+1).length>0;l.next()}else{n=c(s-1).length>0;l.prev()}return !v&&n};l.done=function(o){var p,n,q,r;n=tinymce.toArray(f.getBody().getElementsByTagName("span"));for(p=0;p<n.length;p++){var s=j(n[p]);if(s!==null&&s.length){if(s===h.toString()){if(!q){q=n[p].firstChild}r=n[p].firstChild}e(n[p])}}if(q&&r){var m=f.dom.createRng();m.setStart(q,0);m.setEnd(r,r.data.length);if(o!==false){f.selection.setRng(m)}return m}}}tinymce.PluginManager.add("searchreplace",a)})();
\ No newline at end of file