1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-20 21:59:42 +02:00
documize/gui/public/tinymce/plugins/media/plugin.min.js

1 line
15 KiB
JavaScript
Raw Normal View History

2018-01-19 11:36:38 +00: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")},n=function(e){return e.getParam("audio_template_callback")},o=function(e){return e.getParam("video_template_callback")},a=function(e){return e.getParam("media_live_embeds",!0)},c=function(e){return e.getParam("media_filter_html",!0)},u=function(e){return e.getParam("media_url_resolver")},s=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"),f=function(e,t){if(e)for(var r=0;r<e.length;r++)if(-1!==t.indexOf(e[r].filter))return e[r]},p=function(e){return function(t){return t?function(e){return e.replace(/px$/,"")}(t.style[e]):""}},g=function(e){return function(t,r){t&&(t.style[e]=function(e){return/^[0-9.]+$/.test(e)?e+"px":e}(r))}},v={getMaxWidth:p("maxWidth"),getMaxHeight:p("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 function(e){var t=w.createFragment(e);return""!==b(t.firstChild)}(t)?function(e){var t=w.createFragment(e).firstChild;return{type:"ephox-embed-iri",source1:b(t),source2:"",poster:"",width:v.getMaxWidth(t),height:v.getMaxHeight(t)}}(t):function(e,t){var i={};return new d({validate:!1,allow_conditional_comments:!0,special:"script,noscript",start:function(t,n){if(i.source1||"param"!==t||(i.source1=n.map.movie),"iframe"!==t&&"object"!==t&&"embed"!==t&&"video"!==t&&"audio"!==t||(i.type||(i.type=t),i=r.extend(n.map,i)),"script"===t){var o=f(e,n.map.src);if(!o)return;i={type:"script",source1:n.map.src,width:o.width,height:o.height}}"source"===t&&(i.source1?i.source2||(i.source2=n.map.src):i.source1=n.map.src),"img"!==t||i.poster||(i.poster=n.map.src)}}).parse(t),i.source1=i.source1||i.src||i.data,i.source2=i.source2||"",i.poster=i.poster||"",i}(e,t)},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,n,o;for(r in t)if(n=""+t[r],e.map[r])for(i=e.length;i--;)(o=e[i]).name===r&&(n?(e.map[r]=n,o.value=n):(delete e.map[r],e.splice(i,1)));else n&&(e.push({name:r,value:n}),e.map[r]=n)},k=function(e,t){var r=C.createFragment(e).firstChild;return v.setMaxWidth(r,t.width),v.setMaxHeight(r,t.height),function(e){var t=M();return new d(t).parse(e),t.getContent()}(r.outerHTML)},A=function(e,t,r){return function(e){var t=C.createFragment(e);return""!==C.getAttrib(t.firstChild,"data-ephox-embed-iri")}(e)?k(e,t):function(e,t,r){var i,n=M(),o=0;return new d({validate:!1,allow_conditional_comments:!0,special:"script,noscript",comment:function(e){n.comment(e)},cdata:function(e){n.cdata(e)},text:function(e,t){n.text(e,t)},start:function(e,a,c){switch(e){case"video":case"object":case"embed":case"img":case"iframe":t.height!==undefined&&t.width!==undefined&&S(a,{width:t.width,height:t.height})}if(r)switch(e){case"video":S(a,{poster:t.poster,src:""}),t.source2&&S(a,{src:""});break;case"iframe":S(a,{src:t.source1});break;case"source":if(++o<=2&&(S(a,{src:t["source"+o],type:t["source"+o+"mime"]}),!t["source"+o]))return;break;case"img":if(!t.poster)return;i=!0}n.start(e,a,c)},end:function(e){if("video"===e&&r)for(var a=1;a<=2;a++)if(t["source"+a]){var c=[];c.map={},o<a&&(S(c,{src:t["source"+a],type:t["source"+a+"mime"]}),n.start("source",c,!0))}if(t.poster&&"object"===e&&r&&!i){var u=[];u.map={},S(u,{src:t.poster,width:t.width,height:t.height}),n.start("img",u,!0)}n.end(e)}},_({})).parse(e),n.getContent()}(e,t,r)},F=[{regex:/youtu\.be\/([\w\-.]+)/,type:"iframe",w:560,h:31