2014-03-14 15:36:14 +01:00
|
|
|
!function(a,b){var c={};wp.media.string={props:function(a,c){var d,e,f,g,h,i=wp.media.view.settings.defaultProps;return h=function(a){return"image"!==a.type||a.alt||(a.alt=a.caption||a.title||"",a.alt=a.alt.replace(/<\/?[^>]+>/g,""),a.alt=a.alt.replace(/[\r\n]+/g," ")),a},a=a?b.clone(a):{},c&&c.type&&(a.type=c.type),"image"===a.type&&(a=b.defaults(a||{},{align:i.align||getUserSetting("align","none"),size:i.size||getUserSetting("imgsize","medium"),url:"",classes:[]})),c?(a.title=a.title||c.title,d=a.link||i.link||getUserSetting("urlbutton","file"),"file"===d||"embed"===d?e=c.url:"post"===d?e=c.link:"custom"===d&&(e=a.linkUrl),a.linkUrl=e||"","image"===c.type?(a.classes.push("wp-image-"+c.id),g=c.sizes,f=g&&g[a.size]?g[a.size]:c,b.extend(a,b.pick(c,"align","caption","alt"),{width:f.width,height:f.height,src:f.url,captionId:"attachment_"+c.id})):"video"===c.type||"audio"===c.type?b.extend(a,b.pick(c,"title","type","icon","mime")):(a.title=a.title||c.filename,a.rel=a.rel||"attachment wp-att-"+c.id),h(a)):h(a)},link:function(a,b){var c;return a=wp.media.string.props(a,b),c={tag:"a",content:a.title,attrs:{href:a.linkUrl}},a.rel&&(c.attrs.rel=a.rel),wp.html.string(c)},audio:function(a,b){return wp.media.string._audioVideo("audio",a,b)},video:function(a,b){return wp.media.string._audioVideo("video",a,b)},_audioVideo:function(a,c,d){var e,f,g;return c=wp.media.string.props(c,d),"embed"!==c.link?wp.media.string.link(c):(e={},"video"===a&&(d.width&&(e.width=d.width),d.height&&(e.height=d.height)),g=d.filename.split(".").pop(),b.contains(wp.media.view.settings.embedExts,g)?(e[g]=d.url,f=wp.shortcode.string({tag:a,attrs:e})):wp.media.string.link(c))},image:function(a,c){var d,e,f,g,h={};return a=wp.media.string.props(a,c),e=a.classes||[],h.src=b.isUndefined(c)?a.url:c.url,b.extend(h,b.pick(a,"width","height","alt")),a.align&&!a.caption&&e.push("align"+a.align),a.size&&e.push("size-"+a.size),h["class"]=b.compact(e).join(" "),d={tag:"img",attrs:h,single:!0},a.linkUrl&&(d={tag:"a",attrs:{href:a.linkUrl},content:d}),g=wp.html.string(d),a.caption&&(f={},h.width&&(f.width=h.width),a.captionId&&(f.id=a.captionId),a.align&&(f.align="align"+a.align),g=wp.shortcode.string({tag:"caption",attrs:f,content:g+" "+a.caption})),g}},wp.media.mixin={coerce:function(a,c){return b.isUndefined(a[c])&&!b.isUndefined(this.defaults[c])?a[c]=this.defaults[c]:"true"===a[c]?a[c]=!0:"false"===a[c]&&(a[c]=!1),a[c]},pauseAllPlayers:function(){var a;if(window.mejs&&window.mejs.players)for(a in window.mejs.players)window.mejs.players[a].pause()},isCompatible:function(a){if(!a.find("source").length)return!1;var b,c,d,e,f=window.navigator.userAgent.toLowerCase(),g=null!==f.match(/MSIE/gi),h=null!==window.navigator.userAgent.match(/OPR/),i=null!==f.match(/MSIE [6-8]/gi),j=f.match(/safari/gi)&&null!==f.match(/chrome/gi),k=null!==f.match(/firefox/gi),l=null!==f.match(/safari/gi)&&null===f.match(/chrome/gi);return i||g?!1:h?(d=!1,a.find("source").each(function(a,b){(null!==b.type.match(/video\/(ogv|webm)/gi)||null!==b.type.match(/audio\/(ogg|wav)/gi))&&(d=!0)}),d):j?(c=!1,a.find("source").each(function(a,b){(null!==b.type.match(/video\/(mp4|m4v|mpeg|webm|ogg)/gi)||null!==b.type.match(/audio\/(ogg|mpeg|x-ms-wma)/gi))&&(c=!0)}),c):k?(b=!1,a.find("source").each(function(a,c){(null!==c.type.match(/video\/(ogg|webm)/gi)||null!==c.type.match(/audio\/(ogg|mpeg)/gi)&&-1===c.src.indexOf(".m4a"))&&(b=!0)}),b):l?(e=!1,a.find("source").each(function(a,b){(null!==b.type.match(/video\/(mp4|m4v|mpeg|x-ms-wmv|quicktime)/gi)||null!==b.type.match(/audio\/(mpeg|wav)/gi))&&(e=!0)}),e):!1},removePlayer:function(){var a,b,c=this.player;for(a in c.options.features)if(b=c.options.features[a],c["clean"+b])try{c["clean"+b](c)}catch(d){}c.isDynamic||c.$node.remove(),"native"!==c.media.pluginType&&c.media.remove(),delete window.mejs.players[c.id],c.container.remove(),c.globalUnbind(),delete c.node.player},unsetPlayer:function(){this.player&&(wp.media.mixin.pauseAllPlayers(),wp.media.mixin.removePlayer.apply(this),this.player=!1)}},wp.media.collection=function(a){var c={};return b.extend(a,{coerce:w
|