Mini Shell
!function(e,t){"use strict";function n(e,t){for(var n,r=[],i=0;i<e.length;++i){if(n=c[e[i]]||o(e[i]),!n)throw"module definition dependecy not found: "+e[i];r.push(n)}t.apply(null,r)}function r(e,r,o){if("string"!=typeof e)throw"invalid module definition, module id must be defined and be a string";if(r===t)throw"invalid module definition, dependencies must be specified";if(o===t)throw"invalid module definition, definition function must be specified";n(r,function(){c[e]=o.apply(null,arguments)})}function o(t){for(var n=e,r=t.split(/[.\/]/),o=0;o<r.length;++o){if(!n[r[o]])return;n=n[r[o]]}return n}function i(n){for(var r=0;r<n.length;r++){for(var o=e,i=n[r],a=i.split(/[.\/]/),l=0;l<a.length-1;++l)o[a[l]]===t&&(o[a[l]]={}),o=o[a[l]];o[a[a.length-1]]=c[i]}}var c={};r("tinymce/spellcheckerplugin/DomTextMatcher",[],function(){return function(e,t){function n(e,t){if(!e[0])throw"findAndReplaceDOMText cannot handle zero-length matches";return{start:e.index,end:e.index+e[0].length,text:e[0],data:t}}function r(e){var t;if(3===e.nodeType)return e.data;if(b[e.nodeName]&&!y[e.nodeName])return"";if(t="",(y[e.nodeName]||S[e.nodeName])&&(t+="\n"),e=e.firstChild)do t+=r(e);while(e=e.nextSibling);return t}function o(e,t,n){var r,o,i,c,a,l=[],s=0,d=e,u=0;t=t.slice(0),t.sort(function(e,t){return e.start-t.start}),a=t.shift();e:for(;;){if((y[d.nodeName]||S[d.nodeName])&&s++,3===d.nodeType&&(!o&&d.length+s>=a.end?(o=d,c=a.end-s):r&&l.push(d),!r&&d.length+s>a.start&&(r=d,i=a.start-s),s+=d.length),r&&o){if(d=n({startNode:r,startNodeIndex:i,endNode:o,endNodeIndex:c,innerNodes:l,match:a.text,matchIndex:u}),s-=o.length-c,r=null,o=null,l=[],a=t.shift(),u++,!a)break}else{if((!b[d.nodeName]||y[d.nodeName])&&d.firstChild){d=d.firstChild;continue}if(d.nextSibling){d=d.nextSibling;continue}}for(;;){if(d.nextSibling){d=d.nextSibling;break}if(d.parentNode===e)break e;d=d.parentNode}}}function i(e){function t(t,n){var r=T[n];r.stencil||(r.stencil=e(r));var o=r.stencil.cloneNode(!1);return o.setAttribute("data-mce-index",n),t&&o.appendChild(M.doc.createTextNode(t)),o}return function(e){var n,r,o,i=e.startNode,c=e.endNode,a=e.matchIndex,l=M.doc;if(i===c){var s=i;o=s.parentNode,e.startNodeIndex>0&&(n=l.createTextNode(s.data.substring(0,e.startNodeIndex)),o.insertBefore(n,s));var d=t(e.match,a);return o.insertBefore(d,s),e.endNodeIndex<s.length&&(r=l.createTextNode(s.data.substring(e.endNodeIndex)),o.insertBefore(r,s)),s.parentNode.removeChild(s),d}n=l.createTextNode(i.data.substring(0,e.startNodeIndex)),r=l.createTextNode(c.data.substring(e.endNodeIndex));for(var u=t(i.data.substring(e.startNodeIndex),a),f=[],h=0,g=e.innerNodes.length;g>h;++h){var m=e.innerNodes[h],p=t(m.data,a);m.parentNode.replaceChild(p,m),f.push(p)}var v=t(c.data.substring(0,e.endNodeIndex),a);return o=i.parentNode,o.insertBefore(n,i),o.insertBefore(u,i),o.removeChild(i),o=c.parentNode,o.insertBefore(v,c),o.insertBefore(r,c),o.removeChild(c),v}}function c(e){var t=e.parentNode;t.insertBefore(e.firstChild,e),e.parentNode.removeChild(e)}function a(t){var n=e.getElementsByTagName("*"),r=[];t="number"==typeof t?""+t:null;for(var o=0;o<n.length;o++){var i=n[o],c=i.getAttribute("data-mce-index");null!==c&&c.length&&(c===t||null===t)&&r.push(i)}return r}function l(e){for(var t=T.length;t--;)if(T[t]===e)return t;return-1}function s(e){var t=[];return d(function(n,r){e(n,r)&&t.push(n)}),T=t,this}function d(e){for(var t=0,n=T.length;n>t&&e(T[t],t)!==!1;t++);return this}function u(t){return T.length&&o(e,T,i(t)),this}function f(e,t){if(w&&e.global)for(;k=e.exec(w);)T.push(n(k,t));return this}function h(e){var t,n=a(e?l(e):null);for(t=n.length;t--;)c(n[t]);return this}function g(e){return T[e.getAttribute("data-mce-index")]}function m(e){return a(l(e))[0]}function p(e,t,n){return T.push({start:e,end:e+t,text:w.substr(e,t),data:n}),this}function v(e){var n=a(l(e)),r=t.dom.createRng();return r.setStartBefore(n[0]),r.setEndAfter(n[n.length-1]),r}function x(e,n){var r=v(e);return r.deleteContents(),n.length>0&&r.insertNode(t.dom.doc.createTextNode(n)),r}function N(){return T.splice(0,T.length),h(),this}var k,w,y,b,S,T=[],M=t.dom;return y=t.schema.getBlockElements(),b=t.schema.getWhiteSpaceElements(),S=t.schema.getShortEndedElements(),w=r(e),{text:w,matches:T,each:d,filter:s,reset:N,matchFromElement:g,elementFromMatch:m,find:f,add:p,wrap:u,unwrap:h,replace:x,rangeFromMatch:v,indexOf:l}}}),r("tinymce/spellcheckerplugin/Plugin",["tinymce/spellcheckerplugin/DomTextMatcher","tinymce/PluginManager","tinymce/util/Tools","tinymce/ui/Menu","tinymce/dom/DOMUtils","tinymce/util/XHR","tinymce/util/URI","tinymce/util/JSON"],function(e,t,n,r,o,i,c,a){t.add("spellchecker",function(t,l){function s(){return I.textMatcher||(I.textMatcher=new e(t.getBody(),t)),I.textMatcher}function d(e,t){var r=[];return n.each(t,function(e){r.push({selectable:!0,text:e.name,data:e.value})}),r}function u(e){for(var t in e)return!1;return!0}function f(e,i){var c=[],a=T[e];n.each(a,function(e){c.push({text:e,onclick:function(){t.insertContent(t.dom.encode(e)),t.dom.remove(i),v()}})}),c.push({text:"-"}),C&&c.push({text:"Add to Dictionary",onclick:function(){x(e,i)}}),c.push.apply(c,[{text:"Ignore",onclick:function(){N(e,i)}},{text:"Ignore all",onclick:function(){N(e,i,!0)}},{text:"Finish",onclick:k}]),B=new r({items:c,context:"contextmenu",onautohide:function(e){-1!=e.target.className.indexOf("spellchecker")&&e.preventDefault()},onhide:function(){B.remove(),B=null}}),B.renderTo(document.body);var l=o.DOM.getPos(t.getContentAreaContainer()),s=t.dom.getPos(i[0]),d=t.dom.getRoot();"BODY"==d.nodeName?(s.x-=d.ownerDocument.documentElement.scrollLeft||d.scrollLeft,s.y-=d.ownerDocument.documentElement.scrollTop||d.scrollTop):(s.x-=d.scrollLeft,s.y-=d.scrollTop),l.x+=s.x,l.y+=s.y,B.moveTo(l.x,l.y+i[0].offsetHeight)}function h(){return t.getParam("spellchecker_wordchar_pattern")||new RegExp('[^\\s!"#$%&()*+,-./:;<=>?@[\\]^_{|}`§©«®±¶·¸»¼½¾¿×÷¤”“„]+',"g")}function g(e,t,r,o){var s={method:e},d="";"spellcheck"==e&&(s.text=t,s.lang=D.spellchecker_language),"addToDictionary"==e&&(s.word=t),n.each(s,function(e,t){d&&(d+="&"),d+=t+"="+encodeURIComponent(e)}),i.send({url:new c(l).toAbsolute(D.spellchecker_rpc_url),type:"post",content_type:"application/x-www-form-urlencoded",data:d,success:function(e){e=a.parse(e),e?e.error?o(e.error):r(e):o("Sever response wasn't proper JSON.")},error:function(e,t){o("Spellchecker request error: "+t.status)}})}function m(e,t,n,r){var o=D.spellchecker_callback||g;o.call(I,e,t,n,r)}function p(){function e(e){var n;return e.words?(C=!!e.dictionary,n=e.words):n=e,t.setProgressState(!1),u(n)?(t.windowManager.alert("No misspellings found"),void(M=!1)):(T=n,s().find(h()).filter(function(e){return!!n[e.text]}).wrap(function(e){return t.dom.create("span",{"class":"mce-spellchecker-word","data-mce-bogus":1,"data-mce-word":e.text})}),void t.fire("SpellcheckStart"))}function n(e){t.windowManager.alert(e),t.setProgressState(!1),k()}return M?void k():(k(),M=!0,t.setProgressState(!0),m("spellcheck",s().text,e,n),void t.focus())}function v(){t.dom.select("span.mce-spellchecker-word").length||k()}function x(e,n){t.setProgressState(!0),m("addToDictionary",e,function(){t.setProgressState(!1),t.dom.remove(n,!0),v()},function(e){t.windowManager.alert(e),t.setProgressState(!1)})}function N(e,r,o){t.selection.collapse(),o?n.each(t.dom.select("span.mce-spellchecker-word"),function(n){n.getAttribute("data-mce-word")==e&&t.dom.remove(n,!0)}):t.dom.remove(r,!0),v()}function k(){s().reset(),I.textMatcher=null,M&&(M=!1,t.fire("SpellcheckEnd"))}function w(e){var t=e.getAttribute("data-mce-index");return"number"==typeof t?""+t:t}function y(e){var r,o=[];if(r=n.toArray(t.getBody().getElementsByTagName("span")),r.length)for(var i=0;i<r.length;i++){var c=w(r[i]);null!==c&&c.length&&c===e.toString()&&o.push(r[i])}return o}function b(e){var t=D.spellchecker_language;e.control.items().each(function(e){e.active(e.settings.data===t)})}var S,T,M,B,C,I=this,D=t.settings,E=D.spellchecker_languages||"English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr_FR,German=de,Italian=it,Polish=pl,Portuguese=pt_BR,Spanish=es,Swedish=sv";S=d("Language",n.map(E.split(","),function(e){return e=e.split("="),{name:e[0],value:e[1]}})),t.on("click",function(e){var n=e.target;if("mce-spellchecker-word"==n.className){e.preventDefault();var r=y(w(n));if(r.length>0){var o=t.dom.createRng();o.setStartBefore(r[0]),o.setEndAfter(r[r.length-1]),t.selection.setRng(o),f(n.getAttribute("data-mce-word"),r)}}}),t.addMenuItem("spellchecker",{text:"Spellcheck",context:"tools",onclick:p,selectable:!0,onPostRender:function(){var e=this;t.on("SpellcheckStart SpellcheckEnd",function(){e.active(M)})}});var P={tooltip:"Spellcheck",onclick:p,onPostRender:function(){var e=this;t.on("SpellcheckStart SpellcheckEnd",function(){e.active(M)})}};S.length>1&&(P.type="splitbutton",P.menu=S,P.onshow=b,P.onselect=function(e){D.spellchecker_language=e.control.settings.data}),t.addButton("spellchecker",P),t.addCommand("mceSpellCheck",p),t.on("remove",function(){B&&(B.remove(),B=null)}),t.on("change",v),this.getTextMatcher=s,this.getWordCharPattern=h,this.getLanguage=function(){return D.spellchecker_language},D.spellchecker_language=D.spellchecker_language||D.language||"en"})}),i(["tinymce/spellcheckerplugin/DomTextMatcher"])}(this);
Zerion Mini Shell 1.0