Changeset 31487
- Timestamp:
- 02/22/2015 05:38:00 AM (10 years ago)
- 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 4083 4083 }, 4084 4084 4085 loadPlayer: function () { 4086 this.players.push( new MediaElementPlayer( this.media, this.settings ) ); 4087 this.scriptXhr = false; 4088 }, 4089 4085 4090 /** 4086 4091 * @global MediaElementPlayer 4087 4092 */ 4088 4093 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(); 4091 4105 } 4092 4106 }, … … 5962 5976 } 5963 5977 5964 if ( ! video.hasClass( 'youtube-video') ) {5978 if ( ! video.hasClass( 'youtube-video' ) && ! video.hasClass( 'vimeo-video' ) ) { 5965 5979 this.media = MediaDetails.prepareSrc( video.get(0) ); 5966 5980 } else { -
trunk/src/wp-includes/js/media/grid.js
r31399 r31487 106 106 module.exports = EditImage; 107 107 108 },{"../views/toolbar.js":4 6,"./state.js":6}],3:[function(require,module,exports){108 },{"../views/toolbar.js":45,"./state.js":6}],3:[function(require,module,exports){ 109 109 /** 110 110 * wp.media.controller.Library … … 1134 1134 module.exports = AttachmentCompat; 1135 1135 1136 },{"./view.js":5 1}],11:[function(require,module,exports){1136 },{"./view.js":50}],11:[function(require,module,exports){ 1137 1137 /** 1138 1138 * wp.media.view.AttachmentFilters … … 1212 1212 module.exports = AttachmentFilters; 1213 1213 1214 },{"./view.js":5 1}],12:[function(require,module,exports){1214 },{"./view.js":50}],12:[function(require,module,exports){ 1215 1215 /** 1216 1216 * wp.media.view.AttachmentFilters.All … … 1959 1959 module.exports = Attachment; 1960 1960 1961 },{"./view.js":51}],16:[function(require,module,exports){ 1961 },{"./view.js":50}],16:[function(require,module,exports){ 1962 /*globals wp */ 1963 1962 1964 /** 1963 1965 * A similar view to media.view.Attachment.Details … … 1972 1974 */ 1973 1975 var Details = require( './details.js' ), 1974 MediaDetails = require( '../media-details.js' ),1975 1976 TwoColumn; 1976 1977 … … 1993 1994 wp.media.mixin.removeAllPlayers(); 1994 1995 this.$( 'audio, video' ).each( function (i, elem) { 1995 var el = MediaDetails.prepareSrc( elem );1996 var el = wp.media.view.MediaDetails.prepareSrc( elem ); 1996 1997 new window.MediaElementPlayer( el, wp.media.mixin.mejsSettings ); 1997 1998 } ); … … 2001 2002 module.exports = TwoColumn; 2002 2003 2003 },{". ./media-details.js":33,"./details.js":17}],17:[function(require,module,exports){2004 },{"./details.js":17}],17:[function(require,module,exports){ 2004 2005 /** 2005 2006 * wp.media.view.Attachment.Details … … 2462 2463 module.exports = Attachments; 2463 2464 2464 },{"./attachment.js":15,"./view.js":5 1}],20:[function(require,module,exports){2465 },{"./attachment.js":15,"./view.js":50}],20:[function(require,module,exports){ 2465 2466 /** 2466 2467 * wp.media.view.AttachmentsBrowser … … 2921 2922 module.exports = AttachmentsBrowser; 2922 2923 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":4 1,"../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){ 2924 2925 /** 2925 2926 * wp.media.view.Button … … 3010 3011 module.exports = Button; 3011 3012 3012 },{"./view.js":5 1}],22:[function(require,module,exports){3013 },{"./view.js":50}],22:[function(require,module,exports){ 3013 3014 /** 3014 3015 * When MEDIA_TRASH is true, a button that handles bulk Delete Permanently logic … … 3187 3188 module.exports = Details; 3188 3189 3189 },{"./edit-image.js":26,"./view.js":5 1}],26:[function(require,module,exports){3190 },{"./edit-image.js":26,"./view.js":50}],26:[function(require,module,exports){ 3190 3191 var View = require( './view.js' ), 3191 3192 EditImage; … … 3240 3241 module.exports = EditImage; 3241 3242 3242 },{"./view.js":5 1}],27:[function(require,module,exports){3243 },{"./view.js":50}],27:[function(require,module,exports){ 3243 3244 /** 3244 3245 * wp.media.view.FocusManager … … 3289 3290 module.exports = FocusManager; 3290 3291 3291 },{"./view.js":5 1}],28:[function(require,module,exports){3292 },{"./view.js":50}],28:[function(require,module,exports){ 3292 3293 /** 3293 3294 * wp.media.view.Frame … … 3461 3462 module.exports = Frame; 3462 3463 3463 },{"../controllers/region.js":4,"../controllers/state-machine.js":5,"../controllers/state.js":6,"./view.js":5 1}],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){ 3464 3465 /** 3465 3466 * A frame for editing the details of a specific media item. … … 3707 3708 module.exports = EditAttachments; 3708 3709 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":3 4,"../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){ 3710 3711 /** 3711 3712 * wp.media.view.MediaFrame.Manage … … 3954 3955 module.exports = Manage; 3955 3956 3956 },{"../../controllers/library.js":3,"../../routers/manage.js":8,"../attachments/browser.js":20,"../media-frame.js":3 4,"../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){ 3957 3958 /** 3958 3959 * wp.media.view.Iframe … … 3981 3982 module.exports = Iframe; 3982 3983 3983 },{"./view.js":5 1}],32:[function(require,module,exports){3984 },{"./view.js":50}],32:[function(require,module,exports){ 3984 3985 /** 3985 3986 * @class … … 4008 4009 module.exports = Label; 4009 4010 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){ 4163 4012 /** 4164 4013 * wp.media.view.MediaFrame … … 4414 4263 module.exports = MediaFrame; 4415 4264 4416 },{"./frame.js":28,"./iframe.js":31,"./menu.js":3 6,"./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){ 4417 4266 /** 4418 4267 * wp.media.view.MenuItem … … 4487 4336 module.exports = MenuItem; 4488 4337 4489 },{"./view.js":5 1}],36:[function(require,module,exports){4338 },{"./view.js":50}],35:[function(require,module,exports){ 4490 4339 /** 4491 4340 * wp.media.view.Menu … … 4604 4453 module.exports = Menu; 4605 4454 4606 },{"./menu-item.js":3 5,"./priority-list.js":38}],37:[function(require,module,exports){4455 },{"./menu-item.js":34,"./priority-list.js":37}],36:[function(require,module,exports){ 4607 4456 /** 4608 4457 * wp.media.view.Modal … … 4819 4668 module.exports = Modal; 4820 4669 4821 },{"./focus-manager.js":27,"./view.js":5 1}],38:[function(require,module,exports){4670 },{"./focus-manager.js":27,"./view.js":50}],37:[function(require,module,exports){ 4822 4671 /** 4823 4672 * wp.media.view.PriorityList … … 4919 4768 module.exports = PriorityList; 4920 4769 4921 },{"./view.js":5 1}],39:[function(require,module,exports){4770 },{"./view.js":50}],38:[function(require,module,exports){ 4922 4771 /** 4923 4772 * wp.media.view.RouterItem … … 4946 4795 module.exports = RouterItem; 4947 4796 4948 },{"./menu-item.js":3 5}],40:[function(require,module,exports){4797 },{"./menu-item.js":34}],39:[function(require,module,exports){ 4949 4798 /** 4950 4799 * wp.media.view.Router … … 4984 4833 module.exports = Router; 4985 4834 4986 },{"./menu.js":3 6,"./router-item.js":39}],41:[function(require,module,exports){4835 },{"./menu.js":35,"./router-item.js":38}],40:[function(require,module,exports){ 4987 4836 /** 4988 4837 * wp.media.view.Search … … 5033 4882 module.exports = Search; 5034 4883 5035 },{"./view.js":5 1}],42:[function(require,module,exports){4884 },{"./view.js":50}],41:[function(require,module,exports){ 5036 4885 /** 5037 4886 * wp.media.view.Settings … … 5154 5003 module.exports = Settings; 5155 5004 5156 },{"./view.js":5 1}],43:[function(require,module,exports){5005 },{"./view.js":50}],42:[function(require,module,exports){ 5157 5006 /** 5158 5007 * wp.media.view.Settings.AttachmentDisplay … … 5248 5097 module.exports = AttachmentDisplay; 5249 5098 5250 },{"../settings.js":4 2}],44:[function(require,module,exports){5099 },{"../settings.js":41}],43:[function(require,module,exports){ 5251 5100 /** 5252 5101 * wp.media.view.Sidebar … … 5267 5116 module.exports = Sidebar; 5268 5117 5269 },{"./priority-list.js":3 8}],45:[function(require,module,exports){5118 },{"./priority-list.js":37}],44:[function(require,module,exports){ 5270 5119 /** 5271 5120 * wp.media.view.Spinner … … 5305 5154 module.exports = Spinner; 5306 5155 5307 },{"./view.js":5 1}],46:[function(require,module,exports){5156 },{"./view.js":50}],45:[function(require,module,exports){ 5308 5157 /** 5309 5158 * wp.media.view.Toolbar … … 5467 5316 module.exports = Toolbar; 5468 5317 5469 },{"./button.js":21,"./priority-list.js":3 8,"./view.js":51}],47:[function(require,module,exports){5318 },{"./button.js":21,"./priority-list.js":37,"./view.js":50}],46:[function(require,module,exports){ 5470 5319 /** 5471 5320 * wp.media.view.UploaderInline … … 5599 5448 module.exports = UploaderInline; 5600 5449 5601 },{"../view.js":5 1,"./status.js":49}],48:[function(require,module,exports){5450 },{"../view.js":50,"./status.js":48}],47:[function(require,module,exports){ 5602 5451 /** 5603 5452 * wp.media.view.UploaderStatusError … … 5618 5467 module.exports = UploaderStatusError; 5619 5468 5620 },{"../view.js":5 1}],49:[function(require,module,exports){5469 },{"../view.js":50}],48:[function(require,module,exports){ 5621 5470 /** 5622 5471 * wp.media.view.UploaderStatus … … 5757 5606 module.exports = UploaderStatus; 5758 5607 5759 },{"../view.js":5 1,"./status-error.js":48}],50:[function(require,module,exports){5608 },{"../view.js":50,"./status-error.js":47}],49:[function(require,module,exports){ 5760 5609 /** 5761 5610 * wp.media.view.UploaderWindow … … 5869 5718 module.exports = UploaderWindow; 5870 5719 5871 },{"../view.js":5 1}],51:[function(require,module,exports){5720 },{"../view.js":50}],50:[function(require,module,exports){ 5872 5721 /** 5873 5722 * wp.media.View -
trunk/src/wp-includes/js/media/views/attachment/details-two-column.js
r31399 r31487 1 /*globals wp */ 2 1 3 /** 2 4 * A similar view to media.view.Attachment.Details … … 11 13 */ 12 14 var Details = require( './details.js' ), 13 MediaDetails = require( '../media-details.js' ),14 15 TwoColumn; 15 16 … … 32 33 wp.media.mixin.removeAllPlayers(); 33 34 this.$( 'audio, video' ).each( function (i, elem) { 34 var el = MediaDetails.prepareSrc( elem );35 var el = wp.media.view.MediaDetails.prepareSrc( elem ); 35 36 new window.MediaElementPlayer( el, wp.media.mixin.mejsSettings ); 36 37 } ); -
trunk/src/wp-includes/js/media/views/media-details.js
r31399 r31487 77 77 }, 78 78 79 loadPlayer: function () { 80 this.players.push( new MediaElementPlayer( this.media, this.settings ) ); 81 this.scriptXhr = false; 82 }, 83 79 84 /** 80 85 * @global MediaElementPlayer 81 86 */ 82 87 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(); 85 99 } 86 100 }, -
trunk/src/wp-includes/js/media/views/video-details.js
r31399 r31487 25 25 } 26 26 27 if ( ! video.hasClass( 'youtube-video') ) {27 if ( ! video.hasClass( 'youtube-video' ) && ! video.hasClass( 'vimeo-video' ) ) { 28 28 this.media = MediaDetails.prepareSrc( video.get(0) ); 29 29 } else {
Note: See TracChangeset
for help on using the changeset viewer.