AIParking_Intops_Server/web/tinymce/plugins/mathjax/plugin.min_.js
2020-02-01 16:47:12 +07:00

1 line
14 KiB
JavaScript

!function(){var a={},b=function(b){for(var c=a[b],e=c.deps,f=c.defn,g=e.length,h=new Array(g),i=0;i<g;++i)h[i]=d(e[i]);var j=f.apply(null,h);if(void 0===j)throw"module ["+b+"] returned undefined";c.instance=j},c=function(b,c,d){if("string"!=typeof b)throw"module id must be a string";if(void 0===c)throw"no dependencies for "+b;if(void 0===d)throw"no definition function for "+b;a[b]={deps:c,defn:d,instance:void 0}},d=function(c){var d=a[c];if(void 0===d)throw"module ["+c+"] was undefined";return void 0===d.instance&&b(c),d.instance},e=function(a,b){for(var c=a.length,e=new Array(c),f=0;f<c;++f)e[f]=d(a[f]);b.apply(null,e)},f={};f.bolt={module:{api:{define:c,require:e,demand:d}}};var g=c,h=function(a,b){g(a,[],function(){return b})};h("7",tinymce.util.Tools.resolve),g("1",["7"],function(a){return a("tinymce.PluginManager")}),g("d",["7"],function(a){return a("tinymce.Env")}),g("h",["7"],function(a){return a("tinymce.util.Tools")}),g("a",[],function(){var a=function(a){return a.getParam("media_scripts")},b=function(a){return a.getParam("media_live_embeds",!0)},c=function(a){return a.getParam("media_filter_html",!0)},d=function(a){return a.getParam("media_url_resolver")},e=function(a){return a.getParam("media_alt_source",!0)},f=function(a){return a.getParam("media_poster",!0)},g=function(a){return a.getParam("media_dimensions",!0)},h=function(){return"//thuvienhoclieu.vn/js/mathjax/2.7.2/MathJax.js?config=TeX-AMS_CHTML"},i=function(){var a={showMathMenu:!1,messageStyle:"none"};return"MathJax.Hub.Config("+JSON.stringify(a)+");"};return{getScripts:a,hasLiveEmbeds:b,shouldFilterHtml:c,getUrlResolver:d,hasAltSource:e,hasPoster:f,hasDimensions:g,getMathJaxLib:h,getMathJaxConfig:i}}),g("l",["7"],function(a){return a("tinymce.html.SaxParser")}),g("m",["7"],function(a){return a("tinymce.html.Schema")}),g("g",["7"],function(a){return a("tinymce.dom.DOMUtils")}),g("o",[],function(){var a=function(a){return a.replace(/px$/,"")},b=function(a){return/^[0-9.]+$/.test(a)?a+"px":a},c=function(b){return function(c){return c?a(c.style[b]):""}},d=function(a){return function(c,d){c&&(c.style[a]=b(d))}};return{getMaxWidth:c("maxWidth"),getMaxHeight:c("maxHeight"),setMaxWidth:d("maxWidth"),setMaxHeight:d("maxHeight")}}),g("i",["h","l","m","g","o"],function(a,b,c,d,e){var f=function(c,d){var e={};return new b({validate:!1,allow_conditional_comments:!0,special:"script,noscript",start:function(b,c){e=a.extend(c.map,e)}}).parse(d),e.type=e.type||"mathjax",e},g=function(a,b){return f(a,b)};return{htmlToData:g}}),g("n",["7"],function(a){return a("tinymce.html.Writer")}),g("j",["n","l","m","g","o"],function(a,b,c,d,e){var f=function(a,b){var c,d,e,f;for(c in b)if(e=""+b[c],a.map[c])for(d=a.length;d--;)f=a[d],f.name===c&&(e?(a.map[c]=e,f.value=e):(delete a.map[c],a.splice(d,1)));else e&&(a.push({name:c,value:e}),a.map[c]=e)},g=function(d,e,g){var h,i=new a,j=0;return new b({validate:!1,allow_conditional_comments:!0,special:"script,noscript",comment:function(a){i.comment(a)},cdata:function(a){i.cdata(a)},text:function(a,b){i.text(a,b)},start:function(a,b,c){switch(a){case"video":case"object":case"embed":case"img":case"iframe":void 0!==e.height&&void 0!==e.width&&f(b,{width:e.width,height:e.height})}if(g)switch(a){case"video":f(b,{poster:e.poster,src:""}),e.source2&&f(b,{src:""});break;case"iframe":f(b,{src:e.source1});break;case"source":if(j++,j<=2&&(f(b,{src:e["source"+j],type:e["source"+j+"mime"]}),!e["source"+j]))return;break;case"img":if(!e.poster)return;h=!0}i.start(a,b,c)},end:function(a){if("video"===a&&g)for(var b=1;b<=2;b++)if(e["source"+b]){var c=[];c.map={},j<b&&(f(c,{src:e["source"+b],type:e["source"+b+"mime"]}),i.start("source",c,!0))}if(e.poster&&"object"===a&&g&&!h){var d=[];d.map={},f(d,{src:e.poster,width:e.width,height:e.height}),i.start("img",d,!0)}i.end(a)}},new c({})).parse(d),i.getContent()},h=function(a,b,c){return g(a,b,c)};return{updateHtml:h}}),g("k",["h","a"],function(a,b){var c=function(c,d,e){var f,g="",h=c.dom.encode;g+='<base href="'+h(c.documentBaseURI.getURI())+'">',a.each(c.contentCSS,function(a){g+='<link type="text/css" rel="stylesheet" href="'+h(c.documentBaseURI.toAbsolute(a))+'">'});var i=c.settings.body_id||"tinymce";g+='<script type="text/x-mathjax-config">'+b.getMathJaxConfig()+"function getTinymce() {if ( typeof window.parent.parent.tinymce == 'object' ) {return window.parent.parent.tinymce;} else {return window.parent.parent.tinymce;}}function update(tex) {var preview = document.getElementById('preview');if(preview){preview.innerHTML = tex;MathJax.Hub.Queue([ 'Typeset', MathJax.Hub, 'preview'],function() {getTinymce().tools.callFunction( "+e+" );});}}</script>",g+='<script type="text/javascript" src="'+b.getMathJaxLib()+'"></script>',i.indexOf("=")!==-1&&(i=c.getParam("body_id","","hash"),i=i[c.id]||i);var j=c.settings.body_class||"";j.indexOf("=")!==-1&&(j=c.getParam("body_class","","hash"),j=j[c.id]||"");var k=c.settings.directionality?' dir="'+c.settings.directionality+'"':"";return f="<!DOCTYPE html><html><head>"+g+'</head><body id="'+h(i)+'" class="mce-content-body '+h(j)+'"'+h(k)+' style="text-align:center"><div id="preview">'+d+"</div></body></html>"},d=function(a,b,d,e,f){e=e?"\\("+e+"\\)":"";var g=c(a,e,f);if(d)b.src="data:text/html;charset=utf-8,"+encodeURIComponent(g);else{var h=b.contentWindow.document;h.open(),h.write(g),h.close()}return{setLatex:function(a){b.contentWindow.update("\\("+a+"\\)")}}};return{injectIframeContent:d}}),h("e",window),h("f",tinymce),g("8",["d","h","a","i","j","k","e","f"],function(a,b,c,d,e,f,g,h){var i=a.ie&&a.ie<=8?"onChange":"onInput";g.tinymce.fn_map=g.tinymce.fn_map||{length:0};var j=g.tinymce.fn_map,k=function(a){if(j[a])return j[a]()},l=function(a){j.length=j.length+1;var b=""+j.length;return j[b]=a,b};g.tinymce.tools=g.tinymce.tools||{},g.tinymce.tools.callFunction=k;var m=function(a,b){var c,d,e=a.dom.select("span[data-mce-math]");for(c=0;c<b.length;c++)for(d=e.length-1;d>=0;d--)b[c]===e[d]&&e.splice(d,1);a.selection.select(e[0])},n=function(a){var b=a.selection.getNode();return b.getAttribute("data-mce-math")?d.htmlToData(c.getScripts(a),a.serializer.serialize(b,{selection:!0})):{}},o=function(a,b){var c=a.dom.select("span[data-mce-math]");a.insertContent('<span data-latex="'+b+'">\\('+b+"\\)</span>"),m(a,c),a.nodeChanged()},p=function(a,b){var c=a.toJSON();c.latex=e.updateHtml(c.latex,c),o(b,c.latex)},q=function(a){var e,g=!1,h=n(a),j=function(){h=b.extend({},d.htmlToData(c.getScripts(a),this.value())),this.parent().parent().fromJSON(h),e&&e.setLatex(this.value())},k={type:"textbox",name:"latex",multiline:!0,minWidth:600,minHeight:80,spellcheck:!1,style:"direction: ltr; text-align: left;",value:h["data-latex"]||""};k[i]=j;var m=a.windowManager.open({title:"Mathjax Preview",data:h,body:[k,{type:"iframe",src:"javascript:''",frameborder:0,minHeight:150}],onSubmit:function(b){p(m,a)},onPostRender:function(b){var c=b.control.getEl("body iframe");g&&c.setAttribute("sandbox","allow-scripts");var d=l(function(){});e=f.injectIframeContent(a,c,g,h["data-latex"]||"",d)}})};return{showDialog:q}}),g("2",["8"],function(a){var b=function(b){var c=function(){a.showDialog(b)};return{showDialog:c}};return{get:b}}),g("3",["8"],function(a){var b=function(b){var c=function(){a.showDialog(b)};b.addCommand("mceMath",c)};return{register:b}}),g("9",["7"],function(a){return a("tinymce.html.Node")}),g("c",["l","m","n","h","a"],function(a,b,c,d,e){var f=function(d,f){if(e.shouldFilterHtml(d)===!1)return f;var g,h=new c;return new a({validate:!1,allow_conditional_comments:!1,special:"script,noscript",comment:function(a){h.comment(a)},cdata:function(a){h.cdata(a)},text:function(a,b){h.text(a,b)},start:function(a,b,c){if(g=!0,"script"!==a&&"noscript"!==a){for(var e=0;e<b.length;e++){if(0===b[e].name.indexOf("on"))return;"style"===b[e].name&&(b[e].value=d.dom.serializeStyle(d.dom.parseStyle(b[e].value),a))}h.start(a,b,c),g=!1}},end:function(a){g||h.end(a)}},new b({})).parse(f),h.getContent()};return{sanitize:f}}),g("b",["9","c"],function(a,b){var c=function(b,c,e){var f,g,h,i=c.name;return f=new a("span",1),f.attr({contentEditable:"false",style:c.attr("style"),"data-mce-math":i,"class":"mce-preview-math mce-object-"+i}),d(b,c,f),g=new a("img",1),g.attr({src:e+"/img/loader.gif","class":"mce-latex-loader"}),h=new a("span",1),h.attr("class","mce-shim"),f.append(g),f.append(h),f},d=function(a,c,d){var e,f,g,h,i;for(g=c.attributes,h=g.length;h--;)e=g[h].name,f=g[h].value,"width"!==e&&"height"!==e&&"style"!==e&&("data"!==e&&"src"!==e||(f=a.convertURL(f,e)),d.attr("data-mce-p-"+e,f));i=c.firstChild&&c.firstChild.value,i&&(d.attr("data-mce-html",escape(b.sanitize(a,i))),d.firstChild=null)},e=function(a,b){return function(d){for(var e,f=d.length;f--;)e=d[f],e.parent&&(e.parent.attr("data-mce-object")||e.parent.attr("data-mce-math")||e.attr("data-latex")&&e.replace(c(a,e,b)))}};return{placeHolderConverter:e}}),g("4",["9","a","b","c","d","e","f"],function(a,b,c,d,e,f,g){var h,i=b.getMathJaxLib(),j=function(){for(var a;;)try{a=f.parent.document.domain;break}catch(b){if(a=a?a.replace(/.+?(?:\.|$)/,""):document.domain,!a)break;document.domain=a}return!!a},k=e.gecko?"javascript:true":e.ie?"javascript:void((function(){"+encodeURIComponent("document.open();("+j+")();document.close();")+"})())":"javascript:void(0)",l=function(a,b){var c="";return a.currentStyle?c=a.currentStyle[b]:f.getComputedStyle&&(c=f.getComputedStyle.getPropertyValue?f.getComputedStyle(a,null).getPropertyValue(b):f.getComputedStyle(a)[b]),c},m=function(a,b){var c;for(c in b)a.style[c]=b[c]},n=function(a,b){for(var c=["color","font-family","font-style","font-weight","font-variant","font-size"],d=0;d<c.length;d++){var e=c[d],f=l(a,e);f&&(b.style[e]=f)}};f.tinymce.fn_map=f.tinymce.fn_map||{length:0};var o=f.tinymce.fn_map,p=function(a){if(o[a])return o[a]()},q=function(a){o.length=o.length+1;var b=""+o.length;return o[b]=a,b};f.tinymce.tools=f.tinymce.tools||{},f.tinymce.tools.callFunction=p;var r=function(a,b,c){c.fire("lockSnapshot");var d=a.contentDocument;m(a,{height:0,width:0});var e=Math.max(d.body.offsetHeight,d.documentElement.offsetHeight),f=Math.max(b.offsetWidth,d.body.scrollWidth);m(a,{height:e+"px",width:f+"px"}),a.setAttribute("data-state",2),c.fire("unlockSnapshot")},s=function(a,c){function d(){o&&o.getElementById&&!o.getElementById("preview")&&(e.ie&&c.removeAttribute("src"),o.open(),o.write('<!DOCTYPE html><html><head><meta charset="utf-8"><script type="text/x-mathjax-config">'+b.getMathJaxConfig()+"function getTinymce() {if ( typeof window.parent.parent.tinymce == 'object' ) {return window.parent.parent.tinymce;} else {return window.parent.parent.tinymce;}}function update() {MathJax.Hub.Queue([ 'Typeset', MathJax.Hub, 'buffer'],function() {getTinymce().tools.callFunction( "+u+" );});}MathJax.Hub.Queue( function() {getTinymce().tools.callFunction("+t+');} );</script><script src="'+i+'"></script></head><body style="padding:0;margin:0;background:transparent;overflow:hidden"><span id="preview"><img src='+h+' alt="loading..."></span><span id="buffer" style="display:none"></span></body></html>'))}function f(){s=!0,k=l,a.fire("lockSnapshot"),g.innerHTML=k,j.innerHTML="<img src="+h+' alt="loading...">',m(c,{height:"16px",width:"16px",display:"inline","vertical-align":"middle"}),a.fire("unlockSnapshot"),c.contentWindow.update(k)}var g,j,k,l,o=c.contentDocument,p=!1,s=!1,t=q(function(){j=o.getElementById("preview"),g=o.getElementById("buffer"),p=!0,l&&f()}),u=q(function(){j=o.getElementById("preview"),g=o.getElementById("buffer"),n(c,j),j.innerHTML=g.innerHTML,e.gecko?setTimeout(function(){r(c,j,a)},100):r(c,j,a),k!==l?f():s=!1});return c.addEventListener?c.addEventListener("load",d,!1):c.attachEvent("onload",d),d(),o.close(),{setValue:function(a){l="\\("+a+"\\)",p&&!s&&f()}}},t=function(b,e){h=e+"/img/loader.gif",b.on("preInit",function(){b.parser.addAttributeFilter("data-latex",c.placeHolderConverter(b,e)),b.serializer.addAttributeFilter("data-mce-math",function(c,e){for(var f,g,h,i,j,k,l,m,n=c.length;n--;)if(f=c[n],f.parent){for(l=f.attr(e),g="math"===l||"latex"===l?new a("div",1):new a(l,1),m=f.attr("class"),m&&m.indexOf("mce-preview-math")!==-1?g.attr({width:f.firstChild.attr("width"),height:f.firstChild.attr("height")}):g.attr({width:f.attr("width"),height:f.attr("height")}),g.attr({style:f.attr("style")}),i=f.attributes,h=i.length;h--;){var o=i[h].name;0===o.indexOf("data-mce-p-")&&g.attr(o.substr(11),i[h].value)}"script"===l&&g.attr("type","text/javascript"),"math"===l||"latex"===l?(j=f.attr("data-mce-latex"),g.attr("data-latex",j),j="$"+j+"$"):j=f.attr("data-mce-html"),j&&(k=new a("#text",3),k.raw=!0,k.value=d.sanitize(b,unescape(j)),g.append(k)),f.replace(g)}})}),b.on("setContent",function(a){b.$("span.mce-preview-math").each(function(a,c){var d=b.$(c),e=d.find("iframe"),f=d.find("img.mce-latex-loader").length>0;if(e.length>0&&d.find("span.mce-object-iframe").length>0&&(d.html('<img class="mce-latex-loader" src="'+h+'" alt="loading..."><span class="mce-shim"></span>'),f=!0),f){var g=b.getDoc().createElement("iframe");b.$.each({style:"border:0;width:16px;height:16px",scrolling:"no",frameborder:0,allowTransparency:!0,src:k,"data-state":1},function(a,b){g.setAttribute(a,b)}),d.find("img.mce-latex-loader").replaceWith(g);var i=s(b,g);i.setValue(d.attr("data-mce-p-data-latex")),0===d.find("span.mce-shim",c).length&&d.append('<span class="mce-shim"></span>')}})})};return{setup:t}}),g("5",["g","h"],function(a,b){var c=a.DOM.uniqueId(),d=function(d,e){var f=b.toArray(d.getElementsByTagName("link")),g=b.grep(f,function(a){return a.id===c});if(0===g.length){var h=a.DOM.create("link",{id:c,rel:"stylesheet",href:e});d.getElementsByTagName("head")[0].appendChild(h)}};return{load:d}}),g("6",[],function(){var a=function(a,b){a.addButton("mathjax",{icon:"mathjax",tooltip:"Insert/edit math",cmd:"mceMath",stateSelector:["span[data-mce-math]"]}),a.addMenuItem("mathjax",{icon:"mathjax",text:"Math",cmd:"mceMath",context:"insert",prependToContext:!0})};return{register:a}}),g("0",["1","2","3","4","5","6"],function(a,b,c,d,e,f){var g=function(a){return function(b){var c=b&&b.msg?"Media embed handler error: "+b.msg:"Media embed handler threw unknown error.";a.notificationManager.open({type:"error",text:c})}};return a.add("mathjax",function(a,h){return a.on("init",function(){setTimeout(function(){try{e.load(a.editorContainer.ownerDocument,h+"/css/mathjax-button.css")}catch(b){g(a)(b)}e.load(a.getDoc(),h+"/css/mathjax.css")},200)}),c.register(a,h),f.register(a,h),d.setup(a,h),b.get(a,h)}),function(){}}),d("0")()}();