WordPress.org

Make WordPress Core

Changeset 31487


Ignore:
Timestamp:
02/22/2015 05:38:00 AM (5 years ago)
Author:
wonderboymusic
Message:

Restore the changes I made in [31016] for chromeless Vimeo that were missed in [31373].

Make sure that the build file for grid doesn't load views/media-details.js, it already exists in the audio-video build.

See #29267, #28510.

Location:
trunk/src/wp-includes/js/media
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/js/media/audio-video.js

    r31399 r31487  
    40834083    },
    40844084
     4085    loadPlayer: function () {
     4086        this.players.push( new MediaElementPlayer( this.media, this.settings ) );
     4087        this.scriptXhr = false;
     4088    },
     4089
    40854090    /**
    40864091     * @global MediaElementPlayer
    40874092     */
    40884093    setPlayer : function() {
    4089         if ( ! this.players.length && this.media ) {
    4090             this.players.push( new window.MediaElementPlayer( this.media, this.settings ) );
     4094        var baseSettings;
     4095
     4096        if ( this.players.length || ! this.media || this.scriptXhr ) {
     4097            return;
     4098        }
     4099
     4100        if ( this.media.src.indexOf( 'vimeo' ) && ! ( 'Froogaloop' in window ) ) {
     4101            baseSettings = wp.media.mixin.mejsSettings;
     4102            this.scriptXhr = $.getScript( baseSettings.pluginPath + 'froogaloop.min.js', _.bind( this.loadPlayer, this ) );
     4103        } else {
     4104            this.loadPlayer();
    40914105        }
    40924106    },
     
    59625976            }
    59635977
    5964             if ( ! video.hasClass('youtube-video') ) {
     5978            if ( ! video.hasClass( 'youtube-video' ) && ! video.hasClass( 'vimeo-video' ) ) {
    59655979                this.media = MediaDetails.prepareSrc( video.get(0) );
    59665980            } else {
  • trunk/src/wp-includes/js/media/grid.js

    r31399 r31487  
    106106module.exports = EditImage;
    107107
    108 },{"../views/toolbar.js":46,"./state.js":6}],3:[function(require,module,exports){
     108},{"../views/toolbar.js":45,"./state.js":6}],3:[function(require,module,exports){
    109109/**
    110110 * wp.media.controller.Library
     
    11341134module.exports = AttachmentCompat;
    11351135
    1136 },{"./view.js":51}],11:[function(require,module,exports){
     1136},{"./view.js":50}],11:[function(require,module,exports){
    11371137/**
    11381138 * wp.media.view.AttachmentFilters
     
    12121212module.exports = AttachmentFilters;
    12131213
    1214 },{"./view.js":51}],12:[function(require,module,exports){
     1214},{"./view.js":50}],12:[function(require,module,exports){
    12151215/**
    12161216 * wp.media.view.AttachmentFilters.All
     
    19591959module.exports = Attachment;
    19601960
    1961 },{"./view.js":51}],16:[function(require,module,exports){
     1961},{"./view.js":50}],16:[function(require,module,exports){
     1962/*globals wp */
     1963
    19621964/**
    19631965 * A similar view to media.view.Attachment.Details
     
    19721974 */
    19731975var Details = require( './details.js' ),
    1974     MediaDetails = require( '../media-details.js' ),
    19751976    TwoColumn;
    19761977
     
    19931994        wp.media.mixin.removeAllPlayers();
    19941995        this.$( 'audio, video' ).each( function (i, elem) {
    1995             var el = MediaDetails.prepareSrc( elem );
     1996            var el = wp.media.view.MediaDetails.prepareSrc( elem );
    19961997            new window.MediaElementPlayer( el, wp.media.mixin.mejsSettings );
    19971998        } );
     
    20012002module.exports = TwoColumn;
    20022003
    2003 },{"../media-details.js":33,"./details.js":17}],17:[function(require,module,exports){
     2004},{"./details.js":17}],17:[function(require,module,exports){
    20042005/**
    20052006 * wp.media.view.Attachment.Details
     
    24622463module.exports = Attachments;
    24632464
    2464 },{"./attachment.js":15,"./view.js":51}],20:[function(require,module,exports){
     2465},{"./attachment.js":15,"./view.js":50}],20:[function(require,module,exports){
    24652466/**
    24662467 * wp.media.view.AttachmentsBrowser
     
    29212922module.exports = AttachmentsBrowser;
    29222923
    2923 },{"../attachment-compat.js":10,"../attachment-filters/all.js":12,"../attachment-filters/date.js":13,"../attachment-filters/uploaded.js":14,"../attachment/details.js":17,"../attachment/library.js":18,"../attachments.js":19,"../label.js":32,"../search.js":41,"../settings/attachment-display.js":43,"../sidebar.js":44,"../spinner.js":45,"../toolbar.js":46,"../uploader/inline.js":47,"../uploader/status.js":49,"../view.js":51}],21:[function(require,module,exports){
     2924},{"../attachment-compat.js":10,"../attachment-filters/all.js":12,"../attachment-filters/date.js":13,"../attachment-filters/uploaded.js":14,"../attachment/details.js":17,"../attachment/library.js":18,"../attachments.js":19,"../label.js":32,"../search.js":40,"../settings/attachment-display.js":42,"../sidebar.js":43,"../spinner.js":44,"../toolbar.js":45,"../uploader/inline.js":46,"../uploader/status.js":48,"../view.js":50}],21:[function(require,module,exports){
    29242925/**
    29252926 * wp.media.view.Button
     
    30103011module.exports = Button;
    30113012
    3012 },{"./view.js":51}],22:[function(require,module,exports){
     3013},{"./view.js":50}],22:[function(require,module,exports){
    30133014/**
    30143015 * When MEDIA_TRASH is true, a button that handles bulk Delete Permanently logic
     
    31873188module.exports = Details;
    31883189
    3189 },{"./edit-image.js":26,"./view.js":51}],26:[function(require,module,exports){
     3190},{"./edit-image.js":26,"./view.js":50}],26:[function(require,module,exports){
    31903191var View = require( './view.js' ),
    31913192    EditImage;
     
    32403241module.exports = EditImage;
    32413242
    3242 },{"./view.js":51}],27:[function(require,module,exports){
     3243},{"./view.js":50}],27:[function(require,module,exports){
    32433244/**
    32443245 * wp.media.view.FocusManager
     
    32893290module.exports = FocusManager;
    32903291
    3291 },{"./view.js":51}],28:[function(require,module,exports){
     3292},{"./view.js":50}],28:[function(require,module,exports){
    32923293/**
    32933294 * wp.media.view.Frame
     
    34613462module.exports = Frame;
    34623463
    3463 },{"../controllers/region.js":4,"../controllers/state-machine.js":5,"../controllers/state.js":6,"./view.js":51}],29:[function(require,module,exports){
     3464},{"../controllers/region.js":4,"../controllers/state-machine.js":5,"../controllers/state.js":6,"./view.js":50}],29:[function(require,module,exports){
    34643465/**
    34653466 * A frame for editing the details of a specific media item.
     
    37073708module.exports = EditAttachments;
    37083709
    3709 },{"../../controllers/edit-attachment-metadata.js":1,"../../controllers/edit-image.js":2,"../attachment-compat.js":10,"../attachment/details-two-column.js":16,"../edit-image-details.js":25,"../frame.js":28,"../media-frame.js":34,"../modal.js":37}],30:[function(require,module,exports){
     3710},{"../../controllers/edit-attachment-metadata.js":1,"../../controllers/edit-image.js":2,"../attachment-compat.js":10,"../attachment/details-two-column.js":16,"../edit-image-details.js":25,"../frame.js":28,"../media-frame.js":33,"../modal.js":36}],30:[function(require,module,exports){
    37103711/**
    37113712 * wp.media.view.MediaFrame.Manage
     
    39543955module.exports = Manage;
    39553956
    3956 },{"../../controllers/library.js":3,"../../routers/manage.js":8,"../attachments/browser.js":20,"../media-frame.js":34,"../uploader/window.js":50}],31:[function(require,module,exports){
     3957},{"../../controllers/library.js":3,"../../routers/manage.js":8,"../attachments/browser.js":20,"../media-frame.js":33,"../uploader/window.js":49}],31:[function(require,module,exports){
    39573958/**
    39583959 * wp.media.view.Iframe
     
    39813982module.exports = Iframe;
    39823983
    3983 },{"./view.js":51}],32:[function(require,module,exports){
     3984},{"./view.js":50}],32:[function(require,module,exports){
    39843985/**
    39853986 * @class
     
    40084009module.exports = Label;
    40094010
    4010 },{"./view.js":51}],33:[function(require,module,exports){
    4011 /**
    4012  * wp.media.view.MediaDetails
    4013  *
    4014  * @constructor
    4015  * @augments wp.media.view.Settings.AttachmentDisplay
    4016  * @augments wp.media.view.Settings
    4017  * @augments wp.media.View
    4018  * @augments wp.Backbone.View
    4019  * @augments Backbone.View
    4020  */
    4021 var AttachmentDisplay = require( './settings/attachment-display.js' ),
    4022     $ = jQuery,
    4023     MediaDetails;
    4024 
    4025 MediaDetails = AttachmentDisplay.extend({
    4026     initialize: function() {
    4027         _.bindAll(this, 'success');
    4028         this.players = [];
    4029         this.listenTo( this.controller, 'close', wp.media.mixin.unsetPlayers );
    4030         this.on( 'ready', this.setPlayer );
    4031         this.on( 'media:setting:remove', wp.media.mixin.unsetPlayers, this );
    4032         this.on( 'media:setting:remove', this.render );
    4033         this.on( 'media:setting:remove', this.setPlayer );
    4034         this.events = _.extend( this.events, {
    4035             'click .remove-setting' : 'removeSetting',
    4036             'change .content-track' : 'setTracks',
    4037             'click .remove-track' : 'setTracks',
    4038             'click .add-media-source' : 'addSource'
    4039         } );
    4040 
    4041         AttachmentDisplay.prototype.initialize.apply( this, arguments );
    4042     },
    4043 
    4044     prepare: function() {
    4045         return _.defaults({
    4046             model: this.model.toJSON()
    4047         }, this.options );
    4048     },
    4049 
    4050     /**
    4051      * Remove a setting's UI when the model unsets it
    4052      *
    4053      * @fires wp.media.view.MediaDetails#media:setting:remove
    4054      *
    4055      * @param {Event} e
    4056      */
    4057     removeSetting : function(e) {
    4058         var wrap = $( e.currentTarget ).parent(), setting;
    4059         setting = wrap.find( 'input' ).data( 'setting' );
    4060 
    4061         if ( setting ) {
    4062             this.model.unset( setting );
    4063             this.trigger( 'media:setting:remove', this );
    4064         }
    4065 
    4066         wrap.remove();
    4067     },
    4068 
    4069     /**
    4070      *
    4071      * @fires wp.media.view.MediaDetails#media:setting:remove
    4072      */
    4073     setTracks : function() {
    4074         var tracks = '';
    4075 
    4076         _.each( this.$('.content-track'), function(track) {
    4077             tracks += $( track ).val();
    4078         } );
    4079 
    4080         this.model.set( 'content', tracks );
    4081         this.trigger( 'media:setting:remove', this );
    4082     },
    4083 
    4084     addSource : function( e ) {
    4085         this.controller.lastMime = $( e.currentTarget ).data( 'mime' );
    4086         this.controller.setState( 'add-' + this.controller.defaults.id + '-source' );
    4087     },
    4088 
    4089     /**
    4090      * @global MediaElementPlayer
    4091      */
    4092     setPlayer : function() {
    4093         if ( ! this.players.length && this.media ) {
    4094             this.players.push( new window.MediaElementPlayer( this.media, this.settings ) );
    4095         }
    4096     },
    4097 
    4098     /**
    4099      * @abstract
    4100      */
    4101     setMedia : function() {
    4102         return this;
    4103     },
    4104 
    4105     success : function(mejs) {
    4106         var autoplay = mejs.attributes.autoplay && 'false' !== mejs.attributes.autoplay;
    4107 
    4108         if ( 'flash' === mejs.pluginType && autoplay ) {
    4109             mejs.addEventListener( 'canplay', function() {
    4110                 mejs.play();
    4111             }, false );
    4112         }
    4113 
    4114         this.mejs = mejs;
    4115     },
    4116 
    4117     /**
    4118      * @returns {media.view.MediaDetails} Returns itself to allow chaining
    4119      */
    4120     render: function() {
    4121         AttachmentDisplay.prototype.render.apply( this, arguments );
    4122 
    4123         setTimeout( _.bind( function() {
    4124             this.resetFocus();
    4125         }, this ), 10 );
    4126 
    4127         this.settings = _.defaults( {
    4128             success : this.success
    4129         }, wp.media.mixin.mejsSettings );
    4130 
    4131         return this.setMedia();
    4132     },
    4133 
    4134     resetFocus: function() {
    4135         this.$( '.embed-media-settings' ).scrollTop( 0 );
    4136     }
    4137 }, {
    4138     instances : 0,
    4139     /**
    4140      * When multiple players in the DOM contain the same src, things get weird.
    4141      *
    4142      * @param {HTMLElement} elem
    4143      * @returns {HTMLElement}
    4144      */
    4145     prepareSrc : function( elem ) {
    4146         var i = MediaDetails.instances++;
    4147         _.each( $( elem ).find( 'source' ), function( source ) {
    4148             source.src = [
    4149                 source.src,
    4150                 source.src.indexOf('?') > -1 ? '&' : '?',
    4151                 '_=',
    4152                 i
    4153             ].join('');
    4154         } );
    4155 
    4156         return elem;
    4157     }
    4158 });
    4159 
    4160 module.exports = MediaDetails;
    4161 
    4162 },{"./settings/attachment-display.js":43}],34:[function(require,module,exports){
     4011},{"./view.js":50}],33:[function(require,module,exports){
    41634012/**
    41644013 * wp.media.view.MediaFrame
     
    44144263module.exports = MediaFrame;
    44154264
    4416 },{"./frame.js":28,"./iframe.js":31,"./menu.js":36,"./modal.js":37,"./router.js":40,"./toolbar.js":46,"./uploader/window.js":50,"./view.js":51}],35:[function(require,module,exports){
     4265},{"./frame.js":28,"./iframe.js":31,"./menu.js":35,"./modal.js":36,"./router.js":39,"./toolbar.js":45,"./uploader/window.js":49,"./view.js":50}],34:[function(require,module,exports){
    44174266/**
    44184267 * wp.media.view.MenuItem
     
    44874336module.exports = MenuItem;
    44884337
    4489 },{"./view.js":51}],36:[function(require,module,exports){
     4338},{"./view.js":50}],35:[function(require,module,exports){
    44904339/**
    44914340 * wp.media.view.Menu
     
    46044453module.exports = Menu;
    46054454
    4606 },{"./menu-item.js":35,"./priority-list.js":38}],37:[function(require,module,exports){
     4455},{"./menu-item.js":34,"./priority-list.js":37}],36:[function(require,module,exports){
    46074456/**
    46084457 * wp.media.view.Modal
     
    48194668module.exports = Modal;
    48204669
    4821 },{"./focus-manager.js":27,"./view.js":51}],38:[function(require,module,exports){
     4670},{"./focus-manager.js":27,"./view.js":50}],37:[function(require,module,exports){
    48224671/**
    48234672 * wp.media.view.PriorityList
     
    49194768module.exports = PriorityList;
    49204769
    4921 },{"./view.js":51}],39:[function(require,module,exports){
     4770},{"./view.js":50}],38:[function(require,module,exports){
    49224771/**
    49234772 * wp.media.view.RouterItem
     
    49464795module.exports = RouterItem;
    49474796
    4948 },{"./menu-item.js":35}],40:[function(require,module,exports){
     4797},{"./menu-item.js":34}],39:[function(require,module,exports){
    49494798/**
    49504799 * wp.media.view.Router
     
    49844833module.exports = Router;
    49854834
    4986 },{"./menu.js":36,"./router-item.js":39}],41:[function(require,module,exports){
     4835},{"./menu.js":35,"./router-item.js":38}],40:[function(require,module,exports){
    49874836/**
    49884837 * wp.media.view.Search
     
    50334882module.exports = Search;
    50344883
    5035 },{"./view.js":51}],42:[function(require,module,exports){
     4884},{"./view.js":50}],41:[function(require,module,exports){
    50364885/**
    50374886 * wp.media.view.Settings
     
    51545003module.exports = Settings;
    51555004
    5156 },{"./view.js":51}],43:[function(require,module,exports){
     5005},{"./view.js":50}],42:[function(require,module,exports){
    51575006/**
    51585007 * wp.media.view.Settings.AttachmentDisplay
     
    52485097module.exports = AttachmentDisplay;
    52495098
    5250 },{"../settings.js":42}],44:[function(require,module,exports){
     5099},{"../settings.js":41}],43:[function(require,module,exports){
    52515100/**
    52525101 * wp.media.view.Sidebar
     
    52675116module.exports = Sidebar;
    52685117
    5269 },{"./priority-list.js":38}],45:[function(require,module,exports){
     5118},{"./priority-list.js":37}],44:[function(require,module,exports){
    52705119/**
    52715120 * wp.media.view.Spinner
     
    53055154module.exports = Spinner;
    53065155
    5307 },{"./view.js":51}],46:[function(require,module,exports){
     5156},{"./view.js":50}],45:[function(require,module,exports){
    53085157/**
    53095158 * wp.media.view.Toolbar
     
    54675316module.exports = Toolbar;
    54685317
    5469 },{"./button.js":21,"./priority-list.js":38,"./view.js":51}],47:[function(require,module,exports){
     5318},{"./button.js":21,"./priority-list.js":37,"./view.js":50}],46:[function(require,module,exports){
    54705319/**
    54715320 * wp.media.view.UploaderInline
     
    55995448module.exports = UploaderInline;
    56005449
    5601 },{"../view.js":51,"./status.js":49}],48:[function(require,module,exports){
     5450},{"../view.js":50,"./status.js":48}],47:[function(require,module,exports){
    56025451/**
    56035452 * wp.media.view.UploaderStatusError
     
    56185467module.exports = UploaderStatusError;
    56195468
    5620 },{"../view.js":51}],49:[function(require,module,exports){
     5469},{"../view.js":50}],48:[function(require,module,exports){
    56215470/**
    56225471 * wp.media.view.UploaderStatus
     
    57575606module.exports = UploaderStatus;
    57585607
    5759 },{"../view.js":51,"./status-error.js":48}],50:[function(require,module,exports){
     5608},{"../view.js":50,"./status-error.js":47}],49:[function(require,module,exports){
    57605609/**
    57615610 * wp.media.view.UploaderWindow
     
    58695718module.exports = UploaderWindow;
    58705719
    5871 },{"../view.js":51}],51:[function(require,module,exports){
     5720},{"../view.js":50}],50:[function(require,module,exports){
    58725721/**
    58735722 * wp.media.View
  • trunk/src/wp-includes/js/media/views/attachment/details-two-column.js

    r31399 r31487  
     1/*globals wp */
     2
    13/**
    24 * A similar view to media.view.Attachment.Details
     
    1113 */
    1214var Details = require( './details.js' ),
    13     MediaDetails = require( '../media-details.js' ),
    1415    TwoColumn;
    1516
     
    3233        wp.media.mixin.removeAllPlayers();
    3334        this.$( 'audio, video' ).each( function (i, elem) {
    34             var el = MediaDetails.prepareSrc( elem );
     35            var el = wp.media.view.MediaDetails.prepareSrc( elem );
    3536            new window.MediaElementPlayer( el, wp.media.mixin.mejsSettings );
    3637        } );
  • trunk/src/wp-includes/js/media/views/media-details.js

    r31399 r31487  
    7777    },
    7878
     79    loadPlayer: function () {
     80        this.players.push( new MediaElementPlayer( this.media, this.settings ) );
     81        this.scriptXhr = false;
     82    },
     83
    7984    /**
    8085     * @global MediaElementPlayer
    8186     */
    8287    setPlayer : function() {
    83         if ( ! this.players.length && this.media ) {
    84             this.players.push( new window.MediaElementPlayer( this.media, this.settings ) );
     88        var baseSettings;
     89
     90        if ( this.players.length || ! this.media || this.scriptXhr ) {
     91            return;
     92        }
     93
     94        if ( this.media.src.indexOf( 'vimeo' ) && ! ( 'Froogaloop' in window ) ) {
     95            baseSettings = wp.media.mixin.mejsSettings;
     96            this.scriptXhr = $.getScript( baseSettings.pluginPath + 'froogaloop.min.js', _.bind( this.loadPlayer, this ) );
     97        } else {
     98            this.loadPlayer();
    8599        }
    86100    },
  • trunk/src/wp-includes/js/media/views/video-details.js

    r31399 r31487  
    2525            }
    2626
    27             if ( ! video.hasClass('youtube-video') ) {
     27            if ( ! video.hasClass( 'youtube-video' ) && ! video.hasClass( 'vimeo-video' ) ) {
    2828                this.media = MediaDetails.prepareSrc( video.get(0) );
    2929            } else {
Note: See TracChangeset for help on using the changeset viewer.