Orbit/public/assets/tinymce/jquery-tinymce-9c38b8686e11...

1 line
3.3 KiB
JavaScript

(function(a){function f(){function c(a){a==="remove"&&this.each(function(a,b){var c=f(b);c&&c.remove()}),this.find("span.mceEditor,div.mceEditor").each(function(a,b){var c=tinyMCE.get(b.id.replace(/_parent$/,""));c&&c.remove()})}function d(a){var d=this,e;if(a!==b)c.call(d),d.each(function(b,c){var d;(d=tinyMCE.get(c.id))&&d.setContent(a)});else if(d.length>0)if(e=tinyMCE.get(d[0].id))return e.getContent()}function f(a){var b=null;return a&&a.id&&e.tinymce&&(b=tinyMCE.get(a.id)),b}function g(a){return!!(a&&a.length&&e.tinymce&&a.is(":tinymce"))}var h={};a.each(["text","html","val"],function(c,e){var i=h[e]=a.fn[e],l=e==="text";a.fn[e]=function(c){var e=this;if(!g(e))return i.apply(e,arguments);if(c!==b)return d.call(e.filter(":tinymce"),c),i.apply(e.not(":tinymce"),arguments),e;var h="",j=arguments;return(l?e:e.eq(0)).each(function(b,c){var d=f(c);h+=d?l?d.getContent().replace(/<(?:"[^"]*"|'[^']*'|[^'">])*>/g,""):d.getContent():i.apply(a(c),j)}),h}}),a.each(["append","prepend"],function(c,d){var e=h[d]=a.fn[d],i=d==="prepend";a.fn[d]=function(a){var c=this;if(!g(c))return e.apply(c,arguments);if(a!==b)return c.filter(":tinymce").each(function(b,c){var d=f(c);d&&d.setContent(i?a+d.getContent():d.getContent()+a)}),e.apply(c.not(":tinymce"),arguments),c}}),a.each(["remove","replaceWith","replaceAll","empty"],function(b,d){var e=h[d]=a.fn[d];a.fn[d]=function(){return c.call(this,d),e.apply(this,arguments)}}),h.attr=a.fn.attr,a.fn.attr=function(c,e,i){var l=this;if(!c||c!=="value"||!g(l))return h.attr.call(l,c,e,i);if(e!==b)return d.call(l.filter(":tinymce"),e),h.attr.call(l.not(":tinymce"),c,e,i),l;var m=l[0],n=f(m);return n?n.getContent():h.attr.call(a(m),c,e,i)}}var b,c,d=[],e=window;a.fn.tinymce=function(b){function o(){var c=[],d=0;f&&(f(),f=null),g.each(function(a,e){var f,h=e.id,i=b.oninit;h||(e.id=h=tinymce.DOM.uniqueId()),f=new tinymce.Editor(h,b),c.push(f),f.onInit.add(function(){var a,b=i;g.css("visibility",""),i&&++d==c.length&&(tinymce.is(b,"string")&&(a=b.indexOf(".")===-1?null:tinymce.resolve(b.replace(/\.\w+$/,"")),b=tinymce.resolve(b)),b.apply(a||tinymce,c))})}),a.each(c,function(a,b){b.render()})}var g=this,h,i,j,k,l,m="",n="";return g.length?b?(g.css("visibility","hidden"),!e.tinymce&&!c&&(h=b.script_url)?(c=1,j=h.substring(0,h.lastIndexOf("/")),/_(src|dev)\.js/g.test(h)&&(n="_src"),k=h.lastIndexOf("?"),k!=-1&&(m=h.substring(k+1)),e.tinyMCEPreInit=e.tinyMCEPreInit||{base:j,suffix:n,query:m},h.indexOf("gzip")!=-1&&(l=b.language||"en",h=h+(/\?/.test(h)?"&":"?")+"js=true&core=true&suffix="+escape(n)+"&themes="+escape(b.theme)+"&plugins="+escape(b.plugins)+"&languages="+l,e.tinyMCE_GZ||(tinyMCE_GZ={start:function(){function c(a){tinymce.ScriptLoader.markDone(tinyMCE.baseURI.toAbsolute(a))}tinymce.suffix=n,c("langs/"+l+".js"),c("themes/"+b.theme+"/editor_template"+n+".js"),c("themes/"+b.theme+"/langs/"+l+".js"),a.each(b.plugins.split(","),function(a,b){b&&(c("plugins/"+b+"/editor_plugin"+n+".js"),c("plugins/"+b+"/langs/"+l+".js"))})},end:function(){}})),a.ajax({type:"GET",url:h,dataType:"script",cache:!0,success:function(){tinymce.dom.Event.domLoaded=1,c=2,b.script_loaded&&b.script_loaded(),o(),a.each(d,function(a,b){b()})}})):c===1?d.push(o):o(),g):tinyMCE.get(g[0].id):g},a.extend(a.expr[":"],{tinymce:function(a){return!!a.id&&!!tinyMCE.get(a.id)}})})(jQuery);