forked from ZwiiCMS-Team/ZwiiCMS
1 line
19 KiB
JavaScript
1 line
19 KiB
JavaScript
![]() |
!function(){"use strict";var e=function(t){var a=t,n=function(){return a};return{get:n,set:function(e){a=e},clone:function(){return e(n())}}},t=tinymce.util.Tools.resolve("tinymce.PluginManager"),a=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),n=function(e){return e.settings.codesample_content_css},i=function(e){return e.settings.codesample_languages},r=function(e){return Math.min(a.DOM.getViewPort().w,e.getParam("codesample_dialog_width",800))},s=function(e){return Math.min(a.DOM.getViewPort().w,e.getParam("codesample_dialog_height",650))},o={},l=void 0!==o?o:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{},c=function(){var e=/\blang(?:uage)?-(?!\*)(\w+)\b/i,t=l.Prism={util:{encode:function(e){return e instanceof a?new a(e.type,t.util.encode(e.content),e.alias):"Array"===t.util.type(e)?e.map(t.util.encode):e.replace(/&/g,"&").replace(/</g,"<").replace(/\u00a0/g," ")},type:function(e){return Object.prototype.toString.call(e).match(/\[object (\w+)\]/)[1]},clone:function(e){switch(t.util.type(e)){case"Object":var a={};for(var n in e)e.hasOwnProperty(n)&&(a[n]=t.util.clone(e[n]));return a;case"Array":return e.map&&e.map(function(e){return t.util.clone(e)})}return e}},languages:{extend:function(e,a){var n=t.util.clone(t.languages[e]);for(var i in a)n[i]=a[i];return n},insertBefore:function(e,a,n,i){var r=(i=i||t.languages)[e];if(2===arguments.length){for(var s in n=arguments[1])n.hasOwnProperty(s)&&(r[s]=n[s]);return r}var o={};for(var l in r)if(r.hasOwnProperty(l)){if(l===a)for(var s in n)n.hasOwnProperty(s)&&(o[s]=n[s]);o[l]=r[l]}return t.languages.DFS(t.languages,function(t,a){a===i[e]&&t!==e&&(this[t]=o)}),i[e]=o},DFS:function(e,a,n){for(var i in e)e.hasOwnProperty(i)&&(a.call(e,i,e[i],n||i),"Object"===t.util.type(e[i])?t.languages.DFS(e[i],a):"Array"===t.util.type(e[i])&&t.languages.DFS(e[i],a,i))}},plugins:{},highlightAll:function(e,a){for(var n=document.querySelectorAll('code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'),i=0,r=void 0;r=n[i++];)t.highlightElement(r,!0===e,a)},highlightElement:function(a,n,i){for(var r,s,o=a;o&&!e.test(o.className);)o=o.parentNode;o&&(r=(o.className.match(e)||[,""])[1],s=t.languages[r]),a.className=a.className.replace(e,"").replace(/\s+/g," ")+" language-"+r,o=a.parentNode,/pre/i.test(o.nodeName)&&(o.className=o.className.replace(e,"").replace(/\s+/g," ")+" language-"+r);var c=a.textContent,u={element:a,language:r,grammar:s,code:c};if(c&&s)if(t.hooks.run("before-highlight",u),n&&l.Worker){var g=new Worker(t.filename);g.onmessage=function(e){u.highlightedCode=e.data,t.hooks.run("before-insert",u),u.element.innerHTML=u.highlightedCode,i&&i.call(u.element),t.hooks.run("after-highlight",u),t.hooks.run("complete",u)},g.postMessage(JSON.stringify({language:u.language,code:u.code,immediateClose:!0}))}else u.highlightedCode=t.highlight(u.code,u.grammar,u.language),t.hooks.run("before-insert",u),u.element.innerHTML=u.highlightedCode,i&&i.call(a),t.hooks.run("after-highlight",u),t.hooks.run("complete",u);else t.hooks.run("complete",u)},highlight:function(e,n,i){var r=t.tokenize(e,n);return a.stringify(t.util.encode(r),i)},tokenize:function(e,a,n){var i=t.Token,r=[e],s=a.rest;if(s){for(var o in s)a[o]=s[o];delete a.rest}e:for(var o in a)if(a.hasOwnProperty(o)&&a[o]){var l=a[o];l="Array"===t.util.type(l)?l:[l];for(var c=0;c<l.length;++c){var u=l[c],g=u.inside,d=!!u.lookbehind,p=0,f=u.alias;u=u.pattern||u;for(var h=0;h<r.length;h++){var m=r[h];if(r.length>e.length)break e;if(!(m instanceof i)){u.lastIndex=0;var b=u.exec(m);if(b){d&&(p=b[1].length);var y=b.index-1+p,v=y+(b=b[0].slice(p)).length,k=m.slice(0,y+1),w=m.slice(v+1),x=[h,1];k&&x.push(k);var S=new i(o,g?t.tokenize(b,g):b,f);x.push(S),w&&x.push(w),Array.prototype.splice.apply(r,x)}}}}}return r},hooks:{all:{},add:function(e,a){var n=t.hooks.all;n[e]=n[e]||[],n[e].push(a)},run:function(e,a){var n=t.hooks.all[e];if(n&&n.length)for(var i=0,r=void 0;r=n[i++];)r(a)}}},a=t.Token=function(e,t,a){this.type=e,this.content=t,this.alias=a};if(a.stringify=function
|