X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/0461a5f2e55c8d5f1fde96ca2e83117152573c7d..9e77185fafaf4e60e2b73821e0e4b9b1a11fb85f:/wp-includes/js/mediaelement/wp-playlist.js diff --git a/wp-includes/js/mediaelement/wp-playlist.js b/wp-includes/js/mediaelement/wp-playlist.js index ced70c62..90839a5d 100644 --- a/wp-includes/js/mediaelement/wp-playlist.js +++ b/wp-includes/js/mediaelement/wp-playlist.js @@ -7,8 +7,7 @@ initialize : function (options) { this.index = 0; this.settings = {}; - this.compatMode = $( 'body' ).hasClass( 'wp-admin' ) && $( '#content_ifr' ).length; - this.data = options.metadata || $.parseJSON( this.$('script').html() ); + this.data = options.metadata || $.parseJSON( this.$('script.wp-playlist-script').html() ); this.playerNode = this.$( this.data.type ); this.tracks = new Backbone.Collection( this.data.tracks ); @@ -27,14 +26,12 @@ this.renderTracks(); } - if ( this.isCompatibleSrc() ) { - this.playerNode.attr( 'src', this.current.get( 'src' ) ); - } + this.playerNode.attr( 'src', this.current.get( 'src' ) ); _.bindAll( this, 'bindPlayer', 'bindResetPlayer', 'setPlayer', 'ended', 'clickTrack' ); if ( ! _.isUndefined( window._wpmejsSettings ) ) { - this.settings.pluginPath = _wpmejsSettings.pluginPath; + this.settings = _wpmejsSettings; } this.settings.success = this.bindPlayer; this.setPlayer(); @@ -47,25 +44,7 @@ bindResetPlayer : function (mejs) { this.bindPlayer( mejs ); - if ( this.isCompatibleSrc() ) { - this.playCurrentSrc(); - } - }, - - isCompatibleSrc: function () { - var testNode; - - if ( this.compatMode ) { - testNode = $( '' ); - - if ( ! wp.media.mixin.isCompatible( testNode ) ) { - this.playerNode.removeAttr( 'src' ); - this.playerNode.removeAttr( 'poster' ); - return; - } - } - - return true; + this.playCurrentSrc(); }, setPlayer: function (force) { @@ -76,9 +55,7 @@ } if (force) { - if ( this.isCompatibleSrc() ) { - this.playerNode.attr( 'src', this.current.get( 'src' ) ); - } + this.playerNode.attr( 'src', this.current.get( 'src' ) ); this.settings.success = this.bindResetPlayer; } @@ -145,8 +122,7 @@ this.next(); } else { this.index = 0; - this.current = this.tracks.at( this.index ); - this.loadCurrent(); + this.setCurrent(); } }, @@ -168,7 +144,7 @@ if ( last !== current ) { this.setPlayer( true ); - } else if ( this.isCompatibleSrc() ) { + } else { this.playerNode.attr( 'src', this.current.get( 'src' ) ); this.playCurrentSrc(); } @@ -189,11 +165,9 @@ }); $(document).ready(function () { - if ( ! $( 'body' ).hasClass( 'wp-admin' ) || $( 'body' ).hasClass( 'about-php' ) ) { - $('.wp-playlist').each(function () { - return new WPPlaylistView({ el: this }); - }); - } + $('.wp-playlist').each( function() { + return new WPPlaylistView({ el: this }); + } ); }); window.WPPlaylistView = WPPlaylistView;