ZwiiCMS/core/vendor/tinymce/plugins/media/plugin.min.js

1 line
14 KiB
JavaScript
Raw Normal View History

2018-04-02 08:29:19 +02:00
!function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),t=tinymce.util.Tools.resolve("tinymce.Env"),r=tinymce.util.Tools.resolve("tinymce.util.Tools"),i=function(e){return e.getParam("media_scripts")},a=function(e){return e.getParam("audio_template_callback")},o=function(e){return e.getParam("video_template_callback")},n=function(e){return e.getParam("media_live_embeds",!0)},c=function(e){return e.getParam("media_filter_html",!0)},s=function(e){return e.getParam("media_url_resolver")},u=function(e){return e.getParam("media_alt_source",!0)},l=function(e){return e.getParam("media_poster",!0)},m=function(e){return e.getParam("media_dimensions",!0)},d=tinymce.util.Tools.resolve("tinymce.html.SaxParser"),h=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),p=function(e,t){if(e)for(var r=0;r<e.length;r++)if(-1!==t.indexOf(e[r].filter))return e[r]},f=function(e){return function(t){return t?t.style[e].replace(/px$/,""):""}},g=function(e){return function(t,r){var i;t&&(t.style[e]=/^[0-9.]+$/.test(i=r)?i+"px":i)}},v={getMaxWidth:f("maxWidth"),getMaxHeight:f("maxHeight"),setMaxWidth:g("maxWidth"),setMaxHeight:g("maxHeight")},w=h.DOM,b=function(e){return w.getAttrib(e,"data-ephox-embed-iri")},y=function(e,t){return s=t,u=w.createFragment(s),""!==b(u.firstChild)?(n=t,c=w.createFragment(n).firstChild,{type:"ephox-embed-iri",source1:b(c),source2:"",poster:"",width:v.getMaxWidth(c),height:v.getMaxHeight(c)}):(i=e,a=t,o={},d({validate:!1,allow_conditional_comments:!0,special:"script,noscript",start:function(e,t){if(o.source1||"param"!==e||(o.source1=t.map.movie),"iframe"!==e&&"object"!==e&&"embed"!==e&&"video"!==e&&"audio"!==e||(o.type||(o.type=e),o=r.extend(t.map,o)),"script"===e){var a=p(i,t.map.src);if(!a)return;o={type:"script",source1:t.map.src,width:a.width,height:a.height}}"source"===e&&(o.source1?o.source2||(o.source2=t.map.src):o.source1=t.map.src),"img"!==e||o.poster||(o.poster=t.map.src)}}).parse(a),o.source1=o.source1||o.src||o.data,o.source2=o.source2||"",o.poster=o.poster||"",o);var i,a,o,n,c,s,u},x=tinymce.util.Tools.resolve("tinymce.util.Promise"),j=function(e){var t={mp3:"audio/mpeg",wav:"audio/wav",mp4:"video/mp4",webm:"video/webm",ogg:"video/ogg",swf:"application/x-shockwave-flash"}[e.toLowerCase().split(".").pop()];return t||""},M=tinymce.util.Tools.resolve("tinymce.html.Writer"),_=tinymce.util.Tools.resolve("tinymce.html.Schema"),C=h.DOM,S=function(e,t){var r,i,a,o;for(r in t)if(a=""+t[r],e.map[r])for(i=e.length;i--;)(o=e[i]).name===r&&(a?(e.map[r]=a,o.value=a):(delete e.map[r],e.splice(i,1)));else a&&(e.push({name:r,value:a}),e.map[r]=a)},k=function(e,t){var r,i,a=C.createFragment(e).firstChild;return v.setMaxWidth(a,t.width),v.setMaxHeight(a,t.height),r=a.outerHTML,i=M(),d(i).parse(r),i.getContent()},A=function(e,t,r){return u=e,l=C.createFragment(u),""!==C.getAttrib(l.firstChild,"data-ephox-embed-iri")?k(e,t):(i=e,a=t,o=r,c=M(),s=0,d({validate:!1,allow_conditional_comments:!0,special:"script,noscript",comment:function(e){c.comment(e)},cdata:function(e){c.cdata(e)},text:function(e,t){c.text(e,t)},start:function(e,t,r){switch(e){case"video":case"object":case"embed":case"img":case"iframe":a.height!==undefined&&a.width!==undefined&&S(t,{width:a.width,height:a.height})}if(o)switch(e){case"video":S(t,{poster:a.poster,src:""}),a.source2&&S(t,{src:""});break;case"iframe":S(t,{src:a.source1});break;case"source":if(++s<=2&&(S(t,{src:a["source"+s],type:a["source"+s+"mime"]}),!a["source"+s]))return;break;case"img":if(!a.poster)return;n=!0}c.start(e,t,r)},end:function(e){if("video"===e&&o)for(var t=1;t<=2;t++)if(a["source"+t]){var r=[];r.map={},s<t&&(S(r,{src:a["source"+t],type:a["source"+t+"mime"]}),c.start("source",r,!0))}if(a.poster&&"object"===e&&o&&!n){var i=[];i.map={},S(i,{src:a.poster,width:a.width,height:a.height}),c.start("img",i,!0)}c.end(e)}},_({})).parse(i),c.getContent());var i,a,o,n,c,s,u,l},F=[{regex:/youtu\.be\/([\w\-.]+)/,type:"iframe",w:560,h:314,url:"//www.youtube.com/embed/$1",allowFullscreen:!0},{regex:/youtube\.com(.+)v=([^&]+)/,type:"iframe",w:560,h:314,url:"//www.youtube.com