diff --git a/wp-includes/js/mce-view.js b/wp-includes/js/mce-view.js index 1e8a1dede7..5caf8016ba 100644 --- a/wp-includes/js/mce-view.js +++ b/wp-includes/js/mce-view.js @@ -451,10 +451,6 @@ window.wp = window.wp || {}; firefox = this.ua.is( 'ff' ), className = '.wp-' + this.shortcode.tag + '-shortcode'; - if ( this.player ) { - this.unsetPlayer(); - } - media = $( node ).find( className ); if ( ! this.isCompatible( media ) ) { @@ -495,12 +491,7 @@ window.wp = window.wp || {}; }, unbind: function() { - var self = this; - this.pauseAllPlayers(); - _.each( this.players, function (player) { - self.removePlayer( player ); - } ); - this.players = []; + this.unsetPlayers(); } }); _.extend( wp.mce.media.View.prototype, wp.media.mixin ); @@ -547,22 +538,10 @@ window.wp = window.wp || {}; template: media.template('editor-playlist'), initialize: function( options ) { + this.players = []; this.data = {}; this.attachments = []; this.shortcode = options.shortcode; - _.bindAll( this, 'setPlayer' ); - $(this).on('ready', this.setNode); - }, - - /** - * Set the element context for the view, and then fetch the playlist's - * associated attachments. - * - * @param {Event} e - * @param {HTMLElement} node - */ - setNode: function(e, node) { - this.node = node; this.fetch(); }, @@ -571,7 +550,7 @@ window.wp = window.wp || {}; */ fetch: function() { this.attachments = wp.media.playlist.attachments( this.shortcode ); - this.attachments.more().done( this.setPlayer ); + this.dfd = this.attachments.more().done( _.bind( this.render, this ) ); }, /** @@ -582,36 +561,31 @@ window.wp = window.wp || {}; * @global WPPlaylistView * @global tinymce.editors */ - setPlayer: function() { - var p, - html = this.getHtml(), - t = this.encodedText, - self = this; - - this.unsetPlayer(); + render: function() { + var html = this.getHtml(), self = this; _.each( tinymce.editors, function( editor ) { var doc; if ( editor.plugins.wpview ) { doc = editor.getDoc(); - $( doc ).find( '[data-wpview-text="' + t + '"]' ).each(function(i, elem) { + $( doc ).find( '[data-wpview-text="' + this.encodedText + '"]' ).each(function (i, elem) { var node = $( elem ); - node.html( html ); - self.node = elem; + + // The is used to mark the end of the wrapper div. Needed when comparing + // the content as string for preventing extra undo levels. + node.html( html ).append( '' ); + + if ( ! self.data.tracks ) { + return; + } + + self.players.push( new WPPlaylistView({ + el: $( elem ).find( '.wp-playlist' ).get(0), + metadata: self.data + }).player ); }); } }, this ); - - if ( ! this.data.tracks ) { - return; - } - - p = new WPPlaylistView({ - el: $( self.node ).find( '.wp-playlist' ).get(0), - metadata: this.data - }); - - this.player = p.player; }, /** @@ -695,6 +669,10 @@ window.wp = window.wp || {}; this.data = options; return this.template( options ); + }, + + unbind: function() { + this.unsetPlayers(); } }); _.extend( wp.mce.media.PlaylistView.prototype, wp.media.mixin ); diff --git a/wp-includes/js/mce-view.min.js b/wp-includes/js/mce-view.min.js index de796a8e69..c3849dd0bb 100644 --- a/wp-includes/js/mce-view.min.js +++ b/wp-includes/js/mce-view.min.js @@ -1 +1 @@ -window.wp=window.wp||{},function(a){var b={},c={},d=wp.media,e=["encodedText"];wp.mce=wp.mce||{},wp.mce.View=function(a){a||(a={}),_.extend(this,_.pick(a,e)),this.initialize.apply(this,arguments)},_.extend(wp.mce.View.prototype,{initialize:function(){},getHtml:function(){},render:function(){var b=this.getHtml();_.each(tinymce.editors,function(c){var d,e=this;c.plugins.wpview&&(d=c.getDoc(),a(d).find('[data-wpview-text="'+this.encodedText+'"]').each(function(c,d){var f=a(d);f.html(b).append(''),a(e).trigger("ready",d)}))},this)},unbind:function(){}}),wp.mce.View.extend=Backbone.View.extend,wp.mce.views={register:function(a,c){b[a]=c},get:function(a){return b[a]},unregister:function(a){delete b[a]},unbind:function(){_.each(c,function(a){a.unbind()})},toViews:function(a){var c,d=[{content:a}];return _.each(b,function(a,b){c=d.slice(),d=[],_.each(c,function(c){var e,f=c.content;if(c.processed)return void d.push(c);for(;f&&(e=a.toView(f));)e.index&&d.push({content:f.substring(0,e.index)}),d.push({content:wp.mce.views.toView(b,e.content,e.options),processed:!0}),f=f.slice(e.index+e.content.length);f&&d.push({content:f})})}),_.pluck(d,"content").join("")},toView:function(a,b,d){var e,f,g=wp.mce.views.get(a),h=window.encodeURIComponent(b);return g?(wp.mce.views.getInstance(h)||(f=d,f.encodedText=h,e=new g.View(f),c[h]=e),wp.html.string({tag:"div",attrs:{"class":"wpview-wrap wpview-type-"+a,"data-wpview-text":h,"data-wpview-type":a,contenteditable:"false"},content:" "})):b},refreshView:function(a,b){var d,e,f,g=window.encodeURIComponent(b);f=wp.mce.views.getInstance(g),f||(e=a.toView(b),d=e.options,d.encodedText=g,f=new a.View(d),c[g]=f),wp.mce.views.render()},getInstance:function(a){return c[a]},render:function(){_.each(c,function(a){a.render()})},edit:function(b){var c=a(b).data("wpview-type"),d=wp.mce.views.get(c);d&&d.edit(b)}},wp.mce.gallery={shortcode:"gallery",toView:function(a){var b=wp.shortcode.next(this.shortcode,a);if(b)return{index:b.index,content:b.content,options:{shortcode:b.shortcode}}},View:wp.mce.View.extend({className:"editor-gallery",template:d.template("editor-gallery"),postID:a("#post_ID").val(),initialize:function(a){this.shortcode=a.shortcode,this.fetch()},fetch:function(){this.attachments=wp.media.gallery.attachments(this.shortcode,this.postID),this.dfd=this.attachments.more().done(_.bind(this.render,this))},getHtml:function(){var a,b=this.shortcode.attrs.named,c=!1;if(!this.dfd||"pending"!==this.dfd.state()||this.attachments.length)return this.attachments.length&&(c=this.attachments.toJSON(),_.each(c,function(a){a.sizes&&(a.sizes.thumbnail?a.thumbnail=a.sizes.thumbnail:a.sizes.full&&(a.thumbnail=a.sizes.full))})),a={attachments:c,columns:b.columns?parseInt(b.columns,10):3},this.template(a)}}),edit:function(b){var c,d,e=wp.media.gallery,f=this;d=window.decodeURIComponent(a(b).attr("data-wpview-text")),c=e.edit(d),c.state("gallery-edit").on("update",function(d){var g=e.shortcode(d).string();a(b).attr("data-wpview-text",window.encodeURIComponent(g)),wp.mce.views.refreshView(f,g),c.detach()})}},wp.mce.views.register("gallery",wp.mce.gallery),wp.mce.media={loaded:!1,toView:function(a){var b=wp.shortcode.next(this.shortcode,a);if(b)return{index:b.index,content:b.content,options:{shortcode:b.shortcode}}},edit:function(b){var c,d,e,f=wp.media[this.shortcode],g=this;wp.media.mixin.pauseAllPlayers(),d=window.decodeURIComponent(a(b).attr("data-wpview-text")),c=f.edit(d),c.on("close",function(){c.detach()}),e=function(d){var e=wp.media[g.shortcode].shortcode(d).string();a(b).attr("data-wpview-text",window.encodeURIComponent(e)),wp.mce.views.refreshView(g,e),c.detach()},_.isArray(g.state)?_.each(g.state,function(a){c.state(a).on("update",e)}):c.state(g.state).on("update",e),c.open()}},wp.mce.media.View=wp.mce.View.extend({initialize:function(b){this.players=[],this.shortcode=b.shortcode,_.bindAll(this,"setPlayer"),a(this).on("ready",this.setPlayer)},setPlayer:function(b,c){if(c){var d,e=this,f=this.ua.is("ff"),g=".wp-"+this.shortcode.tag+"-shortcode";if(this.player&&this.unsetPlayer(),d=a(c).find(g),!this.isCompatible(d))return d.closest(".wpview-wrap").addClass("wont-play"),d.parent().hasClass("wpview-wrap")||d.parent().replaceWith(d),void d.replaceWith("

"+d.find("source").eq(0).prop("src")+"

");d.closest(".wpview-wrap").removeClass("wont-play"),f?d.prop("preload","metadata"):d.prop("preload","none"),d=wp.media.view.MediaDetails.prepareSrc(d.get(0)),setTimeout(function(){wp.mce.media.loaded=!0,e.players.push(new MediaElementPlayer(d,e.mejsSettings))},wp.mce.media.loaded?10:500)}},getHtml:function(){var a=_.defaults(this.shortcode.attrs.named,wp.media[this.shortcode.tag].defaults);return this.template({model:a})},unbind:function(){var a=this;this.pauseAllPlayers(),_.each(this.players,function(b){a.removePlayer(b)}),this.players=[]}}),_.extend(wp.mce.media.View.prototype,wp.media.mixin),wp.mce.video=_.extend({},wp.mce.media,{shortcode:"video",state:"video-details",View:wp.mce.media.View.extend({className:"editor-video",template:d.template("editor-video")})}),wp.mce.views.register("video",wp.mce.video),wp.mce.audio=_.extend({},wp.mce.media,{shortcode:"audio",state:"audio-details",View:wp.mce.media.View.extend({className:"editor-audio",template:d.template("editor-audio")})}),wp.mce.views.register("audio",wp.mce.audio),wp.mce.media.PlaylistView=wp.mce.View.extend({className:"editor-playlist",template:d.template("editor-playlist"),initialize:function(b){this.data={},this.attachments=[],this.shortcode=b.shortcode,_.bindAll(this,"setPlayer"),a(this).on("ready",this.setNode)},setNode:function(a,b){this.node=b,this.fetch()},fetch:function(){this.attachments=wp.media.playlist.attachments(this.shortcode),this.attachments.more().done(this.setPlayer)},setPlayer:function(){var b,c=this.getHtml(),d=this.encodedText,e=this;this.unsetPlayer(),_.each(tinymce.editors,function(b){var f;b.plugins.wpview&&(f=b.getDoc(),a(f).find('[data-wpview-text="'+d+'"]').each(function(b,d){var f=a(d);f.html(c),e.node=d}))},this),this.data.tracks&&(b=new WPPlaylistView({el:a(e.node).find(".wp-playlist").get(0),metadata:this.data}),this.player=b.player)},getHtml:function(){var a,b,c=this.shortcode.attrs.named,e=wp.media.playlist,f=[];if(!this.dfd||"pending"!==this.dfd.state()||this.attachments.length)return _.each(e.defaults,function(a,b){c[b]=e.coerce(c,b)}),a={type:c.type,style:c.style,tracklist:c.tracklist,tracknumbers:c.tracknumbers,images:c.images,artists:c.artists},this.attachments.length?(b=this.attachments.toJSON(),_.each(b,function(b){var e={},g={},h={src:b.url,type:b.mime,title:b.title,caption:b.caption,description:b.description,meta:b.meta};"video"===c.type?(e.width=b.width,e.height=b.height,d.view.settings.contentWidth?(g.width=d.view.settings.contentWidth-22,g.height=Math.ceil(e.height*g.width/e.width),a.width||(a.width=g.width,a.height=g.height)):a.width||(a.width=b.width,a.height=b.height),h.dimensions={original:e,resized:_.isEmpty(g)?e:g}):a.width=400,h.image=b.image,h.thumb=b.thumb,f.push(h)}),a.tracks=f,this.data=a,this.template(a)):this.template(a)}}),_.extend(wp.mce.media.PlaylistView.prototype,wp.media.mixin),wp.mce.playlist=_.extend({},wp.mce.media,{shortcode:"playlist",state:["playlist-edit","video-playlist-edit"],View:wp.mce.media.PlaylistView}),wp.mce.views.register("playlist",wp.mce.playlist)}(jQuery); \ No newline at end of file +window.wp=window.wp||{},function(a){var b={},c={},d=wp.media,e=["encodedText"];wp.mce=wp.mce||{},wp.mce.View=function(a){a||(a={}),_.extend(this,_.pick(a,e)),this.initialize.apply(this,arguments)},_.extend(wp.mce.View.prototype,{initialize:function(){},getHtml:function(){},render:function(){var b=this.getHtml();_.each(tinymce.editors,function(c){var d,e=this;c.plugins.wpview&&(d=c.getDoc(),a(d).find('[data-wpview-text="'+this.encodedText+'"]').each(function(c,d){var f=a(d);f.html(b).append(''),a(e).trigger("ready",d)}))},this)},unbind:function(){}}),wp.mce.View.extend=Backbone.View.extend,wp.mce.views={register:function(a,c){b[a]=c},get:function(a){return b[a]},unregister:function(a){delete b[a]},unbind:function(){_.each(c,function(a){a.unbind()})},toViews:function(a){var c,d=[{content:a}];return _.each(b,function(a,b){c=d.slice(),d=[],_.each(c,function(c){var e,f=c.content;if(c.processed)return void d.push(c);for(;f&&(e=a.toView(f));)e.index&&d.push({content:f.substring(0,e.index)}),d.push({content:wp.mce.views.toView(b,e.content,e.options),processed:!0}),f=f.slice(e.index+e.content.length);f&&d.push({content:f})})}),_.pluck(d,"content").join("")},toView:function(a,b,d){var e,f,g=wp.mce.views.get(a),h=window.encodeURIComponent(b);return g?(wp.mce.views.getInstance(h)||(f=d,f.encodedText=h,e=new g.View(f),c[h]=e),wp.html.string({tag:"div",attrs:{"class":"wpview-wrap wpview-type-"+a,"data-wpview-text":h,"data-wpview-type":a,contenteditable:"false"},content:" "})):b},refreshView:function(a,b){var d,e,f,g=window.encodeURIComponent(b);f=wp.mce.views.getInstance(g),f||(e=a.toView(b),d=e.options,d.encodedText=g,f=new a.View(d),c[g]=f),wp.mce.views.render()},getInstance:function(a){return c[a]},render:function(){_.each(c,function(a){a.render()})},edit:function(b){var c=a(b).data("wpview-type"),d=wp.mce.views.get(c);d&&d.edit(b)}},wp.mce.gallery={shortcode:"gallery",toView:function(a){var b=wp.shortcode.next(this.shortcode,a);if(b)return{index:b.index,content:b.content,options:{shortcode:b.shortcode}}},View:wp.mce.View.extend({className:"editor-gallery",template:d.template("editor-gallery"),postID:a("#post_ID").val(),initialize:function(a){this.shortcode=a.shortcode,this.fetch()},fetch:function(){this.attachments=wp.media.gallery.attachments(this.shortcode,this.postID),this.dfd=this.attachments.more().done(_.bind(this.render,this))},getHtml:function(){var a,b=this.shortcode.attrs.named,c=!1;if(!this.dfd||"pending"!==this.dfd.state()||this.attachments.length)return this.attachments.length&&(c=this.attachments.toJSON(),_.each(c,function(a){a.sizes&&(a.sizes.thumbnail?a.thumbnail=a.sizes.thumbnail:a.sizes.full&&(a.thumbnail=a.sizes.full))})),a={attachments:c,columns:b.columns?parseInt(b.columns,10):3},this.template(a)}}),edit:function(b){var c,d,e=wp.media.gallery,f=this;d=window.decodeURIComponent(a(b).attr("data-wpview-text")),c=e.edit(d),c.state("gallery-edit").on("update",function(d){var g=e.shortcode(d).string();a(b).attr("data-wpview-text",window.encodeURIComponent(g)),wp.mce.views.refreshView(f,g),c.detach()})}},wp.mce.views.register("gallery",wp.mce.gallery),wp.mce.media={loaded:!1,toView:function(a){var b=wp.shortcode.next(this.shortcode,a);if(b)return{index:b.index,content:b.content,options:{shortcode:b.shortcode}}},edit:function(b){var c,d,e,f=wp.media[this.shortcode],g=this;wp.media.mixin.pauseAllPlayers(),d=window.decodeURIComponent(a(b).attr("data-wpview-text")),c=f.edit(d),c.on("close",function(){c.detach()}),e=function(d){var e=wp.media[g.shortcode].shortcode(d).string();a(b).attr("data-wpview-text",window.encodeURIComponent(e)),wp.mce.views.refreshView(g,e),c.detach()},_.isArray(g.state)?_.each(g.state,function(a){c.state(a).on("update",e)}):c.state(g.state).on("update",e),c.open()}},wp.mce.media.View=wp.mce.View.extend({initialize:function(b){this.players=[],this.shortcode=b.shortcode,_.bindAll(this,"setPlayer"),a(this).on("ready",this.setPlayer)},setPlayer:function(b,c){if(c){var d,e=this,f=this.ua.is("ff"),g=".wp-"+this.shortcode.tag+"-shortcode";if(d=a(c).find(g),!this.isCompatible(d))return d.closest(".wpview-wrap").addClass("wont-play"),d.parent().hasClass("wpview-wrap")||d.parent().replaceWith(d),void d.replaceWith("

"+d.find("source").eq(0).prop("src")+"

");d.closest(".wpview-wrap").removeClass("wont-play"),f?d.prop("preload","metadata"):d.prop("preload","none"),d=wp.media.view.MediaDetails.prepareSrc(d.get(0)),setTimeout(function(){wp.mce.media.loaded=!0,e.players.push(new MediaElementPlayer(d,e.mejsSettings))},wp.mce.media.loaded?10:500)}},getHtml:function(){var a=_.defaults(this.shortcode.attrs.named,wp.media[this.shortcode.tag].defaults);return this.template({model:a})},unbind:function(){this.unsetPlayers()}}),_.extend(wp.mce.media.View.prototype,wp.media.mixin),wp.mce.video=_.extend({},wp.mce.media,{shortcode:"video",state:"video-details",View:wp.mce.media.View.extend({className:"editor-video",template:d.template("editor-video")})}),wp.mce.views.register("video",wp.mce.video),wp.mce.audio=_.extend({},wp.mce.media,{shortcode:"audio",state:"audio-details",View:wp.mce.media.View.extend({className:"editor-audio",template:d.template("editor-audio")})}),wp.mce.views.register("audio",wp.mce.audio),wp.mce.media.PlaylistView=wp.mce.View.extend({className:"editor-playlist",template:d.template("editor-playlist"),initialize:function(a){this.players=[],this.data={},this.attachments=[],this.shortcode=a.shortcode,this.fetch()},fetch:function(){this.attachments=wp.media.playlist.attachments(this.shortcode),this.dfd=this.attachments.more().done(_.bind(this.render,this))},render:function(){var b=this.getHtml(),c=this;_.each(tinymce.editors,function(d){var e;d.plugins.wpview&&(e=d.getDoc(),a(e).find('[data-wpview-text="'+this.encodedText+'"]').each(function(d,e){var f=a(e);f.html(b).append(''),c.data.tracks&&c.players.push(new WPPlaylistView({el:a(e).find(".wp-playlist").get(0),metadata:c.data}).player)}))},this)},getHtml:function(){var a,b,c=this.shortcode.attrs.named,e=wp.media.playlist,f=[];if(!this.dfd||"pending"!==this.dfd.state()||this.attachments.length)return _.each(e.defaults,function(a,b){c[b]=e.coerce(c,b)}),a={type:c.type,style:c.style,tracklist:c.tracklist,tracknumbers:c.tracknumbers,images:c.images,artists:c.artists},this.attachments.length?(b=this.attachments.toJSON(),_.each(b,function(b){var e={},g={},h={src:b.url,type:b.mime,title:b.title,caption:b.caption,description:b.description,meta:b.meta};"video"===c.type?(e.width=b.width,e.height=b.height,d.view.settings.contentWidth?(g.width=d.view.settings.contentWidth-22,g.height=Math.ceil(e.height*g.width/e.width),a.width||(a.width=g.width,a.height=g.height)):a.width||(a.width=b.width,a.height=b.height),h.dimensions={original:e,resized:_.isEmpty(g)?e:g}):a.width=400,h.image=b.image,h.thumb=b.thumb,f.push(h)}),a.tracks=f,this.data=a,this.template(a)):this.template(a)},unbind:function(){this.unsetPlayers()}}),_.extend(wp.mce.media.PlaylistView.prototype,wp.media.mixin),wp.mce.playlist=_.extend({},wp.mce.media,{shortcode:"playlist",state:["playlist-edit","video-playlist-edit"],View:wp.mce.media.PlaylistView}),wp.mce.views.register("playlist",wp.mce.playlist)}(jQuery); \ No newline at end of file diff --git a/wp-includes/js/media-audiovideo.js b/wp-includes/js/media-audiovideo.js index da91a9cf63..47f6d36813 100644 --- a/wp-includes/js/media-audiovideo.js +++ b/wp-includes/js/media-audiovideo.js @@ -162,11 +162,13 @@ * * Examples: modal closes, shortcode properties are removed, etc. */ - unsetPlayer : function() { - if ( this.player ) { + unsetPlayers : function() { + if ( this.players && this.players.length ) { wp.media.mixin.pauseAllPlayers(); - wp.media.mixin.removePlayer( this.player ); - this.player = false; + _.each( this.players, function (player) { + wp.media.mixin.removePlayer( player ); + } ); + this.players = []; } } }; @@ -705,10 +707,10 @@ media.view.MediaDetails = media.view.Settings.AttachmentDisplay.extend({ initialize: function() { _.bindAll(this, 'success'); - - this.listenTo( this.controller, 'close', media.mixin.unsetPlayer ); + this.players = []; + this.listenTo( this.controller, 'close', media.mixin.unsetPlayers ); this.on( 'ready', this.setPlayer ); - this.on( 'media:setting:remove', media.mixin.unsetPlayer, this ); + this.on( 'media:setting:remove', media.mixin.unsetPlayers, this ); this.on( 'media:setting:remove', this.render ); this.on( 'media:setting:remove', this.setPlayer ); this.events = _.extend( this.events, { @@ -764,8 +766,8 @@ * @global MediaElementPlayer */ setPlayer : function() { - if ( ! this.player && this.media ) { - this.player = new MediaElementPlayer( this.media, this.settings ); + if ( ! this.players.length && this.media ) { + this.players.push( new MediaElementPlayer( this.media, this.settings ) ); } }, diff --git a/wp-includes/js/media-audiovideo.min.js b/wp-includes/js/media-audiovideo.min.js index 5adfec5b36..09930fdb9a 100644 --- a/wp-includes/js/media-audiovideo.min.js +++ b/wp-includes/js/media-audiovideo.min.js @@ -1 +1 @@ -!function(a,b,c){function d(){a(document.body).on("click",".wp-switch-editor",wp.media.mixin.pauseAllPlayers).on("click",".add-media-source",function(b){e.frame.lastMime=a(b.currentTarget).data("mime"),e.frame.setState("add-"+e.frame.defaults.id+"-source")})}var e=wp.media,f={},g="undefined"==typeof _wpMediaViewsL10n?{}:_wpMediaViewsL10n;b.isUndefined(window._wpmejsSettings)||(f.pluginPath=_wpmejsSettings.pluginPath),wp.media.mixin={mejsSettings:f,pauseAllPlayers:function(){var a;if(window.mejs&&window.mejs.players)for(a in window.mejs.players)window.mejs.players[a].pause()},ua:{is:function(a){var b=!1,c=window.navigator.userAgent;switch(a){case"oldie":b=null!==c.match(/MSIE [6-8]/gi);break;case"ie":b=null!==c.match(/MSIE/gi);break;case"ff":b=null!==c.match(/firefox/gi);break;case"opera":b=null!==c.match(/OPR/);break;case"safari":b=null!==c.match(/safari/gi)&&null===c.match(/chrome/gi);break;case"chrome":b=null!==c.match(/safari/gi)&&null!==c.match(/chrome/gi)}return b}},compat:{opera:{audio:["ogg","wav"],video:["ogg","webm"]},chrome:{audio:["ogg","mpeg"],video:["ogg","webm","mp4","m4v","mpeg"]},ff:{audio:["ogg","mpeg"],video:["ogg","webm"]},safari:{audio:["mpeg","wav"],video:["mp4","m4v","mpeg","x-ms-wmv","quicktime"]},ie:{audio:["mpeg"],video:["mp4","m4v","mpeg"]}},isCompatible:function(a){if(!a.find("source").length)return!1;var c,d=this.ua,e=!1,f=!1;return d.is("oldIE")?!1:(c=a.find("source"),b.find(this.compat,function(a,g){return d.is(g)&&(f=!0,b.each(c,function(b){var c=new RegExp("audio/("+a.audio.join("|")+")","gi"),d=new RegExp("video/("+a.video.join("|")+")","gi");(null!==b.type.match(d)||null!==b.type.match(c))&&(e=!0)})),e||f}),e)},removePlayer:function(a){var b,c;for(b in a.options.features)if(c=a.options.features[b],a["clean"+c])try{a["clean"+c](a)}catch(d){}a.isDynamic||a.$node.remove(),"native"!==a.media.pluginType&&a.media.remove(),delete window.mejs.players[a.id],a.container.remove(),a.globalUnbind(),delete a.node.player},unsetPlayer:function(){this.player&&(wp.media.mixin.pauseAllPlayers(),wp.media.mixin.removePlayer(this.player),this.player=!1)}},wp.media.playlist=new wp.media.collection({tag:"playlist",editTitle:g.editPlaylistTitle,defaults:{id:wp.media.view.settings.post.id,style:"light",tracklist:!0,tracknumbers:!0,images:!0,artists:!0,type:"audio"}}),wp.media.audio={coerce:wp.media.coerce,defaults:{id:wp.media.view.settings.post.id,src:"",loop:!1,autoplay:!1,preload:"none",width:400},edit:function(a){var c,d=wp.shortcode.next("audio",a).shortcode;return c=wp.media({frame:"audio",state:"audio-details",metadata:b.defaults(d.attrs.named,this.defaults)})},shortcode:function(a){var c,d=this;return b.each(this.defaults,function(b,c){a[c]=d.coerce(a,c),b===a[c]&&delete a[c]}),c=a.content,delete a.content,new wp.shortcode({tag:"audio",attrs:a,content:c})}},wp.media.video={coerce:wp.media.coerce,defaults:{id:wp.media.view.settings.post.id,src:"",poster:"",loop:!1,autoplay:!1,preload:"metadata",content:"",width:640,height:360},edit:function(a){var c,d,e=wp.shortcode.next("video",a).shortcode;return d=e.attrs.named,d.content=e.content,c=wp.media({frame:"video",state:"video-details",metadata:b.defaults(d,this.defaults)})},shortcode:function(a){var c,d=this;return b.each(this.defaults,function(b,c){a[c]=d.coerce(a,c),b===a[c]&&delete a[c]}),c=a.content,delete a.content,new wp.shortcode({tag:"video",attrs:a,content:c})}},e.model.PostMedia=c.Model.extend({initialize:function(){this.attachment=!1},setSource:function(a){this.attachment=a,this.extension=a.get("filename").split(".").pop(),this.get("src")&&this.extension===this.get("src").split(".").pop()&&this.unset("src"),b.contains(wp.media.view.settings.embedExts,this.extension)?this.set(this.extension,this.attachment.get("url")):this.unset(this.extension)},changeAttachment:function(a){var c=this;this.setSource(a),this.unset("src"),b.each(b.without(wp.media.view.settings.embedExts,this.extension),function(a){c.unset(a)})}}),e.controller.AudioDetails=e.controller.State.extend({defaults:{id:"audio-details",toolbar:"audio-details",title:g.audioDetailsTitle,content:"audio-details",menu:"audio-details",router:!1,priority:60},initialize:function(a){this.media=a.media,e.controller.State.prototype.initialize.apply(this,arguments)}}),e.controller.VideoDetails=e.controller.State.extend({defaults:{id:"video-details",toolbar:"video-details",title:g.videoDetailsTitle,content:"video-details",menu:"video-details",router:!1,priority:60},initialize:function(a){this.media=a.media,e.controller.State.prototype.initialize.apply(this,arguments)}}),e.view.MediaFrame.MediaDetails=e.view.MediaFrame.Select.extend({defaults:{id:"media",url:"",menu:"media-details",content:"media-details",toolbar:"media-details",type:"link",priority:120},initialize:function(a){this.DetailsView=a.DetailsView,this.cancelText=a.cancelText,this.addText=a.addText,this.media=new e.model.PostMedia(a.metadata),this.options.selection=new e.model.Selection(this.media.attachment,{multiple:!1}),e.view.MediaFrame.Select.prototype.initialize.apply(this,arguments)},bindHandlers:function(){var a=this.defaults.menu;e.view.MediaFrame.Select.prototype.bindHandlers.apply(this,arguments),this.on("menu:create:"+a,this.createMenu,this),this.on("content:render:"+a,this.renderDetailsContent,this),this.on("menu:render:"+a,this.renderMenu,this),this.on("toolbar:render:"+a,this.renderDetailsToolbar,this)},renderDetailsContent:function(){var a=new this.DetailsView({controller:this,model:this.state().media,attachment:this.state().media.attachment}).render();this.content.set(a)},renderMenu:function(a){var b=this.lastState(),c=b&&b.id,d=this;a.set({cancel:{text:this.cancelText,priority:20,click:function(){c?d.setState(c):d.close()}},separateCancel:new e.View({className:"separator",priority:40})})},setPrimaryButton:function(a,b){this.toolbar.set(new e.view.Toolbar({controller:this,items:{button:{style:"primary",text:a,priority:80,click:function(){var a=this.controller;b.call(this,a,a.state()),a.setState(a.options.state),a.reset()}}}}))},renderDetailsToolbar:function(){this.setPrimaryButton(g.update,function(a,b){a.close(),b.trigger("update",a.media.toJSON())})},renderReplaceToolbar:function(){this.setPrimaryButton(g.replace,function(a,b){var c=b.get("selection").single();a.media.changeAttachment(c),b.trigger("replace",a.media.toJSON())})},renderAddSourceToolbar:function(){this.setPrimaryButton(this.addText,function(a,b){var c=b.get("selection").single();a.media.setSource(c),b.trigger("add-source",a.media.toJSON())})}}),e.view.MediaFrame.AudioDetails=e.view.MediaFrame.MediaDetails.extend({defaults:{id:"audio",url:"",menu:"audio-details",content:"audio-details",toolbar:"audio-details",type:"link",title:g.audioDetailsTitle,priority:120},initialize:function(a){a.DetailsView=e.view.AudioDetails,a.cancelText=g.audioDetailsCancel,a.addText=g.audioAddSourceTitle,e.view.MediaFrame.MediaDetails.prototype.initialize.call(this,a)},bindHandlers:function(){e.view.MediaFrame.MediaDetails.prototype.bindHandlers.apply(this,arguments),this.on("toolbar:render:replace-audio",this.renderReplaceToolbar,this),this.on("toolbar:render:add-audio-source",this.renderAddSourceToolbar,this)},createStates:function(){this.states.add([new e.controller.AudioDetails({media:this.media}),new e.controller.MediaLibrary({type:"audio",id:"replace-audio",title:g.audioReplaceTitle,toolbar:"replace-audio",media:this.media,menu:"audio-details"}),new e.controller.MediaLibrary({type:"audio",id:"add-audio-source",title:g.audioAddSourceTitle,toolbar:"add-audio-source",media:this.media,menu:!1})])}}),e.view.MediaFrame.VideoDetails=e.view.MediaFrame.MediaDetails.extend({defaults:{id:"video",url:"",menu:"video-details",content:"video-details",toolbar:"video-details",type:"link",title:g.videoDetailsTitle,priority:120},initialize:function(a){a.DetailsView=e.view.VideoDetails,a.cancelText=g.videoDetailsCancel,a.addText=g.videoAddSourceTitle,e.view.MediaFrame.MediaDetails.prototype.initialize.call(this,a)},bindHandlers:function(){e.view.MediaFrame.MediaDetails.prototype.bindHandlers.apply(this,arguments),this.on("toolbar:render:replace-video",this.renderReplaceToolbar,this),this.on("toolbar:render:add-video-source",this.renderAddSourceToolbar,this),this.on("toolbar:render:select-poster-image",this.renderSelectPosterImageToolbar,this),this.on("toolbar:render:add-track",this.renderAddTrackToolbar,this)},createStates:function(){this.states.add([new e.controller.VideoDetails({media:this.media}),new e.controller.MediaLibrary({type:"video",id:"replace-video",title:g.videoReplaceTitle,toolbar:"replace-video",media:this.media,menu:"video-details"}),new e.controller.MediaLibrary({type:"video",id:"add-video-source",title:g.videoAddSourceTitle,toolbar:"add-video-source",media:this.media,menu:!1}),new e.controller.MediaLibrary({type:"image",id:"select-poster-image",title:g.videoSelectPosterImageTitle,toolbar:"select-poster-image",media:this.media,menu:"video-details"}),new e.controller.MediaLibrary({type:"text",id:"add-track",title:g.videoAddTrackTitle,toolbar:"add-track",media:this.media,menu:"video-details"})])},renderSelectPosterImageToolbar:function(){this.setPrimaryButton(g.videoSelectPosterImageTitle,function(a,b){var c=b.get("selection").single();a.media.set("poster",c.get("url")),b.trigger("set-poster-image",a.media.toJSON())})},renderAddTrackToolbar:function(){this.setPrimaryButton(g.videoAddTrackTitle,function(a,b){var c=b.get("selection").single(),d=a.media.get("content");-1===d.indexOf(c.get("url"))&&(d+=[''].join(""),a.media.set("content",d)),b.trigger("add-track",a.media.toJSON())})}}),e.view.MediaDetails=e.view.Settings.AttachmentDisplay.extend({initialize:function(){b.bindAll(this,"success"),this.listenTo(this.controller,"close",e.mixin.unsetPlayer),this.on("ready",this.setPlayer),this.on("media:setting:remove",e.mixin.unsetPlayer,this),this.on("media:setting:remove",this.render),this.on("media:setting:remove",this.setPlayer),this.events=b.extend(this.events,{"click .remove-setting":"removeSetting","change .content-track":"setTracks","click .remove-track":"setTracks"}),e.view.Settings.AttachmentDisplay.prototype.initialize.apply(this,arguments)},prepare:function(){return b.defaults({model:this.model.toJSON()},this.options)},removeSetting:function(b){var c,d=a(b.currentTarget).parent();c=d.find("input").data("setting"),c&&(this.model.unset(c),this.trigger("media:setting:remove",this)),d.remove()},setTracks:function(){var c="";b.each(this.$(".content-track"),function(b){c+=a(b).val()}),this.model.set("content",c),this.trigger("media:setting:remove",this)},setPlayer:function(){!this.player&&this.media&&(this.player=new MediaElementPlayer(this.media,this.settings))},setMedia:function(){return this},success:function(a){var b=a.attributes.autoplay&&"false"!==a.attributes.autoplay;"flash"===a.pluginType&&b&&a.addEventListener("canplay",function(){a.play()},!1),this.mejs=a},render:function(){var a=this;return e.view.Settings.AttachmentDisplay.prototype.render.apply(this,arguments),setTimeout(function(){a.resetFocus()},10),this.settings=b.defaults({success:this.success},f),this.setMedia()},resetFocus:function(){this.$(".embed-media-settings").scrollTop(0)}},{instances:0,prepareSrc:function(c){var d=e.view.MediaDetails.instances++;return b.each(a(c).find("source"),function(a){a.src=[a.src,a.src.indexOf("?")>-1?"&":"?","_=",d].join("")}),c}}),e.view.AudioDetails=e.view.MediaDetails.extend({className:"audio-details",template:e.template("audio-details"),setMedia:function(){var a=this.$(".wp-audio-shortcode");return a.find("source").length?(a.is(":hidden")&&a.show(),this.media=e.view.MediaDetails.prepareSrc(a.get(0))):(a.hide(),this.media=!1),this}}),e.view.VideoDetails=e.view.MediaDetails.extend({className:"video-details",template:e.template("video-details"),setMedia:function(){var a=this.$(".wp-video-shortcode");return a.find("source").length?(a.is(":hidden")&&a.show(),this.media=a.hasClass("youtube-video")?a.get(0):e.view.MediaDetails.prepareSrc(a.get(0))):(a.hide(),this.media=!1),this}}),a(d)}(jQuery,_,Backbone); \ No newline at end of file +!function(a,b,c){function d(){a(document.body).on("click",".wp-switch-editor",wp.media.mixin.pauseAllPlayers).on("click",".add-media-source",function(b){e.frame.lastMime=a(b.currentTarget).data("mime"),e.frame.setState("add-"+e.frame.defaults.id+"-source")})}var e=wp.media,f={},g="undefined"==typeof _wpMediaViewsL10n?{}:_wpMediaViewsL10n;b.isUndefined(window._wpmejsSettings)||(f.pluginPath=_wpmejsSettings.pluginPath),wp.media.mixin={mejsSettings:f,pauseAllPlayers:function(){var a;if(window.mejs&&window.mejs.players)for(a in window.mejs.players)window.mejs.players[a].pause()},ua:{is:function(a){var b=!1,c=window.navigator.userAgent;switch(a){case"oldie":b=null!==c.match(/MSIE [6-8]/gi);break;case"ie":b=null!==c.match(/MSIE/gi);break;case"ff":b=null!==c.match(/firefox/gi);break;case"opera":b=null!==c.match(/OPR/);break;case"safari":b=null!==c.match(/safari/gi)&&null===c.match(/chrome/gi);break;case"chrome":b=null!==c.match(/safari/gi)&&null!==c.match(/chrome/gi)}return b}},compat:{opera:{audio:["ogg","wav"],video:["ogg","webm"]},chrome:{audio:["ogg","mpeg"],video:["ogg","webm","mp4","m4v","mpeg"]},ff:{audio:["ogg","mpeg"],video:["ogg","webm"]},safari:{audio:["mpeg","wav"],video:["mp4","m4v","mpeg","x-ms-wmv","quicktime"]},ie:{audio:["mpeg"],video:["mp4","m4v","mpeg"]}},isCompatible:function(a){if(!a.find("source").length)return!1;var c,d=this.ua,e=!1,f=!1;return d.is("oldIE")?!1:(c=a.find("source"),b.find(this.compat,function(a,g){return d.is(g)&&(f=!0,b.each(c,function(b){var c=new RegExp("audio/("+a.audio.join("|")+")","gi"),d=new RegExp("video/("+a.video.join("|")+")","gi");(null!==b.type.match(d)||null!==b.type.match(c))&&(e=!0)})),e||f}),e)},removePlayer:function(a){var b,c;for(b in a.options.features)if(c=a.options.features[b],a["clean"+c])try{a["clean"+c](a)}catch(d){}a.isDynamic||a.$node.remove(),"native"!==a.media.pluginType&&a.media.remove(),delete window.mejs.players[a.id],a.container.remove(),a.globalUnbind(),delete a.node.player},unsetPlayers:function(){this.players&&this.players.length&&(wp.media.mixin.pauseAllPlayers(),b.each(this.players,function(a){wp.media.mixin.removePlayer(a)}),this.players=[])}},wp.media.playlist=new wp.media.collection({tag:"playlist",editTitle:g.editPlaylistTitle,defaults:{id:wp.media.view.settings.post.id,style:"light",tracklist:!0,tracknumbers:!0,images:!0,artists:!0,type:"audio"}}),wp.media.audio={coerce:wp.media.coerce,defaults:{id:wp.media.view.settings.post.id,src:"",loop:!1,autoplay:!1,preload:"none",width:400},edit:function(a){var c,d=wp.shortcode.next("audio",a).shortcode;return c=wp.media({frame:"audio",state:"audio-details",metadata:b.defaults(d.attrs.named,this.defaults)})},shortcode:function(a){var c,d=this;return b.each(this.defaults,function(b,c){a[c]=d.coerce(a,c),b===a[c]&&delete a[c]}),c=a.content,delete a.content,new wp.shortcode({tag:"audio",attrs:a,content:c})}},wp.media.video={coerce:wp.media.coerce,defaults:{id:wp.media.view.settings.post.id,src:"",poster:"",loop:!1,autoplay:!1,preload:"metadata",content:"",width:640,height:360},edit:function(a){var c,d,e=wp.shortcode.next("video",a).shortcode;return d=e.attrs.named,d.content=e.content,c=wp.media({frame:"video",state:"video-details",metadata:b.defaults(d,this.defaults)})},shortcode:function(a){var c,d=this;return b.each(this.defaults,function(b,c){a[c]=d.coerce(a,c),b===a[c]&&delete a[c]}),c=a.content,delete a.content,new wp.shortcode({tag:"video",attrs:a,content:c})}},e.model.PostMedia=c.Model.extend({initialize:function(){this.attachment=!1},setSource:function(a){this.attachment=a,this.extension=a.get("filename").split(".").pop(),this.get("src")&&this.extension===this.get("src").split(".").pop()&&this.unset("src"),b.contains(wp.media.view.settings.embedExts,this.extension)?this.set(this.extension,this.attachment.get("url")):this.unset(this.extension)},changeAttachment:function(a){var c=this;this.setSource(a),this.unset("src"),b.each(b.without(wp.media.view.settings.embedExts,this.extension),function(a){c.unset(a)})}}),e.controller.AudioDetails=e.controller.State.extend({defaults:{id:"audio-details",toolbar:"audio-details",title:g.audioDetailsTitle,content:"audio-details",menu:"audio-details",router:!1,priority:60},initialize:function(a){this.media=a.media,e.controller.State.prototype.initialize.apply(this,arguments)}}),e.controller.VideoDetails=e.controller.State.extend({defaults:{id:"video-details",toolbar:"video-details",title:g.videoDetailsTitle,content:"video-details",menu:"video-details",router:!1,priority:60},initialize:function(a){this.media=a.media,e.controller.State.prototype.initialize.apply(this,arguments)}}),e.view.MediaFrame.MediaDetails=e.view.MediaFrame.Select.extend({defaults:{id:"media",url:"",menu:"media-details",content:"media-details",toolbar:"media-details",type:"link",priority:120},initialize:function(a){this.DetailsView=a.DetailsView,this.cancelText=a.cancelText,this.addText=a.addText,this.media=new e.model.PostMedia(a.metadata),this.options.selection=new e.model.Selection(this.media.attachment,{multiple:!1}),e.view.MediaFrame.Select.prototype.initialize.apply(this,arguments)},bindHandlers:function(){var a=this.defaults.menu;e.view.MediaFrame.Select.prototype.bindHandlers.apply(this,arguments),this.on("menu:create:"+a,this.createMenu,this),this.on("content:render:"+a,this.renderDetailsContent,this),this.on("menu:render:"+a,this.renderMenu,this),this.on("toolbar:render:"+a,this.renderDetailsToolbar,this)},renderDetailsContent:function(){var a=new this.DetailsView({controller:this,model:this.state().media,attachment:this.state().media.attachment}).render();this.content.set(a)},renderMenu:function(a){var b=this.lastState(),c=b&&b.id,d=this;a.set({cancel:{text:this.cancelText,priority:20,click:function(){c?d.setState(c):d.close()}},separateCancel:new e.View({className:"separator",priority:40})})},setPrimaryButton:function(a,b){this.toolbar.set(new e.view.Toolbar({controller:this,items:{button:{style:"primary",text:a,priority:80,click:function(){var a=this.controller;b.call(this,a,a.state()),a.setState(a.options.state),a.reset()}}}}))},renderDetailsToolbar:function(){this.setPrimaryButton(g.update,function(a,b){a.close(),b.trigger("update",a.media.toJSON())})},renderReplaceToolbar:function(){this.setPrimaryButton(g.replace,function(a,b){var c=b.get("selection").single();a.media.changeAttachment(c),b.trigger("replace",a.media.toJSON())})},renderAddSourceToolbar:function(){this.setPrimaryButton(this.addText,function(a,b){var c=b.get("selection").single();a.media.setSource(c),b.trigger("add-source",a.media.toJSON())})}}),e.view.MediaFrame.AudioDetails=e.view.MediaFrame.MediaDetails.extend({defaults:{id:"audio",url:"",menu:"audio-details",content:"audio-details",toolbar:"audio-details",type:"link",title:g.audioDetailsTitle,priority:120},initialize:function(a){a.DetailsView=e.view.AudioDetails,a.cancelText=g.audioDetailsCancel,a.addText=g.audioAddSourceTitle,e.view.MediaFrame.MediaDetails.prototype.initialize.call(this,a)},bindHandlers:function(){e.view.MediaFrame.MediaDetails.prototype.bindHandlers.apply(this,arguments),this.on("toolbar:render:replace-audio",this.renderReplaceToolbar,this),this.on("toolbar:render:add-audio-source",this.renderAddSourceToolbar,this)},createStates:function(){this.states.add([new e.controller.AudioDetails({media:this.media}),new e.controller.MediaLibrary({type:"audio",id:"replace-audio",title:g.audioReplaceTitle,toolbar:"replace-audio",media:this.media,menu:"audio-details"}),new e.controller.MediaLibrary({type:"audio",id:"add-audio-source",title:g.audioAddSourceTitle,toolbar:"add-audio-source",media:this.media,menu:!1})])}}),e.view.MediaFrame.VideoDetails=e.view.MediaFrame.MediaDetails.extend({defaults:{id:"video",url:"",menu:"video-details",content:"video-details",toolbar:"video-details",type:"link",title:g.videoDetailsTitle,priority:120},initialize:function(a){a.DetailsView=e.view.VideoDetails,a.cancelText=g.videoDetailsCancel,a.addText=g.videoAddSourceTitle,e.view.MediaFrame.MediaDetails.prototype.initialize.call(this,a)},bindHandlers:function(){e.view.MediaFrame.MediaDetails.prototype.bindHandlers.apply(this,arguments),this.on("toolbar:render:replace-video",this.renderReplaceToolbar,this),this.on("toolbar:render:add-video-source",this.renderAddSourceToolbar,this),this.on("toolbar:render:select-poster-image",this.renderSelectPosterImageToolbar,this),this.on("toolbar:render:add-track",this.renderAddTrackToolbar,this)},createStates:function(){this.states.add([new e.controller.VideoDetails({media:this.media}),new e.controller.MediaLibrary({type:"video",id:"replace-video",title:g.videoReplaceTitle,toolbar:"replace-video",media:this.media,menu:"video-details"}),new e.controller.MediaLibrary({type:"video",id:"add-video-source",title:g.videoAddSourceTitle,toolbar:"add-video-source",media:this.media,menu:!1}),new e.controller.MediaLibrary({type:"image",id:"select-poster-image",title:g.videoSelectPosterImageTitle,toolbar:"select-poster-image",media:this.media,menu:"video-details"}),new e.controller.MediaLibrary({type:"text",id:"add-track",title:g.videoAddTrackTitle,toolbar:"add-track",media:this.media,menu:"video-details"})])},renderSelectPosterImageToolbar:function(){this.setPrimaryButton(g.videoSelectPosterImageTitle,function(a,b){var c=b.get("selection").single();a.media.set("poster",c.get("url")),b.trigger("set-poster-image",a.media.toJSON())})},renderAddTrackToolbar:function(){this.setPrimaryButton(g.videoAddTrackTitle,function(a,b){var c=b.get("selection").single(),d=a.media.get("content");-1===d.indexOf(c.get("url"))&&(d+=[''].join(""),a.media.set("content",d)),b.trigger("add-track",a.media.toJSON())})}}),e.view.MediaDetails=e.view.Settings.AttachmentDisplay.extend({initialize:function(){b.bindAll(this,"success"),this.players=[],this.listenTo(this.controller,"close",e.mixin.unsetPlayers),this.on("ready",this.setPlayer),this.on("media:setting:remove",e.mixin.unsetPlayers,this),this.on("media:setting:remove",this.render),this.on("media:setting:remove",this.setPlayer),this.events=b.extend(this.events,{"click .remove-setting":"removeSetting","change .content-track":"setTracks","click .remove-track":"setTracks"}),e.view.Settings.AttachmentDisplay.prototype.initialize.apply(this,arguments)},prepare:function(){return b.defaults({model:this.model.toJSON()},this.options)},removeSetting:function(b){var c,d=a(b.currentTarget).parent();c=d.find("input").data("setting"),c&&(this.model.unset(c),this.trigger("media:setting:remove",this)),d.remove()},setTracks:function(){var c="";b.each(this.$(".content-track"),function(b){c+=a(b).val()}),this.model.set("content",c),this.trigger("media:setting:remove",this)},setPlayer:function(){!this.players.length&&this.media&&this.players.push(new MediaElementPlayer(this.media,this.settings))},setMedia:function(){return this},success:function(a){var b=a.attributes.autoplay&&"false"!==a.attributes.autoplay;"flash"===a.pluginType&&b&&a.addEventListener("canplay",function(){a.play()},!1),this.mejs=a},render:function(){var a=this;return e.view.Settings.AttachmentDisplay.prototype.render.apply(this,arguments),setTimeout(function(){a.resetFocus()},10),this.settings=b.defaults({success:this.success},f),this.setMedia()},resetFocus:function(){this.$(".embed-media-settings").scrollTop(0)}},{instances:0,prepareSrc:function(c){var d=e.view.MediaDetails.instances++;return b.each(a(c).find("source"),function(a){a.src=[a.src,a.src.indexOf("?")>-1?"&":"?","_=",d].join("")}),c}}),e.view.AudioDetails=e.view.MediaDetails.extend({className:"audio-details",template:e.template("audio-details"),setMedia:function(){var a=this.$(".wp-audio-shortcode");return a.find("source").length?(a.is(":hidden")&&a.show(),this.media=e.view.MediaDetails.prepareSrc(a.get(0))):(a.hide(),this.media=!1),this}}),e.view.VideoDetails=e.view.MediaDetails.extend({className:"video-details",template:e.template("video-details"),setMedia:function(){var a=this.$(".wp-video-shortcode");return a.find("source").length?(a.is(":hidden")&&a.show(),this.media=a.hasClass("youtube-video")?a.get(0):e.view.MediaDetails.prepareSrc(a.get(0))):(a.hide(),this.media=!1),this}}),a(d)}(jQuery,_,Backbone); \ No newline at end of file diff --git a/wp-includes/media-template.php b/wp-includes/media-template.php index 202fd0747b..a3300e59f4 100644 --- a/wp-includes/media-template.php +++ b/wp-includes/media-template.php @@ -16,7 +16,8 @@ function wp_underscore_audio_template() { $audio_types = wp_get_audio_extensions(); ?> -