Media JS files:

* In media manifests, ditch IIFEs and global injection, these get dynamically scoped via Browserify
* Remove the `debug` option from `browserify:media`
* Add `jshint:media` to `jshint:corejs`
* Add a trailing newline to all new module files

Props iseulde.
See #28510.

Built from https://develop.svn.wordpress.org/trunk@31385


git-svn-id: http://core.svn.wordpress.org/trunk@31366 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2015-02-09 16:01:29 +00:00
parent 941075c8ca
commit b191013198
106 changed files with 1462 additions and 1749 deletions

View File

@ -1,231 +1,221 @@
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
/* global wp, _wpMediaViewsL10n, _wpmejsSettings, MediaElementPlayer */
var media = wp.media,
baseSettings = window._wpmejsSettings || {},
l10n = window._wpMediaViewsL10n || {};
(function(_) {
var media = wp.media,
baseSettings = {},
l10n = typeof _wpMediaViewsL10n === 'undefined' ? {} : _wpMediaViewsL10n;
/**
* @mixin
*/
wp.media.mixin = {
mejsSettings: baseSettings,
if ( ! _.isUndefined( window._wpmejsSettings ) ) {
baseSettings = _wpmejsSettings;
removeAllPlayers: function() {
var p;
if ( window.mejs && window.mejs.players ) {
for ( p in window.mejs.players ) {
window.mejs.players[p].pause();
this.removePlayer( window.mejs.players[p] );
}
}
},
/**
* Override the MediaElement method for removing a player.
* MediaElement tries to pull the audio/video tag out of
* its container and re-add it to the DOM.
*/
removePlayer: function(t) {
var featureIndex, feature;
if ( ! t.options ) {
return;
}
// invoke features cleanup
for ( featureIndex in t.options.features ) {
feature = t.options.features[featureIndex];
if ( t['clean' + feature] ) {
try {
t['clean' + feature](t);
} catch (e) {}
}
}
if ( ! t.isDynamic ) {
t.$node.remove();
}
if ( 'native' !== t.media.pluginType ) {
t.media.remove();
}
delete window.mejs.players[t.id];
t.container.remove();
t.globalUnbind();
delete t.node.player;
},
/**
* Allows any class that has set 'player' to a MediaElementPlayer
* instance to remove the player when listening to events.
*
* Examples: modal closes, shortcode properties are removed, etc.
*/
unsetPlayers : function() {
if ( this.players && this.players.length ) {
_.each( this.players, function (player) {
player.pause();
wp.media.mixin.removePlayer( player );
} );
this.players = [];
}
}
};
/**
* @mixin
*/
wp.media.mixin = {
mejsSettings: baseSettings,
/**
* Autowire "collection"-type shortcodes
*/
wp.media.playlist = new wp.media.collection({
tag: 'playlist',
editTitle : l10n.editPlaylistTitle,
defaults : {
id: wp.media.view.settings.post.id,
style: 'light',
tracklist: true,
tracknumbers: true,
images: true,
artists: true,
type: 'audio'
}
});
removeAllPlayers: function() {
var p;
/**
* Shortcode modeling for audio
* `edit()` prepares the shortcode for the media modal
* `shortcode()` builds the new shortcode after update
*
* @namespace
*/
wp.media.audio = {
coerce : wp.media.coerce,
if ( window.mejs && window.mejs.players ) {
for ( p in window.mejs.players ) {
window.mejs.players[p].pause();
this.removePlayer( window.mejs.players[p] );
}
defaults : {
id : wp.media.view.settings.post.id,
src : '',
loop : false,
autoplay : false,
preload : 'none',
width : 400
},
edit : function( data ) {
var frame, shortcode = wp.shortcode.next( 'audio', data ).shortcode;
frame = wp.media({
frame: 'audio',
state: 'audio-details',
metadata: _.defaults( shortcode.attrs.named, this.defaults )
});
return frame;
},
shortcode : function( model ) {
var content;
_.each( this.defaults, function( value, key ) {
model[ key ] = this.coerce( model, key );
if ( value === model[ key ] ) {
delete model[ key ];
}
},
}, this );
/**
* Override the MediaElement method for removing a player.
* MediaElement tries to pull the audio/video tag out of
* its container and re-add it to the DOM.
*/
removePlayer: function(t) {
var featureIndex, feature;
content = model.content;
delete model.content;
if ( ! t.options ) {
return;
return new wp.shortcode({
tag: 'audio',
attrs: model,
content: content
});
}
};
/**
* Shortcode modeling for video
* `edit()` prepares the shortcode for the media modal
* `shortcode()` builds the new shortcode after update
*
* @namespace
*/
wp.media.video = {
coerce : wp.media.coerce,
defaults : {
id : wp.media.view.settings.post.id,
src : '',
poster : '',
loop : false,
autoplay : false,
preload : 'metadata',
content : '',
width : 640,
height : 360
},
edit : function( data ) {
var frame,
shortcode = wp.shortcode.next( 'video', data ).shortcode,
attrs;
attrs = shortcode.attrs.named;
attrs.content = shortcode.content;
frame = wp.media({
frame: 'video',
state: 'video-details',
metadata: _.defaults( attrs, this.defaults )
});
return frame;
},
shortcode : function( model ) {
var content;
_.each( this.defaults, function( value, key ) {
model[ key ] = this.coerce( model, key );
if ( value === model[ key ] ) {
delete model[ key ];
}
}, this );
// invoke features cleanup
for ( featureIndex in t.options.features ) {
feature = t.options.features[featureIndex];
if ( t['clean' + feature] ) {
try {
t['clean' + feature](t);
} catch (e) {}
}
}
content = model.content;
delete model.content;
if ( ! t.isDynamic ) {
t.$node.remove();
}
return new wp.shortcode({
tag: 'video',
attrs: model,
content: content
});
}
};
if ( 'native' !== t.media.pluginType ) {
t.media.remove();
}
media.model.PostMedia = require( './models/post-media.js' );
media.controller.AudioDetails = require( './controllers/audio-details.js' );
media.controller.VideoDetails = require( './controllers/video-details.js' );
media.view.MediaFrame.MediaDetails = require( './views/frame/media-details.js' );
media.view.MediaFrame.AudioDetails = require( './views/frame/audio-details.js' );
media.view.MediaFrame.VideoDetails = require( './views/frame/video-details.js' );
media.view.MediaDetails = require( './views/media-details.js' );
media.view.AudioDetails = require( './views/audio-details.js' );
media.view.VideoDetails = require( './views/video-details.js' );
delete window.mejs.players[t.id];
t.container.remove();
t.globalUnbind();
delete t.node.player;
},
/**
* Allows any class that has set 'player' to a MediaElementPlayer
* instance to remove the player when listening to events.
*
* Examples: modal closes, shortcode properties are removed, etc.
*/
unsetPlayers : function() {
if ( this.players && this.players.length ) {
_.each( this.players, function (player) {
player.pause();
wp.media.mixin.removePlayer( player );
} );
this.players = [];
}
}
};
/**
* Autowire "collection"-type shortcodes
*/
wp.media.playlist = new wp.media.collection({
tag: 'playlist',
editTitle : l10n.editPlaylistTitle,
defaults : {
id: wp.media.view.settings.post.id,
style: 'light',
tracklist: true,
tracknumbers: true,
images: true,
artists: true,
type: 'audio'
}
});
/**
* Shortcode modeling for audio
* `edit()` prepares the shortcode for the media modal
* `shortcode()` builds the new shortcode after update
*
* @namespace
*/
wp.media.audio = {
coerce : wp.media.coerce,
defaults : {
id : wp.media.view.settings.post.id,
src : '',
loop : false,
autoplay : false,
preload : 'none',
width : 400
},
edit : function( data ) {
var frame, shortcode = wp.shortcode.next( 'audio', data ).shortcode;
frame = wp.media({
frame: 'audio',
state: 'audio-details',
metadata: _.defaults( shortcode.attrs.named, this.defaults )
});
return frame;
},
shortcode : function( model ) {
var content;
_.each( this.defaults, function( value, key ) {
model[ key ] = self.coerce( model, key );
if ( value === model[ key ] ) {
delete model[ key ];
}
}, this );
content = model.content;
delete model.content;
return new wp.shortcode({
tag: 'audio',
attrs: model,
content: content
});
}
};
/**
* Shortcode modeling for video
* `edit()` prepares the shortcode for the media modal
* `shortcode()` builds the new shortcode after update
*
* @namespace
*/
wp.media.video = {
coerce : wp.media.coerce,
defaults : {
id : wp.media.view.settings.post.id,
src : '',
poster : '',
loop : false,
autoplay : false,
preload : 'metadata',
content : '',
width : 640,
height : 360
},
edit : function( data ) {
var frame,
shortcode = wp.shortcode.next( 'video', data ).shortcode,
attrs;
attrs = shortcode.attrs.named;
attrs.content = shortcode.content;
frame = wp.media({
frame: 'video',
state: 'video-details',
metadata: _.defaults( attrs, this.defaults )
});
return frame;
},
shortcode : function( model ) {
var content;
_.each( this.defaults, function( value, key ) {
model[ key ] = this.coerce( model, key );
if ( value === model[ key ] ) {
delete model[ key ];
}
}, this );
content = model.content;
delete model.content;
return new wp.shortcode({
tag: 'video',
attrs: model,
content: content
});
}
};
media.model.PostMedia = require( './models/post-media.js' );
media.controller.AudioDetails = require( './controllers/audio-details.js' );
media.controller.VideoDetails = require( './controllers/video-details.js' );
media.view.MediaFrame.MediaDetails = require( './views/frame/media-details.js' );
media.view.MediaFrame.AudioDetails = require( './views/frame/audio-details.js' );
media.view.MediaFrame.VideoDetails = require( './views/frame/video-details.js' );
media.view.MediaDetails = require( './views/media-details.js' );
media.view.AudioDetails = require( './views/audio-details.js' );
media.view.VideoDetails = require( './views/video-details.js' );
}(_));
},{"./controllers/audio-details.js":2,"./controllers/video-details.js":8,"./models/post-media.js":9,"./views/audio-details.js":21,"./views/frame/audio-details.js":25,"./views/frame/media-details.js":26,"./views/frame/video-details.js":28,"./views/media-details.js":31,"./views/video-details.js":50}],2:[function(require,module,exports){
/*globals wp */
/**
* The controller for the Audio Details state
*
@ -255,9 +245,8 @@ AudioDetails = State.extend({
});
module.exports = AudioDetails;
},{"./state.js":7}],3:[function(require,module,exports){
/*globals _, wp, Backbone, getUserSetting, setUserSetting */
},{"./state.js":7}],3:[function(require,module,exports){
/**
* wp.media.controller.Library
*
@ -295,6 +284,8 @@ module.exports = AudioDetails;
var selectionSync = require( '../utils/selection-sync.js' ),
State = require( './state.js' ),
l10n = wp.media.view.l10n,
getUserSetting = window.getUserSetting,
setUserSetting = window.setUserSetting,
Library;
Library = State.extend({
@ -329,7 +320,7 @@ Library = State.extend({
this.set( 'library', wp.media.query() );
}
if ( ! (selection instanceof Selection) ) {
if ( ! ( selection instanceof wp.media.model.Selection ) ) {
props = selection;
if ( ! props ) {
@ -528,9 +519,8 @@ Library = State.extend({
_.extend( Library.prototype, selectionSync );
module.exports = Library;
},{"../utils/selection-sync.js":10,"./state.js":7}],4:[function(require,module,exports){
/*globals _, wp */
},{"../utils/selection-sync.js":10,"./state.js":7}],4:[function(require,module,exports){
/**
* wp.media.controller.MediaLibrary
*
@ -579,9 +569,8 @@ MediaLibrary = Library.extend({
});
module.exports = MediaLibrary;
},{"./library.js":3}],5:[function(require,module,exports){
/*globals _, Backbone */
},{"./library.js":3}],5:[function(require,module,exports){
/**
* wp.media.controller.Region
*
@ -759,9 +748,8 @@ _.extend( Region.prototype, {
});
module.exports = Region;
},{}],6:[function(require,module,exports){
/*globals _, Backbone */
},{}],6:[function(require,module,exports){
/**
* wp.media.controller.StateMachine
*
@ -884,9 +872,8 @@ _.each([ 'on', 'off', 'trigger' ], function( method ) {
});
module.exports = StateMachine;
},{}],7:[function(require,module,exports){
/*globals _, Backbone */
},{}],7:[function(require,module,exports){
/**
* wp.media.controller.State
*
@ -1126,9 +1113,8 @@ _.each(['toolbar','content'], function( region ) {
});
module.exports = State;
},{}],8:[function(require,module,exports){
/*globals wp */
},{}],8:[function(require,module,exports){
/**
* The controller for the Video Details state
*
@ -1158,9 +1144,8 @@ VideoDetails = State.extend({
});
module.exports = VideoDetails;
},{"./state.js":7}],9:[function(require,module,exports){
/*globals Backbone, _, wp */
},{"./state.js":7}],9:[function(require,module,exports){
/**
* Shared model class for audio and video. Updates the model after
* "Add Audio|Video Source" and "Replace Audio|Video" states return
@ -1199,9 +1184,8 @@ var PostMedia = Backbone.Model.extend({
});
module.exports = PostMedia;
},{}],10:[function(require,module,exports){
/*globals _ */
},{}],10:[function(require,module,exports){
/**
* wp.media.selectionSync
*
@ -1266,9 +1250,8 @@ var selectionSync = {
};
module.exports = selectionSync;
},{}],11:[function(require,module,exports){
/*globals _ */
},{}],11:[function(require,module,exports){
/**
* wp.media.view.AttachmentCompat
*
@ -1352,9 +1335,8 @@ AttachmentCompat = View.extend({
});
module.exports = AttachmentCompat;
},{"./view.js":51}],12:[function(require,module,exports){
/*globals _, jQuery */
},{"./view.js":51}],12:[function(require,module,exports){
/**
* wp.media.view.AttachmentFilters
*
@ -1431,9 +1413,8 @@ AttachmentFilters = View.extend({
});
module.exports = AttachmentFilters;
},{"./view.js":51}],13:[function(require,module,exports){
/*globals _, wp */
},{"./view.js":51}],13:[function(require,module,exports){
/**
* wp.media.view.AttachmentFilters.All
*
@ -1523,9 +1504,8 @@ All = AttachmentFilters.extend({
});
module.exports = All;
},{"../attachment-filters.js":12}],14:[function(require,module,exports){
/*globals _, wp */
},{"../attachment-filters.js":12}],14:[function(require,module,exports){
/**
* A filter dropdown for month/dates.
*
@ -1566,9 +1546,8 @@ DateFilter = AttachmentFilters.extend({
});
module.exports = DateFilter;
},{"../attachment-filters.js":12}],15:[function(require,module,exports){
/*globals wp */
},{"../attachment-filters.js":12}],15:[function(require,module,exports){
/**
* wp.media.view.AttachmentFilters.Uploaded
*
@ -1627,9 +1606,8 @@ Uploaded = AttachmentFilters.extend({
});
module.exports = Uploaded;
},{"../attachment-filters.js":12}],16:[function(require,module,exports){
/*globals _, wp, jQuery */
},{"../attachment-filters.js":12}],16:[function(require,module,exports){
/**
* wp.media.view.Attachment
*
@ -2182,9 +2160,8 @@ _.each({
});
module.exports = Attachment;
},{"./view.js":51}],17:[function(require,module,exports){
/*globals _, wp */
},{"./view.js":51}],17:[function(require,module,exports){
/**
* wp.media.view.Attachment.Details
*
@ -2244,7 +2221,7 @@ Details = Attachment.extend({
deleteAttachment: function( event ) {
event.preventDefault();
if ( confirm( l10n.warnDelete ) ) {
if ( window.confirm( l10n.warnDelete ) ) {
this.model.destroy();
// Keep focus inside media modal
// after image is deleted
@ -2323,6 +2300,7 @@ Details = Attachment.extend({
});
module.exports = Details;
},{"../attachment.js":16}],18:[function(require,module,exports){
/**
* wp.media.view.Attachment.Library
@ -2343,9 +2321,8 @@ Library = Attachment.extend({
});
module.exports = Library;
},{"../attachment.js":16}],19:[function(require,module,exports){
/*globals _, wp, jQuery */
},{"../attachment.js":16}],19:[function(require,module,exports){
/**
* wp.media.view.Attachments
*
@ -2618,7 +2595,7 @@ Attachments = View.extend({
// The scroll event occurs on the document, but the element
// that should be checked is the document body.
if ( el == document ) {
if ( el === document ) {
el = document.body;
scrollTop = $(document).scrollTop();
}
@ -2644,9 +2621,8 @@ Attachments = View.extend({
});
module.exports = Attachments;
},{"./attachment.js":16,"./view.js":51}],20:[function(require,module,exports){
/*globals _, wp, jQuery */
},{"./attachment.js":16,"./view.js":51}],20:[function(require,module,exports){
/**
* wp.media.view.AttachmentsBrowser
*
@ -2837,13 +2813,13 @@ AttachmentsBrowser = View.extend({
return;
}
if ( ! mediaTrash && ! confirm( l10n.warnBulkDelete ) ) {
if ( ! mediaTrash && ! window.confirm( l10n.warnBulkDelete ) ) {
return;
}
if ( mediaTrash &&
'trash' !== selection.at( 0 ).get( 'status' ) &&
! confirm( l10n.warnBulkTrash ) ) {
! window.confirm( l10n.warnBulkTrash ) ) {
return;
}
@ -2891,7 +2867,7 @@ AttachmentsBrowser = View.extend({
click: function() {
var removed = [], selection = this.controller.state().get( 'selection' );
if ( ! selection.length || ! confirm( l10n.warnBulkDelete ) ) {
if ( ! selection.length || ! window.confirm( l10n.warnBulkDelete ) ) {
return;
}
@ -3104,9 +3080,8 @@ AttachmentsBrowser = View.extend({
});
module.exports = AttachmentsBrowser;
},{"../attachment-compat.js":11,"../attachment-filters/all.js":13,"../attachment-filters/date.js":14,"../attachment-filters/uploaded.js":15,"../attachment/details.js":17,"../attachment/library.js":18,"../attachments.js":19,"../label.js":30,"../search.js":39,"../settings/attachment-display.js":41,"../sidebar.js":42,"../spinner.js":43,"../toolbar.js":44,"../uploader/inline.js":46,"../uploader/status.js":48,"../view.js":51}],21:[function(require,module,exports){
/*globals wp */
},{"../attachment-compat.js":11,"../attachment-filters/all.js":13,"../attachment-filters/date.js":14,"../attachment-filters/uploaded.js":15,"../attachment/details.js":17,"../attachment/library.js":18,"../attachments.js":19,"../label.js":30,"../search.js":39,"../settings/attachment-display.js":41,"../sidebar.js":42,"../spinner.js":43,"../toolbar.js":44,"../uploader/inline.js":46,"../uploader/status.js":48,"../view.js":51}],21:[function(require,module,exports){
/**
* wp.media.view.AudioDetails
*
@ -3143,9 +3118,8 @@ AudioDetails = MediaDetails.extend({
});
module.exports = AudioDetails;
},{"./media-details":31}],22:[function(require,module,exports){
/*globals _, Backbone */
},{"./media-details":31}],22:[function(require,module,exports){
/**
* wp.media.view.Button
*
@ -3233,6 +3207,7 @@ Button = View.extend({
});
module.exports = Button;
},{"./view.js":51}],23:[function(require,module,exports){
/**
* wp.media.view.FocusManager
@ -3281,9 +3256,8 @@ FocusManager = View.extend({
});
module.exports = FocusManager;
},{"./view.js":51}],24:[function(require,module,exports){
/*globals _, Backbone */
},{"./view.js":51}],24:[function(require,module,exports){
/**
* wp.media.view.Frame
*
@ -3454,9 +3428,8 @@ Frame = View.extend({
_.extend( Frame.prototype, StateMachine.prototype );
module.exports = Frame;
},{"../controllers/region.js":5,"../controllers/state-machine.js":6,"../controllers/state.js":7,"./view.js":51}],25:[function(require,module,exports){
/*globals wp */
},{"../controllers/region.js":5,"../controllers/state-machine.js":6,"../controllers/state.js":7,"./view.js":51}],25:[function(require,module,exports){
/**
* wp.media.view.MediaFrame.AudioDetails
*
@ -3532,9 +3505,8 @@ AudioDetails = MediaDetails.extend({
});
module.exports = AudioDetails;
},{"../../controllers/audio-details.js":2,"../../controllers/media-library.js":4,"../audio-details.js":21,"./media-details":26}],26:[function(require,module,exports){
/*globals wp */
},{"../../controllers/audio-details.js":2,"../../controllers/media-library.js":4,"../audio-details.js":21,"./media-details":26}],26:[function(require,module,exports){
/**
* wp.media.view.MediaFrame.MediaDetails
*
@ -3665,9 +3637,8 @@ MediaDetails = Select.extend({
});
module.exports = MediaDetails;
},{"../toolbar.js":44,"../view.js":51,"./select.js":27}],27:[function(require,module,exports){
/*globals _, wp */
},{"../toolbar.js":44,"../view.js":51,"./select.js":27}],27:[function(require,module,exports){
/**
* wp.media.view.MediaFrame.Select
*
@ -3840,9 +3811,8 @@ Select = MediaFrame.extend({
});
module.exports = Select;
},{"../../controllers/library.js":3,"../attachments/browser.js":20,"../media-frame.js":32,"../toolbar/select.js":45,"../uploader/inline.js":46}],28:[function(require,module,exports){
/*globals _, wp */
},{"../../controllers/library.js":3,"../attachments/browser.js":20,"../media-frame.js":32,"../toolbar/select.js":45,"../uploader/inline.js":46}],28:[function(require,module,exports){
/**
* wp.media.view.MediaFrame.VideoDetails
*
@ -3978,6 +3948,7 @@ VideoDetails = MediaDetails.extend({
});
module.exports = VideoDetails;
},{"../../controllers/media-library.js":4,"../../controllers/video-details.js":8,"../video-details.js":50,"./media-details":26}],29:[function(require,module,exports){
/**
* wp.media.view.Iframe
@ -4004,6 +3975,7 @@ Iframe = View.extend({
});
module.exports = Iframe;
},{"./view.js":51}],30:[function(require,module,exports){
/**
* @class
@ -4030,9 +4002,8 @@ Label = View.extend({
});
module.exports = Label;
},{"./view.js":51}],31:[function(require,module,exports){
/*globals _, wp, jQuery */
},{"./view.js":51}],31:[function(require,module,exports){
/**
* wp.media.view.MediaDetails
*
@ -4116,7 +4087,7 @@ MediaDetails = AttachmentDisplay.extend({
*/
setPlayer : function() {
if ( ! this.players.length && this.media ) {
this.players.push( new MediaElementPlayer( this.media, this.settings ) );
this.players.push( new window.MediaElementPlayer( this.media, this.settings ) );
}
},
@ -4144,7 +4115,7 @@ MediaDetails = AttachmentDisplay.extend({
*/
render: function() {
AttachmentDisplay.prototype.render.apply( this, arguments );
setTimeout( _.bind( function() {
this.resetFocus();
}, this ), 10 );
@ -4183,9 +4154,8 @@ MediaDetails = AttachmentDisplay.extend({
});
module.exports = MediaDetails;
},{"./settings/attachment-display.js":41}],32:[function(require,module,exports){
/*globals _, wp, jQuery */
},{"./settings/attachment-display.js":41}],32:[function(require,module,exports){
/**
* wp.media.view.MediaFrame
*
@ -4438,9 +4408,8 @@ _.each(['open','close','attach','detach','escape'], function( method ) {
});
module.exports = MediaFrame;
},{"./frame.js":24,"./iframe.js":29,"./menu.js":34,"./modal.js":35,"./router.js":38,"./toolbar.js":44,"./uploader/window.js":49,"./view.js":51}],33:[function(require,module,exports){
/*globals wp, jQuery */
},{"./frame.js":24,"./iframe.js":29,"./menu.js":34,"./modal.js":35,"./router.js":38,"./toolbar.js":44,"./uploader/window.js":49,"./view.js":51}],33:[function(require,module,exports){
/**
* wp.media.view.MenuItem
*
@ -4512,6 +4481,7 @@ MenuItem = View.extend({
});
module.exports = MenuItem;
},{"./view.js":51}],34:[function(require,module,exports){
/**
* wp.media.view.Menu
@ -4628,9 +4598,8 @@ Menu = PriorityList.extend({
});
module.exports = Menu;
},{"./menu-item.js":33,"./priority-list.js":36}],35:[function(require,module,exports){
/*globals _, wp, jQuery */
},{"./menu-item.js":33,"./priority-list.js":36}],35:[function(require,module,exports){
/**
* wp.media.view.Modal
*
@ -4844,9 +4813,8 @@ Modal = View.extend({
});
module.exports = Modal;
},{"./focus-manager.js":23,"./view.js":51}],36:[function(require,module,exports){
/*globals _, Backbone */
},{"./focus-manager.js":23,"./view.js":51}],36:[function(require,module,exports){
/**
* wp.media.view.PriorityList
*
@ -4945,6 +4913,7 @@ PriorityList = View.extend({
});
module.exports = PriorityList;
},{"./view.js":51}],37:[function(require,module,exports){
/**
* wp.media.view.RouterItem
@ -4971,6 +4940,7 @@ RouterItem = MenuItem.extend({
});
module.exports = RouterItem;
},{"./menu-item.js":33}],38:[function(require,module,exports){
/**
* wp.media.view.Router
@ -5008,9 +4978,8 @@ Router = Menu.extend({
});
module.exports = Router;
},{"./menu.js":34,"./router-item.js":37}],39:[function(require,module,exports){
/*globals wp */
},{"./menu.js":34,"./router-item.js":37}],39:[function(require,module,exports){
/**
* wp.media.view.Search
*
@ -5058,9 +5027,8 @@ Search = View.extend({
});
module.exports = Search;
},{"./view.js":51}],40:[function(require,module,exports){
/*globals _, Backbone, jQuery */
},{"./view.js":51}],40:[function(require,module,exports){
/**
* wp.media.view.Settings
*
@ -5168,7 +5136,7 @@ Settings = View.extend({
// If the setting has a corresponding user setting,
// update that as well.
if ( userSetting = $setting.data('userSetting') ) {
setUserSetting( userSetting, value );
window.setUserSetting( userSetting, value );
}
},
@ -5180,9 +5148,8 @@ Settings = View.extend({
});
module.exports = Settings;
},{"./view.js":51}],41:[function(require,module,exports){
/*globals _, wp */
},{"./view.js":51}],41:[function(require,module,exports){
/**
* wp.media.view.Settings.AttachmentDisplay
*
@ -5275,6 +5242,7 @@ AttachmentDisplay = Settings.extend({
});
module.exports = AttachmentDisplay;
},{"../settings.js":40}],42:[function(require,module,exports){
/**
* wp.media.view.Sidebar
@ -5293,9 +5261,8 @@ Sidebar = PriorityList.extend({
});
module.exports = Sidebar;
},{"./priority-list.js":36}],43:[function(require,module,exports){
/*globals _, wp */
},{"./priority-list.js":36}],43:[function(require,module,exports){
/**
* wp.media.view.Spinner
*
@ -5332,9 +5299,8 @@ Spinner = View.extend({
});
module.exports = Spinner;
},{"./view.js":51}],44:[function(require,module,exports){
/*globals Backbone, _ */
},{"./view.js":51}],44:[function(require,module,exports){
/**
* wp.media.view.Toolbar
*
@ -5495,9 +5461,8 @@ Toolbar = View.extend({
});
module.exports = Toolbar;
},{"./button.js":22,"./priority-list.js":36,"./view.js":51}],45:[function(require,module,exports){
/*globals _, wp */
},{"./button.js":22,"./priority-list.js":36,"./view.js":51}],45:[function(require,module,exports){
/**
* wp.media.view.Toolbar.Select
*
@ -5566,9 +5531,8 @@ Select = Toolbar.extend({
});
module.exports = Select;
},{"../toolbar.js":44}],46:[function(require,module,exports){
/*globals _, wp */
},{"../toolbar.js":44}],46:[function(require,module,exports){
/**
* wp.media.view.UploaderInline
*
@ -5699,9 +5663,8 @@ UploaderInline = View.extend({
});
module.exports = UploaderInline;
},{"../view.js":51,"./status.js":48}],47:[function(require,module,exports){
/*globals wp */
},{"../view.js":51,"./status.js":48}],47:[function(require,module,exports){
/**
* wp.media.view.UploaderStatusError
*
@ -5719,9 +5682,8 @@ UploaderStatusError = View.extend({
});
module.exports = UploaderStatusError;
},{"../view.js":51}],48:[function(require,module,exports){
/*globals _, wp */
},{"../view.js":51}],48:[function(require,module,exports){
/**
* wp.media.view.UploaderStatus
*
@ -5859,9 +5821,8 @@ UploaderStatus = View.extend({
});
module.exports = UploaderStatus;
},{"../view.js":51,"./status-error.js":47}],49:[function(require,module,exports){
/*globals _, wp, jQuery */
},{"../view.js":51,"./status-error.js":47}],49:[function(require,module,exports){
/**
* wp.media.view.UploaderWindow
*
@ -5972,9 +5933,8 @@ UploaderWindow = View.extend({
});
module.exports = UploaderWindow;
},{"../view.js":51}],50:[function(require,module,exports){
/*globals wp */
},{"../view.js":51}],50:[function(require,module,exports){
/**
* wp.media.view.VideoDetails
*
@ -6016,9 +5976,8 @@ VideoDetails = MediaDetails.extend({
});
module.exports = VideoDetails;
},{"./media-details":31}],51:[function(require,module,exports){
/*globals wp */
},{"./media-details":31}],51:[function(require,module,exports){
/**
* wp.media.View
*
@ -6083,4 +6042,5 @@ var View = wp.Backbone.View.extend({
});
module.exports = View;
},{}]},{},[1]);

View File

@ -1,224 +1,215 @@
/* global wp, _wpMediaViewsL10n, _wpmejsSettings, MediaElementPlayer */
var media = wp.media,
baseSettings = window._wpmejsSettings || {},
l10n = window._wpMediaViewsL10n || {};
(function(_) {
var media = wp.media,
baseSettings = {},
l10n = typeof _wpMediaViewsL10n === 'undefined' ? {} : _wpMediaViewsL10n;
/**
* @mixin
*/
wp.media.mixin = {
mejsSettings: baseSettings,
if ( ! _.isUndefined( window._wpmejsSettings ) ) {
baseSettings = _wpmejsSettings;
removeAllPlayers: function() {
var p;
if ( window.mejs && window.mejs.players ) {
for ( p in window.mejs.players ) {
window.mejs.players[p].pause();
this.removePlayer( window.mejs.players[p] );
}
}
},
/**
* Override the MediaElement method for removing a player.
* MediaElement tries to pull the audio/video tag out of
* its container and re-add it to the DOM.
*/
removePlayer: function(t) {
var featureIndex, feature;
if ( ! t.options ) {
return;
}
// invoke features cleanup
for ( featureIndex in t.options.features ) {
feature = t.options.features[featureIndex];
if ( t['clean' + feature] ) {
try {
t['clean' + feature](t);
} catch (e) {}
}
}
if ( ! t.isDynamic ) {
t.$node.remove();
}
if ( 'native' !== t.media.pluginType ) {
t.media.remove();
}
delete window.mejs.players[t.id];
t.container.remove();
t.globalUnbind();
delete t.node.player;
},
/**
* Allows any class that has set 'player' to a MediaElementPlayer
* instance to remove the player when listening to events.
*
* Examples: modal closes, shortcode properties are removed, etc.
*/
unsetPlayers : function() {
if ( this.players && this.players.length ) {
_.each( this.players, function (player) {
player.pause();
wp.media.mixin.removePlayer( player );
} );
this.players = [];
}
}
};
/**
* @mixin
*/
wp.media.mixin = {
mejsSettings: baseSettings,
/**
* Autowire "collection"-type shortcodes
*/
wp.media.playlist = new wp.media.collection({
tag: 'playlist',
editTitle : l10n.editPlaylistTitle,
defaults : {
id: wp.media.view.settings.post.id,
style: 'light',
tracklist: true,
tracknumbers: true,
images: true,
artists: true,
type: 'audio'
}
});
removeAllPlayers: function() {
var p;
/**
* Shortcode modeling for audio
* `edit()` prepares the shortcode for the media modal
* `shortcode()` builds the new shortcode after update
*
* @namespace
*/
wp.media.audio = {
coerce : wp.media.coerce,
if ( window.mejs && window.mejs.players ) {
for ( p in window.mejs.players ) {
window.mejs.players[p].pause();
this.removePlayer( window.mejs.players[p] );
}
defaults : {
id : wp.media.view.settings.post.id,
src : '',
loop : false,
autoplay : false,
preload : 'none',
width : 400
},
edit : function( data ) {
var frame, shortcode = wp.shortcode.next( 'audio', data ).shortcode;
frame = wp.media({
frame: 'audio',
state: 'audio-details',
metadata: _.defaults( shortcode.attrs.named, this.defaults )
});
return frame;
},
shortcode : function( model ) {
var content;
_.each( this.defaults, function( value, key ) {
model[ key ] = this.coerce( model, key );
if ( value === model[ key ] ) {
delete model[ key ];
}
},
}, this );
/**
* Override the MediaElement method for removing a player.
* MediaElement tries to pull the audio/video tag out of
* its container and re-add it to the DOM.
*/
removePlayer: function(t) {
var featureIndex, feature;
content = model.content;
delete model.content;
if ( ! t.options ) {
return;
return new wp.shortcode({
tag: 'audio',
attrs: model,
content: content
});
}
};
/**
* Shortcode modeling for video
* `edit()` prepares the shortcode for the media modal
* `shortcode()` builds the new shortcode after update
*
* @namespace
*/
wp.media.video = {
coerce : wp.media.coerce,
defaults : {
id : wp.media.view.settings.post.id,
src : '',
poster : '',
loop : false,
autoplay : false,
preload : 'metadata',
content : '',
width : 640,
height : 360
},
edit : function( data ) {
var frame,
shortcode = wp.shortcode.next( 'video', data ).shortcode,
attrs;
attrs = shortcode.attrs.named;
attrs.content = shortcode.content;
frame = wp.media({
frame: 'video',
state: 'video-details',
metadata: _.defaults( attrs, this.defaults )
});
return frame;
},
shortcode : function( model ) {
var content;
_.each( this.defaults, function( value, key ) {
model[ key ] = this.coerce( model, key );
if ( value === model[ key ] ) {
delete model[ key ];
}
}, this );
// invoke features cleanup
for ( featureIndex in t.options.features ) {
feature = t.options.features[featureIndex];
if ( t['clean' + feature] ) {
try {
t['clean' + feature](t);
} catch (e) {}
}
}
content = model.content;
delete model.content;
if ( ! t.isDynamic ) {
t.$node.remove();
}
return new wp.shortcode({
tag: 'video',
attrs: model,
content: content
});
}
};
if ( 'native' !== t.media.pluginType ) {
t.media.remove();
}
delete window.mejs.players[t.id];
t.container.remove();
t.globalUnbind();
delete t.node.player;
},
/**
* Allows any class that has set 'player' to a MediaElementPlayer
* instance to remove the player when listening to events.
*
* Examples: modal closes, shortcode properties are removed, etc.
*/
unsetPlayers : function() {
if ( this.players && this.players.length ) {
_.each( this.players, function (player) {
player.pause();
wp.media.mixin.removePlayer( player );
} );
this.players = [];
}
}
};
/**
* Autowire "collection"-type shortcodes
*/
wp.media.playlist = new wp.media.collection({
tag: 'playlist',
editTitle : l10n.editPlaylistTitle,
defaults : {
id: wp.media.view.settings.post.id,
style: 'light',
tracklist: true,
tracknumbers: true,
images: true,
artists: true,
type: 'audio'
}
});
/**
* Shortcode modeling for audio
* `edit()` prepares the shortcode for the media modal
* `shortcode()` builds the new shortcode after update
*
* @namespace
*/
wp.media.audio = {
coerce : wp.media.coerce,
defaults : {
id : wp.media.view.settings.post.id,
src : '',
loop : false,
autoplay : false,
preload : 'none',
width : 400
},
edit : function( data ) {
var frame, shortcode = wp.shortcode.next( 'audio', data ).shortcode;
frame = wp.media({
frame: 'audio',
state: 'audio-details',
metadata: _.defaults( shortcode.attrs.named, this.defaults )
});
return frame;
},
shortcode : function( model ) {
var content;
_.each( this.defaults, function( value, key ) {
model[ key ] = self.coerce( model, key );
if ( value === model[ key ] ) {
delete model[ key ];
}
}, this );
content = model.content;
delete model.content;
return new wp.shortcode({
tag: 'audio',
attrs: model,
content: content
});
}
};
/**
* Shortcode modeling for video
* `edit()` prepares the shortcode for the media modal
* `shortcode()` builds the new shortcode after update
*
* @namespace
*/
wp.media.video = {
coerce : wp.media.coerce,
defaults : {
id : wp.media.view.settings.post.id,
src : '',
poster : '',
loop : false,
autoplay : false,
preload : 'metadata',
content : '',
width : 640,
height : 360
},
edit : function( data ) {
var frame,
shortcode = wp.shortcode.next( 'video', data ).shortcode,
attrs;
attrs = shortcode.attrs.named;
attrs.content = shortcode.content;
frame = wp.media({
frame: 'video',
state: 'video-details',
metadata: _.defaults( attrs, this.defaults )
});
return frame;
},
shortcode : function( model ) {
var content;
_.each( this.defaults, function( value, key ) {
model[ key ] = this.coerce( model, key );
if ( value === model[ key ] ) {
delete model[ key ];
}
}, this );
content = model.content;
delete model.content;
return new wp.shortcode({
tag: 'video',
attrs: model,
content: content
});
}
};
media.model.PostMedia = require( './models/post-media.js' );
media.controller.AudioDetails = require( './controllers/audio-details.js' );
media.controller.VideoDetails = require( './controllers/video-details.js' );
media.view.MediaFrame.MediaDetails = require( './views/frame/media-details.js' );
media.view.MediaFrame.AudioDetails = require( './views/frame/audio-details.js' );
media.view.MediaFrame.VideoDetails = require( './views/frame/video-details.js' );
media.view.MediaDetails = require( './views/media-details.js' );
media.view.AudioDetails = require( './views/audio-details.js' );
media.view.VideoDetails = require( './views/video-details.js' );
}(_));
media.model.PostMedia = require( './models/post-media.js' );
media.controller.AudioDetails = require( './controllers/audio-details.js' );
media.controller.VideoDetails = require( './controllers/video-details.js' );
media.view.MediaFrame.MediaDetails = require( './views/frame/media-details.js' );
media.view.MediaFrame.AudioDetails = require( './views/frame/audio-details.js' );
media.view.MediaFrame.VideoDetails = require( './views/frame/video-details.js' );
media.view.MediaDetails = require( './views/media-details.js' );
media.view.AudioDetails = require( './views/audio-details.js' );
media.view.VideoDetails = require( './views/video-details.js' );

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,3 @@
/*globals wp */
/**
* The controller for the Audio Details state
*
@ -28,4 +26,4 @@ AudioDetails = State.extend({
}
});
module.exports = AudioDetails;
module.exports = AudioDetails;

View File

@ -1,5 +1,3 @@
/*globals _, wp */
/**
* wp.media.controller.CollectionAdd
*
@ -98,4 +96,4 @@ CollectionAdd = Library.extend({
}
});
module.exports = CollectionAdd;
module.exports = CollectionAdd;

View File

@ -1,5 +1,3 @@
/*globals wp, jQuery, Backbone */
/**
* wp.media.controller.CollectionEdit
*
@ -159,4 +157,4 @@ CollectionEdit = Library.extend({
}
});
module.exports = CollectionEdit;
module.exports = CollectionEdit;

View File

@ -1,5 +1,3 @@
/*globals _, wp, Backbone */
/**
* wp.media.controller.Cropper
*
@ -75,7 +73,7 @@ Cropper = State.extend({
this.$el.text(l10n.cropping);
this.$el.attr('disabled', true);
controller.state().doCrop( selection ).done( function( croppedImage ) {
controller.trigger('cropped', croppedImage );
controller.close();
@ -116,4 +114,4 @@ Cropper = State.extend({
}
});
module.exports = Cropper;
module.exports = Cropper;

View File

@ -1,5 +1,3 @@
/*globals wp */
/**
* wp.media.controller.EditAttachmentMetadata
*
@ -26,4 +24,4 @@ EditAttachmentMetadata = State.extend({
}
});
module.exports = EditAttachmentMetadata;
module.exports = EditAttachmentMetadata;

View File

@ -1,5 +1,3 @@
/*globals _, wp */
/**
* wp.media.controller.EditImage
*
@ -75,4 +73,4 @@ EditImage = State.extend({
}
});
module.exports = EditImage;
module.exports = EditImage;

View File

@ -1,5 +1,3 @@
/*globals _, wp, jQuery, Backbone */
/**
* wp.media.controller.Embed
*
@ -134,4 +132,4 @@ Embed = State.extend({
}
});
module.exports = Embed;
module.exports = Embed;

View File

@ -1,5 +1,3 @@
/*globals _, wp */
/**
* wp.media.controller.FeaturedImage
*
@ -119,4 +117,4 @@ FeaturedImage = Library.extend({
}
});
module.exports = FeaturedImage;
module.exports = FeaturedImage;

View File

@ -1,5 +1,3 @@
/*globals _, wp */
/**
* A state for selecting more images to add to a gallery.
*
@ -51,8 +49,9 @@ GalleryAdd = Library.extend({
*/
initialize: function() {
// If a library wasn't supplied, create a library of images.
if ( ! this.get('library') )
if ( ! this.get('library') ) {
this.set( 'library', wp.media.query({ type: 'image' }) );
}
Library.prototype.initialize.apply( this, arguments );
},
@ -64,8 +63,9 @@ GalleryAdd = Library.extend({
var library = this.get('library'),
edit = this.frame.state('gallery-edit').get('library');
if ( this.editLibrary && this.editLibrary !== edit )
if ( this.editLibrary && this.editLibrary !== edit ) {
library.unobserve( this.editLibrary );
}
// Accepts attachments that exist in the original library and
// that do not exist in gallery's library.
@ -84,4 +84,4 @@ GalleryAdd = Library.extend({
}
});
module.exports = GalleryAdd;
module.exports = GalleryAdd;

View File

@ -1,5 +1,3 @@
/*globals wp, Backbone */
/**
* wp.media.controller.GalleryEdit
*
@ -61,12 +59,15 @@ GalleryEdit = Library.extend({
*/
initialize: function() {
// If we haven't been provided a `library`, create a `Selection`.
if ( ! this.get('library') )
if ( ! this.get('library') ) {
this.set( 'library', new wp.media.model.Selection() );
}
// The single `Attachment` view to be used in the `Attachments` view.
if ( ! this.get('AttachmentView') )
if ( ! this.get('AttachmentView') ) {
this.set( 'AttachmentView', EditLibraryView );
}
Library.prototype.initialize.apply( this, arguments );
},
@ -136,4 +137,4 @@ GalleryEdit = Library.extend({
}
});
module.exports = GalleryEdit;
module.exports = GalleryEdit;

View File

@ -1,5 +1,3 @@
/*globals _, wp */
/**
* wp.media.controller.ImageDetails
*
@ -59,4 +57,4 @@ ImageDetails = State.extend({
}
});
module.exports = ImageDetails;
module.exports = ImageDetails;

View File

@ -1,5 +1,3 @@
/*globals _, wp, Backbone, getUserSetting, setUserSetting */
/**
* wp.media.controller.Library
*
@ -37,6 +35,8 @@
var selectionSync = require( '../utils/selection-sync.js' ),
State = require( './state.js' ),
l10n = wp.media.view.l10n,
getUserSetting = window.getUserSetting,
setUserSetting = window.setUserSetting,
Library;
Library = State.extend({
@ -71,7 +71,7 @@ Library = State.extend({
this.set( 'library', wp.media.query() );
}
if ( ! (selection instanceof Selection) ) {
if ( ! ( selection instanceof wp.media.model.Selection ) ) {
props = selection;
if ( ! props ) {
@ -269,4 +269,4 @@ Library = State.extend({
// Make selectionSync available on any Media Library state.
_.extend( Library.prototype, selectionSync );
module.exports = Library;
module.exports = Library;

View File

@ -1,5 +1,3 @@
/*globals _, wp */
/**
* wp.media.controller.MediaLibrary
*
@ -47,4 +45,4 @@ MediaLibrary = Library.extend({
}
});
module.exports = MediaLibrary;
module.exports = MediaLibrary;

View File

@ -1,5 +1,3 @@
/*globals _, Backbone */
/**
* wp.media.controller.Region
*
@ -176,4 +174,4 @@ _.extend( Region.prototype, {
}
});
module.exports = Region;
module.exports = Region;

View File

@ -1,5 +1,3 @@
/*globals _, wp */
/**
* wp.media.controller.ReplaceImage
*
@ -105,4 +103,4 @@ ReplaceImage = Library.extend({
}
});
module.exports = ReplaceImage;
module.exports = ReplaceImage;

View File

@ -1,5 +1,3 @@
/*globals _, Backbone */
/**
* wp.media.controller.StateMachine
*
@ -121,4 +119,4 @@ _.each([ 'on', 'off', 'trigger' ], function( method ) {
};
});
module.exports = StateMachine;
module.exports = StateMachine;

View File

@ -1,5 +1,3 @@
/*globals _, Backbone */
/**
* wp.media.controller.State
*
@ -238,4 +236,4 @@ _.each(['toolbar','content'], function( region ) {
};
});
module.exports = State;
module.exports = State;

View File

@ -1,5 +1,3 @@
/*globals wp */
/**
* The controller for the Video Details state
*
@ -28,4 +26,4 @@ VideoDetails = State.extend({
}
});
module.exports = VideoDetails;
module.exports = VideoDetails;

View File

@ -1,6 +1,4 @@
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
/*globals wp */
/**
* wp.media.controller.EditAttachmentMetadata
*
@ -28,9 +26,8 @@ EditAttachmentMetadata = State.extend({
});
module.exports = EditAttachmentMetadata;
},{"./state.js":6}],2:[function(require,module,exports){
/*globals _, wp */
},{"./state.js":6}],2:[function(require,module,exports){
/**
* wp.media.controller.EditImage
*
@ -107,9 +104,8 @@ EditImage = State.extend({
});
module.exports = EditImage;
},{"../views/toolbar.js":46,"./state.js":6}],3:[function(require,module,exports){
/*globals _, wp, Backbone, getUserSetting, setUserSetting */
},{"../views/toolbar.js":46,"./state.js":6}],3:[function(require,module,exports){
/**
* wp.media.controller.Library
*
@ -147,6 +143,8 @@ module.exports = EditImage;
var selectionSync = require( '../utils/selection-sync.js' ),
State = require( './state.js' ),
l10n = wp.media.view.l10n,
getUserSetting = window.getUserSetting,
setUserSetting = window.setUserSetting,
Library;
Library = State.extend({
@ -181,7 +179,7 @@ Library = State.extend({
this.set( 'library', wp.media.query() );
}
if ( ! (selection instanceof Selection) ) {
if ( ! ( selection instanceof wp.media.model.Selection ) ) {
props = selection;
if ( ! props ) {
@ -380,9 +378,8 @@ Library = State.extend({
_.extend( Library.prototype, selectionSync );
module.exports = Library;
},{"../utils/selection-sync.js":9,"./state.js":6}],4:[function(require,module,exports){
/*globals _, Backbone */
},{"../utils/selection-sync.js":9,"./state.js":6}],4:[function(require,module,exports){
/**
* wp.media.controller.Region
*
@ -560,9 +557,8 @@ _.extend( Region.prototype, {
});
module.exports = Region;
},{}],5:[function(require,module,exports){
/*globals _, Backbone */
},{}],5:[function(require,module,exports){
/**
* wp.media.controller.StateMachine
*
@ -685,9 +681,8 @@ _.each([ 'on', 'off', 'trigger' ], function( method ) {
});
module.exports = StateMachine;
},{}],6:[function(require,module,exports){
/*globals _, Backbone */
},{}],6:[function(require,module,exports){
/**
* wp.media.controller.State
*
@ -927,25 +922,21 @@ _.each(['toolbar','content'], function( region ) {
});
module.exports = State;
},{}],7:[function(require,module,exports){
/* global wp, _wpMediaViewsL10n, MediaElementPlayer, _wpMediaGridSettings */
(function (wp) {
var media = wp.media;
var media = wp.media;
media.controller.EditAttachmentMetadata = require( './controllers/edit-attachment-metadata.js' );
media.view.MediaFrame.Manage = require( './views/frame/manage.js' );
media.view.Attachment.Details.TwoColumn = require( './views/attachment/details-two-column.js' );
media.view.MediaFrame.Manage.Router = require( './routers/manage.js' );
media.view.EditImage.Details = require( './views/edit-image-details.js' );
media.view.MediaFrame.EditAttachments = require( './views/frame/edit-attachments.js' );
media.view.SelectModeToggleButton = require( './views/button/select-mode-toggle.js' );
media.view.DeleteSelectedButton = require( './views/button/delete-selected.js' );
media.view.DeleteSelectedPermanentlyButton = require( './views/button/delete-selected-permanently.js' );
media.controller.EditAttachmentMetadata = require( './controllers/edit-attachment-metadata.js' );
media.view.MediaFrame.Manage = require( './views/frame/manage.js' );
media.view.Attachment.Details.TwoColumn = require( './views/attachment/details-two-column.js' );
media.view.MediaFrame.Manage.Router = require( './routers/manage.js' );
media.view.EditImage.Details = require( './views/edit-image-details.js' );
media.view.MediaFrame.EditAttachments = require( './views/frame/edit-attachments.js' );
media.view.SelectModeToggleButton = require( './views/button/select-mode-toggle.js' );
media.view.DeleteSelectedButton = require( './views/button/delete-selected.js' );
media.view.DeleteSelectedPermanentlyButton = require( './views/button/delete-selected-permanently.js' );
}(wp));
},{"./controllers/edit-attachment-metadata.js":1,"./routers/manage.js":8,"./views/attachment/details-two-column.js":16,"./views/button/delete-selected-permanently.js":22,"./views/button/delete-selected.js":23,"./views/button/select-mode-toggle.js":24,"./views/edit-image-details.js":25,"./views/frame/edit-attachments.js":29,"./views/frame/manage.js":30}],8:[function(require,module,exports){
/*globals jQuery, Backbone */
/**
* A router for handling the browser history and application state.
*
@ -990,9 +981,8 @@ var Router = Backbone.Router.extend({
});
module.exports = Router;
},{}],9:[function(require,module,exports){
/*globals _ */
},{}],9:[function(require,module,exports){
/**
* wp.media.selectionSync
*
@ -1057,9 +1047,8 @@ var selectionSync = {
};
module.exports = selectionSync;
},{}],10:[function(require,module,exports){
/*globals _ */
},{}],10:[function(require,module,exports){
/**
* wp.media.view.AttachmentCompat
*
@ -1143,9 +1132,8 @@ AttachmentCompat = View.extend({
});
module.exports = AttachmentCompat;
},{"./view.js":51}],11:[function(require,module,exports){
/*globals _, jQuery */
},{"./view.js":51}],11:[function(require,module,exports){
/**
* wp.media.view.AttachmentFilters
*
@ -1222,9 +1210,8 @@ AttachmentFilters = View.extend({
});
module.exports = AttachmentFilters;
},{"./view.js":51}],12:[function(require,module,exports){
/*globals _, wp */
},{"./view.js":51}],12:[function(require,module,exports){
/**
* wp.media.view.AttachmentFilters.All
*
@ -1314,9 +1301,8 @@ All = AttachmentFilters.extend({
});
module.exports = All;
},{"../attachment-filters.js":11}],13:[function(require,module,exports){
/*globals _, wp */
},{"../attachment-filters.js":11}],13:[function(require,module,exports){
/**
* A filter dropdown for month/dates.
*
@ -1357,9 +1343,8 @@ DateFilter = AttachmentFilters.extend({
});
module.exports = DateFilter;
},{"../attachment-filters.js":11}],14:[function(require,module,exports){
/*globals wp */
},{"../attachment-filters.js":11}],14:[function(require,module,exports){
/**
* wp.media.view.AttachmentFilters.Uploaded
*
@ -1418,9 +1403,8 @@ Uploaded = AttachmentFilters.extend({
});
module.exports = Uploaded;
},{"../attachment-filters.js":11}],15:[function(require,module,exports){
/*globals _, wp, jQuery */
},{"../attachment-filters.js":11}],15:[function(require,module,exports){
/**
* wp.media.view.Attachment
*
@ -1973,9 +1957,8 @@ _.each({
});
module.exports = Attachment;
},{"./view.js":51}],16:[function(require,module,exports){
/*globals wp */
},{"./view.js":51}],16:[function(require,module,exports){
/**
* A similar view to media.view.Attachment.Details
* for use in the Edit Attachment modal.
@ -2010,15 +1993,14 @@ TwoColumn = Details.extend({
wp.media.mixin.removeAllPlayers();
this.$( 'audio, video' ).each( function (i, elem) {
var el = MediaDetails.prepareSrc( elem );
new MediaElementPlayer( el, wp.media.mixin.mejsSettings );
new window.MediaElementPlayer( el, wp.media.mixin.mejsSettings );
} );
}
});
module.exports = TwoColumn;
},{"../media-details.js":33,"./details.js":17}],17:[function(require,module,exports){
/*globals _, wp */
},{"../media-details.js":33,"./details.js":17}],17:[function(require,module,exports){
/**
* wp.media.view.Attachment.Details
*
@ -2078,7 +2060,7 @@ Details = Attachment.extend({
deleteAttachment: function( event ) {
event.preventDefault();
if ( confirm( l10n.warnDelete ) ) {
if ( window.confirm( l10n.warnDelete ) ) {
this.model.destroy();
// Keep focus inside media modal
// after image is deleted
@ -2157,6 +2139,7 @@ Details = Attachment.extend({
});
module.exports = Details;
},{"../attachment.js":15}],18:[function(require,module,exports){
/**
* wp.media.view.Attachment.Library
@ -2177,9 +2160,8 @@ Library = Attachment.extend({
});
module.exports = Library;
},{"../attachment.js":15}],19:[function(require,module,exports){
/*globals _, wp, jQuery */
},{"../attachment.js":15}],19:[function(require,module,exports){
/**
* wp.media.view.Attachments
*
@ -2452,7 +2434,7 @@ Attachments = View.extend({
// The scroll event occurs on the document, but the element
// that should be checked is the document body.
if ( el == document ) {
if ( el === document ) {
el = document.body;
scrollTop = $(document).scrollTop();
}
@ -2478,9 +2460,8 @@ Attachments = View.extend({
});
module.exports = Attachments;
},{"./attachment.js":15,"./view.js":51}],20:[function(require,module,exports){
/*globals _, wp, jQuery */
},{"./attachment.js":15,"./view.js":51}],20:[function(require,module,exports){
/**
* wp.media.view.AttachmentsBrowser
*
@ -2671,13 +2652,13 @@ AttachmentsBrowser = View.extend({
return;
}
if ( ! mediaTrash && ! confirm( l10n.warnBulkDelete ) ) {
if ( ! mediaTrash && ! window.confirm( l10n.warnBulkDelete ) ) {
return;
}
if ( mediaTrash &&
'trash' !== selection.at( 0 ).get( 'status' ) &&
! confirm( l10n.warnBulkTrash ) ) {
! window.confirm( l10n.warnBulkTrash ) ) {
return;
}
@ -2725,7 +2706,7 @@ AttachmentsBrowser = View.extend({
click: function() {
var removed = [], selection = this.controller.state().get( 'selection' );
if ( ! selection.length || ! confirm( l10n.warnBulkDelete ) ) {
if ( ! selection.length || ! window.confirm( l10n.warnBulkDelete ) ) {
return;
}
@ -2938,9 +2919,8 @@ AttachmentsBrowser = View.extend({
});
module.exports = AttachmentsBrowser;
},{"../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){
/*globals _, Backbone */
},{"../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){
/**
* wp.media.view.Button
*
@ -3028,6 +3008,7 @@ Button = View.extend({
});
module.exports = Button;
},{"./view.js":51}],22:[function(require,module,exports){
/**
* When MEDIA_TRASH is true, a button that handles bulk Delete Permanently logic
@ -3072,9 +3053,8 @@ DeleteSelectedPermanently = DeleteSelected.extend({
});
module.exports = DeleteSelectedPermanently;
},{"../button.js":21,"./delete-selected.js":23}],23:[function(require,module,exports){
/*globals wp */
},{"../button.js":21,"./delete-selected.js":23}],23:[function(require,module,exports){
/**
* A button that handles bulk Delete/Trash logic
*
@ -3124,9 +3104,8 @@ DeleteSelected = Button.extend({
});
module.exports = DeleteSelected;
},{"../button.js":21}],24:[function(require,module,exports){
/*globals wp */
},{"../button.js":21}],24:[function(require,module,exports){
var Button = require( '../button.js' ),
l10n = wp.media.view.l10n,
SelectModeToggle;
@ -3180,6 +3159,7 @@ SelectModeToggle = Button.extend({
});
module.exports = SelectModeToggle;
},{"../button.js":21}],25:[function(require,module,exports){
var View = require( './view.js' ),
EditImage = require( './edit-image.js' ),
@ -3205,9 +3185,8 @@ Details = EditImage.extend({
});
module.exports = Details;
},{"./edit-image.js":26,"./view.js":51}],26:[function(require,module,exports){
/*globals _, wp */
},{"./edit-image.js":26,"./view.js":51}],26:[function(require,module,exports){
var View = require( './view.js' ),
EditImage;
@ -3259,6 +3238,7 @@ EditImage = View.extend({
});
module.exports = EditImage;
},{"./view.js":51}],27:[function(require,module,exports){
/**
* wp.media.view.FocusManager
@ -3307,9 +3287,8 @@ FocusManager = View.extend({
});
module.exports = FocusManager;
},{"./view.js":51}],28:[function(require,module,exports){
/*globals _, Backbone */
},{"./view.js":51}],28:[function(require,module,exports){
/**
* wp.media.view.Frame
*
@ -3480,9 +3459,8 @@ Frame = View.extend({
_.extend( Frame.prototype, StateMachine.prototype );
module.exports = Frame;
},{"../controllers/region.js":4,"../controllers/state-machine.js":5,"../controllers/state.js":6,"./view.js":51}],29:[function(require,module,exports){
/*globals _, wp, jQuery */
},{"../controllers/region.js":4,"../controllers/state-machine.js":5,"../controllers/state.js":6,"./view.js":51}],29:[function(require,module,exports){
/**
* A frame for editing the details of a specific media item.
*
@ -3727,9 +3705,8 @@ EditAttachments = MediaFrame.extend({
});
module.exports = EditAttachments;
},{"../../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){
/*globals _, Backbone, wp, jQuery */
},{"../../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){
/**
* wp.media.view.MediaFrame.Manage
*
@ -3967,7 +3944,7 @@ Manage = MediaFrame.extend({
// Verify pushState support and activate
if ( window.history && window.history.pushState ) {
Backbone.history.start( {
root: _wpMediaGridSettings.adminUrl,
root: window._wpMediaGridSettings.adminUrl,
pushState: true
} );
}
@ -3975,6 +3952,7 @@ Manage = MediaFrame.extend({
});
module.exports = Manage;
},{"../../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){
/**
* wp.media.view.Iframe
@ -4001,6 +3979,7 @@ Iframe = View.extend({
});
module.exports = Iframe;
},{"./view.js":51}],32:[function(require,module,exports){
/**
* @class
@ -4027,9 +4006,8 @@ Label = View.extend({
});
module.exports = Label;
},{"./view.js":51}],33:[function(require,module,exports){
/*globals _, wp, jQuery */
},{"./view.js":51}],33:[function(require,module,exports){
/**
* wp.media.view.MediaDetails
*
@ -4113,7 +4091,7 @@ MediaDetails = AttachmentDisplay.extend({
*/
setPlayer : function() {
if ( ! this.players.length && this.media ) {
this.players.push( new MediaElementPlayer( this.media, this.settings ) );
this.players.push( new window.MediaElementPlayer( this.media, this.settings ) );
}
},
@ -4141,7 +4119,7 @@ MediaDetails = AttachmentDisplay.extend({
*/
render: function() {
AttachmentDisplay.prototype.render.apply( this, arguments );
setTimeout( _.bind( function() {
this.resetFocus();
}, this ), 10 );
@ -4180,9 +4158,8 @@ MediaDetails = AttachmentDisplay.extend({
});
module.exports = MediaDetails;
},{"./settings/attachment-display.js":43}],34:[function(require,module,exports){
/*globals _, wp, jQuery */
},{"./settings/attachment-display.js":43}],34:[function(require,module,exports){
/**
* wp.media.view.MediaFrame
*
@ -4435,9 +4412,8 @@ _.each(['open','close','attach','detach','escape'], function( method ) {
});
module.exports = MediaFrame;
},{"./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){
/*globals wp, jQuery */
},{"./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){
/**
* wp.media.view.MenuItem
*
@ -4509,6 +4485,7 @@ MenuItem = View.extend({
});
module.exports = MenuItem;
},{"./view.js":51}],36:[function(require,module,exports){
/**
* wp.media.view.Menu
@ -4625,9 +4602,8 @@ Menu = PriorityList.extend({
});
module.exports = Menu;
},{"./menu-item.js":35,"./priority-list.js":38}],37:[function(require,module,exports){
/*globals _, wp, jQuery */
},{"./menu-item.js":35,"./priority-list.js":38}],37:[function(require,module,exports){
/**
* wp.media.view.Modal
*
@ -4841,9 +4817,8 @@ Modal = View.extend({
});
module.exports = Modal;
},{"./focus-manager.js":27,"./view.js":51}],38:[function(require,module,exports){
/*globals _, Backbone */
},{"./focus-manager.js":27,"./view.js":51}],38:[function(require,module,exports){
/**
* wp.media.view.PriorityList
*
@ -4942,6 +4917,7 @@ PriorityList = View.extend({
});
module.exports = PriorityList;
},{"./view.js":51}],39:[function(require,module,exports){
/**
* wp.media.view.RouterItem
@ -4968,6 +4944,7 @@ RouterItem = MenuItem.extend({
});
module.exports = RouterItem;
},{"./menu-item.js":35}],40:[function(require,module,exports){
/**
* wp.media.view.Router
@ -5005,9 +4982,8 @@ Router = Menu.extend({
});
module.exports = Router;
},{"./menu.js":36,"./router-item.js":39}],41:[function(require,module,exports){
/*globals wp */
},{"./menu.js":36,"./router-item.js":39}],41:[function(require,module,exports){
/**
* wp.media.view.Search
*
@ -5055,9 +5031,8 @@ Search = View.extend({
});
module.exports = Search;
},{"./view.js":51}],42:[function(require,module,exports){
/*globals _, Backbone, jQuery */
},{"./view.js":51}],42:[function(require,module,exports){
/**
* wp.media.view.Settings
*
@ -5165,7 +5140,7 @@ Settings = View.extend({
// If the setting has a corresponding user setting,
// update that as well.
if ( userSetting = $setting.data('userSetting') ) {
setUserSetting( userSetting, value );
window.setUserSetting( userSetting, value );
}
},
@ -5177,9 +5152,8 @@ Settings = View.extend({
});
module.exports = Settings;
},{"./view.js":51}],43:[function(require,module,exports){
/*globals _, wp */
},{"./view.js":51}],43:[function(require,module,exports){
/**
* wp.media.view.Settings.AttachmentDisplay
*
@ -5272,6 +5246,7 @@ AttachmentDisplay = Settings.extend({
});
module.exports = AttachmentDisplay;
},{"../settings.js":42}],44:[function(require,module,exports){
/**
* wp.media.view.Sidebar
@ -5290,9 +5265,8 @@ Sidebar = PriorityList.extend({
});
module.exports = Sidebar;
},{"./priority-list.js":38}],45:[function(require,module,exports){
/*globals _, wp */
},{"./priority-list.js":38}],45:[function(require,module,exports){
/**
* wp.media.view.Spinner
*
@ -5329,9 +5303,8 @@ Spinner = View.extend({
});
module.exports = Spinner;
},{"./view.js":51}],46:[function(require,module,exports){
/*globals Backbone, _ */
},{"./view.js":51}],46:[function(require,module,exports){
/**
* wp.media.view.Toolbar
*
@ -5492,9 +5465,8 @@ Toolbar = View.extend({
});
module.exports = Toolbar;
},{"./button.js":21,"./priority-list.js":38,"./view.js":51}],47:[function(require,module,exports){
/*globals _, wp */
},{"./button.js":21,"./priority-list.js":38,"./view.js":51}],47:[function(require,module,exports){
/**
* wp.media.view.UploaderInline
*
@ -5625,9 +5597,8 @@ UploaderInline = View.extend({
});
module.exports = UploaderInline;
},{"../view.js":51,"./status.js":49}],48:[function(require,module,exports){
/*globals wp */
},{"../view.js":51,"./status.js":49}],48:[function(require,module,exports){
/**
* wp.media.view.UploaderStatusError
*
@ -5645,9 +5616,8 @@ UploaderStatusError = View.extend({
});
module.exports = UploaderStatusError;
},{"../view.js":51}],49:[function(require,module,exports){
/*globals _, wp */
},{"../view.js":51}],49:[function(require,module,exports){
/**
* wp.media.view.UploaderStatus
*
@ -5785,9 +5755,8 @@ UploaderStatus = View.extend({
});
module.exports = UploaderStatus;
},{"../view.js":51,"./status-error.js":48}],50:[function(require,module,exports){
/*globals _, wp, jQuery */
},{"../view.js":51,"./status-error.js":48}],50:[function(require,module,exports){
/**
* wp.media.view.UploaderWindow
*
@ -5898,9 +5867,8 @@ UploaderWindow = View.extend({
});
module.exports = UploaderWindow;
},{"../view.js":51}],51:[function(require,module,exports){
/*globals wp */
},{"../view.js":51}],51:[function(require,module,exports){
/**
* wp.media.View
*
@ -5965,4 +5933,5 @@ var View = wp.Backbone.View.extend({
});
module.exports = View;
},{}]},{},[7]);

View File

@ -1,15 +1,11 @@
/* global wp, _wpMediaViewsL10n, MediaElementPlayer, _wpMediaGridSettings */
(function (wp) {
var media = wp.media;
var media = wp.media;
media.controller.EditAttachmentMetadata = require( './controllers/edit-attachment-metadata.js' );
media.view.MediaFrame.Manage = require( './views/frame/manage.js' );
media.view.Attachment.Details.TwoColumn = require( './views/attachment/details-two-column.js' );
media.view.MediaFrame.Manage.Router = require( './routers/manage.js' );
media.view.EditImage.Details = require( './views/edit-image-details.js' );
media.view.MediaFrame.EditAttachments = require( './views/frame/edit-attachments.js' );
media.view.SelectModeToggleButton = require( './views/button/select-mode-toggle.js' );
media.view.DeleteSelectedButton = require( './views/button/delete-selected.js' );
media.view.DeleteSelectedPermanentlyButton = require( './views/button/delete-selected-permanently.js' );
}(wp));
media.controller.EditAttachmentMetadata = require( './controllers/edit-attachment-metadata.js' );
media.view.MediaFrame.Manage = require( './views/frame/manage.js' );
media.view.Attachment.Details.TwoColumn = require( './views/attachment/details-two-column.js' );
media.view.MediaFrame.Manage.Router = require( './routers/manage.js' );
media.view.EditImage.Details = require( './views/edit-image-details.js' );
media.view.MediaFrame.EditAttachments = require( './views/frame/edit-attachments.js' );
media.view.SelectModeToggleButton = require( './views/button/select-mode-toggle.js' );
media.view.DeleteSelectedButton = require( './views/button/delete-selected.js' );
media.view.DeleteSelectedPermanentlyButton = require( './views/button/delete-selected-permanently.js' );

File diff suppressed because one or more lines are too long

View File

@ -1,239 +1,235 @@
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
/* global _wpMediaModelsL10n:false */
var $ = jQuery,
Attachment, Attachments, l10n, media;
window.wp = window.wp || {};
(function($){
var Attachment, Attachments, l10n, media;
/**
* Create and return a media frame.
*
* Handles the default media experience.
*
* @param {object} attributes The properties passed to the main media controller.
* @return {wp.media.view.MediaFrame} A media workflow.
*/
media = wp.media = function( attributes ) {
var MediaFrame = media.view.MediaFrame,
frame;
if ( ! MediaFrame ) {
return;
}
attributes = _.defaults( attributes || {}, {
frame: 'select'
});
if ( 'select' === attributes.frame && MediaFrame.Select ) {
frame = new MediaFrame.Select( attributes );
} else if ( 'post' === attributes.frame && MediaFrame.Post ) {
frame = new MediaFrame.Post( attributes );
} else if ( 'manage' === attributes.frame && MediaFrame.Manage ) {
frame = new MediaFrame.Manage( attributes );
} else if ( 'image' === attributes.frame && MediaFrame.ImageDetails ) {
frame = new MediaFrame.ImageDetails( attributes );
} else if ( 'audio' === attributes.frame && MediaFrame.AudioDetails ) {
frame = new MediaFrame.AudioDetails( attributes );
} else if ( 'video' === attributes.frame && MediaFrame.VideoDetails ) {
frame = new MediaFrame.VideoDetails( attributes );
} else if ( 'edit-attachments' === attributes.frame && MediaFrame.EditAttachments ) {
frame = new MediaFrame.EditAttachments( attributes );
}
delete attributes.frame;
media.frame = frame;
return frame;
};
_.extend( media, { model: {}, view: {}, controller: {}, frames: {} });
// Link any localized strings.
l10n = media.model.l10n = window._wpMediaModelsL10n || {};
// Link any settings.
media.model.settings = l10n.settings || {};
delete l10n.settings;
Attachments = media.model.Attachments = require( './models/attachments.js' );
Attachment = media.model.Attachment = require( './models/attachment.js' );
media.model.Query = require( './models/query.js' );
media.model.PostImage = require( './models/post-image.js' );
media.model.Selection = require( './models/selection.js' );
/**
* ========================================================================
* UTILITIES
* ========================================================================
*/
/**
* A basic equality comparator for Backbone models.
*
* Used to order models within a collection - @see wp.media.model.Attachments.comparator().
*
* @param {mixed} a The primary parameter to compare.
* @param {mixed} b The primary parameter to compare.
* @param {string} ac The fallback parameter to compare, a's cid.
* @param {string} bc The fallback parameter to compare, b's cid.
* @return {number} -1: a should come before b.
* 0: a and b are of the same rank.
* 1: b should come before a.
*/
media.compare = function( a, b, ac, bc ) {
if ( _.isEqual( a, b ) ) {
return ac === bc ? 0 : (ac > bc ? -1 : 1);
} else {
return a > b ? -1 : 1;
}
};
_.extend( media, {
/**
* media.template( id )
*
* Fetch a JavaScript template for an id, and return a templating function for it.
*
* See wp.template() in `wp-includes/js/wp-util.js`.
*
* @borrows wp.template as template
*/
template: wp.template,
/**
* Create and return a media frame.
* media.post( [action], [data] )
*
* Handles the default media experience.
* Sends a POST request to WordPress.
* See wp.ajax.post() in `wp-includes/js/wp-util.js`.
*
* @param {object} attributes The properties passed to the main media controller.
* @return {wp.media.view.MediaFrame} A media workflow.
* @borrows wp.ajax.post as post
*/
media = wp.media = function( attributes ) {
var MediaFrame = media.view.MediaFrame,
frame;
post: wp.ajax.post,
if ( ! MediaFrame ) {
return;
/**
* media.ajax( [action], [options] )
*
* Sends an XHR request to WordPress.
* See wp.ajax.send() in `wp-includes/js/wp-util.js`.
*
* @borrows wp.ajax.send as ajax
*/
ajax: wp.ajax.send,
/**
* Scales a set of dimensions to fit within bounding dimensions.
*
* @param {Object} dimensions
* @returns {Object}
*/
fit: function( dimensions ) {
var width = dimensions.width,
height = dimensions.height,
maxWidth = dimensions.maxWidth,
maxHeight = dimensions.maxHeight,
constraint;
// Compare ratios between the two values to determine which
// max to constrain by. If a max value doesn't exist, then the
// opposite side is the constraint.
if ( ! _.isUndefined( maxWidth ) && ! _.isUndefined( maxHeight ) ) {
constraint = ( width / height > maxWidth / maxHeight ) ? 'width' : 'height';
} else if ( _.isUndefined( maxHeight ) ) {
constraint = 'width';
} else if ( _.isUndefined( maxWidth ) && height > maxHeight ) {
constraint = 'height';
}
attributes = _.defaults( attributes || {}, {
frame: 'select'
});
if ( 'select' === attributes.frame && MediaFrame.Select ) {
frame = new MediaFrame.Select( attributes );
} else if ( 'post' === attributes.frame && MediaFrame.Post ) {
frame = new MediaFrame.Post( attributes );
} else if ( 'manage' === attributes.frame && MediaFrame.Manage ) {
frame = new MediaFrame.Manage( attributes );
} else if ( 'image' === attributes.frame && MediaFrame.ImageDetails ) {
frame = new MediaFrame.ImageDetails( attributes );
} else if ( 'audio' === attributes.frame && MediaFrame.AudioDetails ) {
frame = new MediaFrame.AudioDetails( attributes );
} else if ( 'video' === attributes.frame && MediaFrame.VideoDetails ) {
frame = new MediaFrame.VideoDetails( attributes );
} else if ( 'edit-attachments' === attributes.frame && MediaFrame.EditAttachments ) {
frame = new MediaFrame.EditAttachments( attributes );
}
delete attributes.frame;
media.frame = frame;
return frame;
};
_.extend( media, { model: {}, view: {}, controller: {}, frames: {} });
// Link any localized strings.
l10n = media.model.l10n = typeof _wpMediaModelsL10n === 'undefined' ? {} : _wpMediaModelsL10n;
// Link any settings.
media.model.settings = l10n.settings || {};
delete l10n.settings;
Attachments = media.model.Attachments = require( './models/attachments.js' );
Attachment = media.model.Attachment = require( './models/attachment.js' );
media.model.Query = require( './models/query.js' );
media.model.PostImage = require( './models/post-image.js' );
media.model.Selection = require( './models/selection.js' );
/**
* ========================================================================
* UTILITIES
* ========================================================================
*/
/**
* A basic equality comparator for Backbone models.
*
* Used to order models within a collection - @see wp.media.model.Attachments.comparator().
*
* @param {mixed} a The primary parameter to compare.
* @param {mixed} b The primary parameter to compare.
* @param {string} ac The fallback parameter to compare, a's cid.
* @param {string} bc The fallback parameter to compare, b's cid.
* @return {number} -1: a should come before b.
* 0: a and b are of the same rank.
* 1: b should come before a.
*/
media.compare = function( a, b, ac, bc ) {
if ( _.isEqual( a, b ) ) {
return ac === bc ? 0 : (ac > bc ? -1 : 1);
// If the value of the constrained side is larger than the max,
// then scale the values. Otherwise return the originals; they fit.
if ( 'width' === constraint && width > maxWidth ) {
return {
width : maxWidth,
height: Math.round( maxWidth * height / width )
};
} else if ( 'height' === constraint && height > maxHeight ) {
return {
width : Math.round( maxHeight * width / height ),
height: maxHeight
};
} else {
return a > b ? -1 : 1;
return {
width : width,
height: height
};
}
};
},
/**
* Truncates a string by injecting an ellipsis into the middle.
* Useful for filenames.
*
* @param {String} string
* @param {Number} [length=30]
* @param {String} [replacement=&hellip;]
* @returns {String} The string, unless length is greater than string.length.
*/
truncate: function( string, length, replacement ) {
length = length || 30;
replacement = replacement || '&hellip;';
_.extend( media, {
/**
* media.template( id )
*
* Fetch a JavaScript template for an id, and return a templating function for it.
*
* See wp.template() in `wp-includes/js/wp-util.js`.
*
* @borrows wp.template as template
*/
template: wp.template,
/**
* media.post( [action], [data] )
*
* Sends a POST request to WordPress.
* See wp.ajax.post() in `wp-includes/js/wp-util.js`.
*
* @borrows wp.ajax.post as post
*/
post: wp.ajax.post,
/**
* media.ajax( [action], [options] )
*
* Sends an XHR request to WordPress.
* See wp.ajax.send() in `wp-includes/js/wp-util.js`.
*
* @borrows wp.ajax.send as ajax
*/
ajax: wp.ajax.send,
/**
* Scales a set of dimensions to fit within bounding dimensions.
*
* @param {Object} dimensions
* @returns {Object}
*/
fit: function( dimensions ) {
var width = dimensions.width,
height = dimensions.height,
maxWidth = dimensions.maxWidth,
maxHeight = dimensions.maxHeight,
constraint;
// Compare ratios between the two values to determine which
// max to constrain by. If a max value doesn't exist, then the
// opposite side is the constraint.
if ( ! _.isUndefined( maxWidth ) && ! _.isUndefined( maxHeight ) ) {
constraint = ( width / height > maxWidth / maxHeight ) ? 'width' : 'height';
} else if ( _.isUndefined( maxHeight ) ) {
constraint = 'width';
} else if ( _.isUndefined( maxWidth ) && height > maxHeight ) {
constraint = 'height';
}
// If the value of the constrained side is larger than the max,
// then scale the values. Otherwise return the originals; they fit.
if ( 'width' === constraint && width > maxWidth ) {
return {
width : maxWidth,
height: Math.round( maxWidth * height / width )
};
} else if ( 'height' === constraint && height > maxHeight ) {
return {
width : Math.round( maxHeight * width / height ),
height: maxHeight
};
} else {
return {
width : width,
height: height
};
}
},
/**
* Truncates a string by injecting an ellipsis into the middle.
* Useful for filenames.
*
* @param {String} string
* @param {Number} [length=30]
* @param {String} [replacement=&hellip;]
* @returns {String} The string, unless length is greater than string.length.
*/
truncate: function( string, length, replacement ) {
length = length || 30;
replacement = replacement || '&hellip;';
if ( string.length <= length ) {
return string;
}
return string.substr( 0, length / 2 ) + replacement + string.substr( -1 * length / 2 );
if ( string.length <= length ) {
return string;
}
return string.substr( 0, length / 2 ) + replacement + string.substr( -1 * length / 2 );
}
});
/**
* ========================================================================
* MODELS
* ========================================================================
*/
/**
* wp.media.attachment
*
* @static
* @param {String} id A string used to identify a model.
* @returns {wp.media.model.Attachment}
*/
media.attachment = function( id ) {
return Attachment.get( id );
};
/**
* A collection of all attachments that have been fetched from the server.
*
* @static
* @member {wp.media.model.Attachments}
*/
Attachments.all = new Attachments();
/**
* wp.media.query
*
* Shorthand for creating a new Attachments Query.
*
* @param {object} [props]
* @returns {wp.media.model.Attachments}
*/
media.query = function( props ) {
return new Attachments( null, {
props: _.extend( _.defaults( props || {}, { orderby: 'date' } ), { query: true } )
});
};
/**
* ========================================================================
* MODELS
* ========================================================================
*/
/**
* wp.media.attachment
*
* @static
* @param {String} id A string used to identify a model.
* @returns {wp.media.model.Attachment}
*/
media.attachment = function( id ) {
return Attachment.get( id );
};
// Clean up. Prevents mobile browsers caching
$(window).on('unload', function(){
window.wp = null;
});
/**
* A collection of all attachments that have been fetched from the server.
*
* @static
* @member {wp.media.model.Attachments}
*/
Attachments.all = new Attachments();
/**
* wp.media.query
*
* Shorthand for creating a new Attachments Query.
*
* @param {object} [props]
* @returns {wp.media.model.Attachments}
*/
media.query = function( props ) {
return new Attachments( null, {
props: _.extend( _.defaults( props || {}, { orderby: 'date' } ), { query: true } )
});
};
// Clean up. Prevents mobile browsers caching
$(window).on('unload', function(){
window.wp = null;
});
}(jQuery));
},{"./models/attachment.js":2,"./models/attachments.js":3,"./models/post-image.js":4,"./models/query.js":5,"./models/selection.js":6}],2:[function(require,module,exports){
/*globals jQuery, Backbone, _, wp */
/**
* wp.media.model.Attachment
*
@ -362,7 +358,7 @@ Attachment = Backbone.Model.extend({
return $.Deferred().rejectWith( this ).promise();
}
return media.post( 'save-attachment-compat', _.defaults({
return wp.media.post( 'save-attachment-compat', _.defaults({
id: this.id,
nonce: this.get('nonces').update,
post_id: wp.media.model.settings.post.id
@ -400,9 +396,8 @@ Attachment = Backbone.Model.extend({
});
module.exports = Attachment;
},{"./attachments.js":3}],3:[function(require,module,exports){
/*globals jQuery, Backbone, _, wp */
},{"./attachments.js":3}],3:[function(require,module,exports){
/**
* wp.media.model.Attachments
*
@ -726,8 +721,9 @@ Attachments = Backbone.Collection.extend({
// checking if we're still mirroring that collection when
// the request resolves.
mirroring.more( options ).done( function() {
if ( this === attachments.mirroring )
if ( this === attachments.mirroring ) {
deferred.resolveWith( this );
}
});
return deferred.promise();
@ -936,9 +932,8 @@ Attachments = Backbone.Collection.extend({
});
module.exports = Attachments;
},{"./attachment.js":2,"./query.js":5}],4:[function(require,module,exports){
/*globals jQuery, Backbone */
},{"./attachment.js":2,"./query.js":5}],4:[function(require,module,exports){
/**
* wp.media.model.PostImage
*
@ -1093,9 +1088,8 @@ PostImage = Backbone.Model.extend({
});
module.exports = PostImage;
},{"./attachment":2}],5:[function(require,module,exports){
/*globals jQuery, _, wp */
},{"./attachment":2}],5:[function(require,module,exports){
/**
* wp.media.model.Query
*
@ -1402,9 +1396,8 @@ Query = Attachments.extend({
});
module.exports = Query;
},{"./attachments.js":3}],6:[function(require,module,exports){
/*globals _ */
},{"./attachments.js":3}],6:[function(require,module,exports){
/**
* wp.media.model.Selection
*
@ -1500,4 +1493,5 @@ Selection = Attachments.extend({
});
module.exports = Selection;
},{"./attachments.js":3}]},{},[1]);

View File

@ -1,232 +1,229 @@
/* global _wpMediaModelsL10n:false */
var $ = jQuery,
Attachment, Attachments, l10n, media;
window.wp = window.wp || {};
(function($){
var Attachment, Attachments, l10n, media;
/**
* Create and return a media frame.
*
* Handles the default media experience.
*
* @param {object} attributes The properties passed to the main media controller.
* @return {wp.media.view.MediaFrame} A media workflow.
*/
media = wp.media = function( attributes ) {
var MediaFrame = media.view.MediaFrame,
frame;
if ( ! MediaFrame ) {
return;
}
attributes = _.defaults( attributes || {}, {
frame: 'select'
});
if ( 'select' === attributes.frame && MediaFrame.Select ) {
frame = new MediaFrame.Select( attributes );
} else if ( 'post' === attributes.frame && MediaFrame.Post ) {
frame = new MediaFrame.Post( attributes );
} else if ( 'manage' === attributes.frame && MediaFrame.Manage ) {
frame = new MediaFrame.Manage( attributes );
} else if ( 'image' === attributes.frame && MediaFrame.ImageDetails ) {
frame = new MediaFrame.ImageDetails( attributes );
} else if ( 'audio' === attributes.frame && MediaFrame.AudioDetails ) {
frame = new MediaFrame.AudioDetails( attributes );
} else if ( 'video' === attributes.frame && MediaFrame.VideoDetails ) {
frame = new MediaFrame.VideoDetails( attributes );
} else if ( 'edit-attachments' === attributes.frame && MediaFrame.EditAttachments ) {
frame = new MediaFrame.EditAttachments( attributes );
}
delete attributes.frame;
media.frame = frame;
return frame;
};
_.extend( media, { model: {}, view: {}, controller: {}, frames: {} });
// Link any localized strings.
l10n = media.model.l10n = window._wpMediaModelsL10n || {};
// Link any settings.
media.model.settings = l10n.settings || {};
delete l10n.settings;
Attachments = media.model.Attachments = require( './models/attachments.js' );
Attachment = media.model.Attachment = require( './models/attachment.js' );
media.model.Query = require( './models/query.js' );
media.model.PostImage = require( './models/post-image.js' );
media.model.Selection = require( './models/selection.js' );
/**
* ========================================================================
* UTILITIES
* ========================================================================
*/
/**
* A basic equality comparator for Backbone models.
*
* Used to order models within a collection - @see wp.media.model.Attachments.comparator().
*
* @param {mixed} a The primary parameter to compare.
* @param {mixed} b The primary parameter to compare.
* @param {string} ac The fallback parameter to compare, a's cid.
* @param {string} bc The fallback parameter to compare, b's cid.
* @return {number} -1: a should come before b.
* 0: a and b are of the same rank.
* 1: b should come before a.
*/
media.compare = function( a, b, ac, bc ) {
if ( _.isEqual( a, b ) ) {
return ac === bc ? 0 : (ac > bc ? -1 : 1);
} else {
return a > b ? -1 : 1;
}
};
_.extend( media, {
/**
* media.template( id )
*
* Fetch a JavaScript template for an id, and return a templating function for it.
*
* See wp.template() in `wp-includes/js/wp-util.js`.
*
* @borrows wp.template as template
*/
template: wp.template,
/**
* Create and return a media frame.
* media.post( [action], [data] )
*
* Handles the default media experience.
* Sends a POST request to WordPress.
* See wp.ajax.post() in `wp-includes/js/wp-util.js`.
*
* @param {object} attributes The properties passed to the main media controller.
* @return {wp.media.view.MediaFrame} A media workflow.
* @borrows wp.ajax.post as post
*/
media = wp.media = function( attributes ) {
var MediaFrame = media.view.MediaFrame,
frame;
post: wp.ajax.post,
if ( ! MediaFrame ) {
return;
/**
* media.ajax( [action], [options] )
*
* Sends an XHR request to WordPress.
* See wp.ajax.send() in `wp-includes/js/wp-util.js`.
*
* @borrows wp.ajax.send as ajax
*/
ajax: wp.ajax.send,
/**
* Scales a set of dimensions to fit within bounding dimensions.
*
* @param {Object} dimensions
* @returns {Object}
*/
fit: function( dimensions ) {
var width = dimensions.width,
height = dimensions.height,
maxWidth = dimensions.maxWidth,
maxHeight = dimensions.maxHeight,
constraint;
// Compare ratios between the two values to determine which
// max to constrain by. If a max value doesn't exist, then the
// opposite side is the constraint.
if ( ! _.isUndefined( maxWidth ) && ! _.isUndefined( maxHeight ) ) {
constraint = ( width / height > maxWidth / maxHeight ) ? 'width' : 'height';
} else if ( _.isUndefined( maxHeight ) ) {
constraint = 'width';
} else if ( _.isUndefined( maxWidth ) && height > maxHeight ) {
constraint = 'height';
}
attributes = _.defaults( attributes || {}, {
frame: 'select'
});
if ( 'select' === attributes.frame && MediaFrame.Select ) {
frame = new MediaFrame.Select( attributes );
} else if ( 'post' === attributes.frame && MediaFrame.Post ) {
frame = new MediaFrame.Post( attributes );
} else if ( 'manage' === attributes.frame && MediaFrame.Manage ) {
frame = new MediaFrame.Manage( attributes );
} else if ( 'image' === attributes.frame && MediaFrame.ImageDetails ) {
frame = new MediaFrame.ImageDetails( attributes );
} else if ( 'audio' === attributes.frame && MediaFrame.AudioDetails ) {
frame = new MediaFrame.AudioDetails( attributes );
} else if ( 'video' === attributes.frame && MediaFrame.VideoDetails ) {
frame = new MediaFrame.VideoDetails( attributes );
} else if ( 'edit-attachments' === attributes.frame && MediaFrame.EditAttachments ) {
frame = new MediaFrame.EditAttachments( attributes );
}
delete attributes.frame;
media.frame = frame;
return frame;
};
_.extend( media, { model: {}, view: {}, controller: {}, frames: {} });
// Link any localized strings.
l10n = media.model.l10n = typeof _wpMediaModelsL10n === 'undefined' ? {} : _wpMediaModelsL10n;
// Link any settings.
media.model.settings = l10n.settings || {};
delete l10n.settings;
Attachments = media.model.Attachments = require( './models/attachments.js' );
Attachment = media.model.Attachment = require( './models/attachment.js' );
media.model.Query = require( './models/query.js' );
media.model.PostImage = require( './models/post-image.js' );
media.model.Selection = require( './models/selection.js' );
/**
* ========================================================================
* UTILITIES
* ========================================================================
*/
/**
* A basic equality comparator for Backbone models.
*
* Used to order models within a collection - @see wp.media.model.Attachments.comparator().
*
* @param {mixed} a The primary parameter to compare.
* @param {mixed} b The primary parameter to compare.
* @param {string} ac The fallback parameter to compare, a's cid.
* @param {string} bc The fallback parameter to compare, b's cid.
* @return {number} -1: a should come before b.
* 0: a and b are of the same rank.
* 1: b should come before a.
*/
media.compare = function( a, b, ac, bc ) {
if ( _.isEqual( a, b ) ) {
return ac === bc ? 0 : (ac > bc ? -1 : 1);
// If the value of the constrained side is larger than the max,
// then scale the values. Otherwise return the originals; they fit.
if ( 'width' === constraint && width > maxWidth ) {
return {
width : maxWidth,
height: Math.round( maxWidth * height / width )
};
} else if ( 'height' === constraint && height > maxHeight ) {
return {
width : Math.round( maxHeight * width / height ),
height: maxHeight
};
} else {
return a > b ? -1 : 1;
return {
width : width,
height: height
};
}
};
},
/**
* Truncates a string by injecting an ellipsis into the middle.
* Useful for filenames.
*
* @param {String} string
* @param {Number} [length=30]
* @param {String} [replacement=&hellip;]
* @returns {String} The string, unless length is greater than string.length.
*/
truncate: function( string, length, replacement ) {
length = length || 30;
replacement = replacement || '&hellip;';
_.extend( media, {
/**
* media.template( id )
*
* Fetch a JavaScript template for an id, and return a templating function for it.
*
* See wp.template() in `wp-includes/js/wp-util.js`.
*
* @borrows wp.template as template
*/
template: wp.template,
/**
* media.post( [action], [data] )
*
* Sends a POST request to WordPress.
* See wp.ajax.post() in `wp-includes/js/wp-util.js`.
*
* @borrows wp.ajax.post as post
*/
post: wp.ajax.post,
/**
* media.ajax( [action], [options] )
*
* Sends an XHR request to WordPress.
* See wp.ajax.send() in `wp-includes/js/wp-util.js`.
*
* @borrows wp.ajax.send as ajax
*/
ajax: wp.ajax.send,
/**
* Scales a set of dimensions to fit within bounding dimensions.
*
* @param {Object} dimensions
* @returns {Object}
*/
fit: function( dimensions ) {
var width = dimensions.width,
height = dimensions.height,
maxWidth = dimensions.maxWidth,
maxHeight = dimensions.maxHeight,
constraint;
// Compare ratios between the two values to determine which
// max to constrain by. If a max value doesn't exist, then the
// opposite side is the constraint.
if ( ! _.isUndefined( maxWidth ) && ! _.isUndefined( maxHeight ) ) {
constraint = ( width / height > maxWidth / maxHeight ) ? 'width' : 'height';
} else if ( _.isUndefined( maxHeight ) ) {
constraint = 'width';
} else if ( _.isUndefined( maxWidth ) && height > maxHeight ) {
constraint = 'height';
}
// If the value of the constrained side is larger than the max,
// then scale the values. Otherwise return the originals; they fit.
if ( 'width' === constraint && width > maxWidth ) {
return {
width : maxWidth,
height: Math.round( maxWidth * height / width )
};
} else if ( 'height' === constraint && height > maxHeight ) {
return {
width : Math.round( maxHeight * width / height ),
height: maxHeight
};
} else {
return {
width : width,
height: height
};
}
},
/**
* Truncates a string by injecting an ellipsis into the middle.
* Useful for filenames.
*
* @param {String} string
* @param {Number} [length=30]
* @param {String} [replacement=&hellip;]
* @returns {String} The string, unless length is greater than string.length.
*/
truncate: function( string, length, replacement ) {
length = length || 30;
replacement = replacement || '&hellip;';
if ( string.length <= length ) {
return string;
}
return string.substr( 0, length / 2 ) + replacement + string.substr( -1 * length / 2 );
if ( string.length <= length ) {
return string;
}
return string.substr( 0, length / 2 ) + replacement + string.substr( -1 * length / 2 );
}
});
/**
* ========================================================================
* MODELS
* ========================================================================
*/
/**
* wp.media.attachment
*
* @static
* @param {String} id A string used to identify a model.
* @returns {wp.media.model.Attachment}
*/
media.attachment = function( id ) {
return Attachment.get( id );
};
/**
* A collection of all attachments that have been fetched from the server.
*
* @static
* @member {wp.media.model.Attachments}
*/
Attachments.all = new Attachments();
/**
* wp.media.query
*
* Shorthand for creating a new Attachments Query.
*
* @param {object} [props]
* @returns {wp.media.model.Attachments}
*/
media.query = function( props ) {
return new Attachments( null, {
props: _.extend( _.defaults( props || {}, { orderby: 'date' } ), { query: true } )
});
};
/**
* ========================================================================
* MODELS
* ========================================================================
*/
/**
* wp.media.attachment
*
* @static
* @param {String} id A string used to identify a model.
* @returns {wp.media.model.Attachment}
*/
media.attachment = function( id ) {
return Attachment.get( id );
};
/**
* A collection of all attachments that have been fetched from the server.
*
* @static
* @member {wp.media.model.Attachments}
*/
Attachments.all = new Attachments();
/**
* wp.media.query
*
* Shorthand for creating a new Attachments Query.
*
* @param {object} [props]
* @returns {wp.media.model.Attachments}
*/
media.query = function( props ) {
return new Attachments( null, {
props: _.extend( _.defaults( props || {}, { orderby: 'date' } ), { query: true } )
});
};
// Clean up. Prevents mobile browsers caching
$(window).on('unload', function(){
window.wp = null;
});
}(jQuery));
// Clean up. Prevents mobile browsers caching
$(window).on('unload', function(){
window.wp = null;
});

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,3 @@
/*globals jQuery, Backbone, _, wp */
/**
* wp.media.model.Attachment
*
@ -128,7 +126,7 @@ Attachment = Backbone.Model.extend({
return $.Deferred().rejectWith( this ).promise();
}
return media.post( 'save-attachment-compat', _.defaults({
return wp.media.post( 'save-attachment-compat', _.defaults({
id: this.id,
nonce: this.get('nonces').update,
post_id: wp.media.model.settings.post.id
@ -165,4 +163,4 @@ Attachment = Backbone.Model.extend({
})
});
module.exports = Attachment;
module.exports = Attachment;

View File

@ -1,5 +1,3 @@
/*globals jQuery, Backbone, _, wp */
/**
* wp.media.model.Attachments
*
@ -323,8 +321,9 @@ Attachments = Backbone.Collection.extend({
// checking if we're still mirroring that collection when
// the request resolves.
mirroring.more( options ).done( function() {
if ( this === attachments.mirroring )
if ( this === attachments.mirroring ) {
deferred.resolveWith( this );
}
});
return deferred.promise();
@ -532,4 +531,4 @@ Attachments = Backbone.Collection.extend({
}
});
module.exports = Attachments;
module.exports = Attachments;

View File

@ -1,5 +1,3 @@
/*globals jQuery, Backbone */
/**
* wp.media.model.PostImage
*
@ -153,4 +151,4 @@ PostImage = Backbone.Model.extend({
}
});
module.exports = PostImage;
module.exports = PostImage;

View File

@ -1,5 +1,3 @@
/*globals Backbone, _, wp */
/**
* Shared model class for audio and video. Updates the model after
* "Add Audio|Video Source" and "Replace Audio|Video" states return
@ -37,4 +35,4 @@ var PostMedia = Backbone.Model.extend({
}
});
module.exports = PostMedia;
module.exports = PostMedia;

View File

@ -1,5 +1,3 @@
/*globals jQuery, _, wp */
/**
* wp.media.model.Query
*
@ -305,4 +303,4 @@ Query = Attachments.extend({
}())
});
module.exports = Query;
module.exports = Query;

View File

@ -1,5 +1,3 @@
/*globals _ */
/**
* wp.media.model.Selection
*
@ -94,4 +92,4 @@ Selection = Attachments.extend({
}
});
module.exports = Selection;
module.exports = Selection;

View File

@ -1,5 +1,3 @@
/*globals jQuery, Backbone */
/**
* A router for handling the browser history and application state.
*
@ -43,4 +41,4 @@ var Router = Backbone.Router.extend({
}
});
module.exports = Router;
module.exports = Router;

View File

@ -1,5 +1,3 @@
/*globals _ */
/**
* wp.media.selectionSync
*
@ -63,4 +61,4 @@ var selectionSync = {
}
};
module.exports = selectionSync;
module.exports = selectionSync;

File diff suppressed because it is too large Load Diff

View File

@ -1,148 +1,145 @@
/* global _wpMediaViewsL10n, confirm, getUserSetting, setUserSetting */
( function( $, _ ) {
var l10n,
media = wp.media;
var media = wp.media,
$ = jQuery,
l10n;
media.isTouchDevice = ( 'ontouchend' in document );
media.isTouchDevice = ( 'ontouchend' in document );
// Link any localized strings.
l10n = media.view.l10n = typeof _wpMediaViewsL10n === 'undefined' ? {} : _wpMediaViewsL10n;
// Link any localized strings.
l10n = media.view.l10n = window._wpMediaViewsL10n || {};
// Link any settings.
media.view.settings = l10n.settings || {};
delete l10n.settings;
// Link any settings.
media.view.settings = l10n.settings || {};
delete l10n.settings;
// Copy the `post` setting over to the model settings.
media.model.settings.post = media.view.settings.post;
// Copy the `post` setting over to the model settings.
media.model.settings.post = media.view.settings.post;
// Check if the browser supports CSS 3.0 transitions
$.support.transition = (function(){
var style = document.documentElement.style,
transitions = {
WebkitTransition: 'webkitTransitionEnd',
MozTransition: 'transitionend',
OTransition: 'oTransitionEnd otransitionend',
transition: 'transitionend'
}, transition;
// Check if the browser supports CSS 3.0 transitions
$.support.transition = (function(){
var style = document.documentElement.style,
transitions = {
WebkitTransition: 'webkitTransitionEnd',
MozTransition: 'transitionend',
OTransition: 'oTransitionEnd otransitionend',
transition: 'transitionend'
}, transition;
transition = _.find( _.keys( transitions ), function( transition ) {
return ! _.isUndefined( style[ transition ] );
});
transition = _.find( _.keys( transitions ), function( transition ) {
return ! _.isUndefined( style[ transition ] );
});
return transition && {
end: transitions[ transition ]
};
}());
return transition && {
end: transitions[ transition ]
};
}());
/**
* A shared event bus used to provide events into
* the media workflows that 3rd-party devs can use to hook
* in.
*/
media.events = _.extend( {}, Backbone.Events );
/**
* A shared event bus used to provide events into
* the media workflows that 3rd-party devs can use to hook
* in.
*/
media.events = _.extend( {}, Backbone.Events );
/**
* Makes it easier to bind events using transitions.
*
* @param {string} selector
* @param {Number} sensitivity
* @returns {Promise}
*/
media.transition = function( selector, sensitivity ) {
var deferred = $.Deferred();
/**
* Makes it easier to bind events using transitions.
*
* @param {string} selector
* @param {Number} sensitivity
* @returns {Promise}
*/
media.transition = function( selector, sensitivity ) {
var deferred = $.Deferred();
sensitivity = sensitivity || 2000;
sensitivity = sensitivity || 2000;
if ( $.support.transition ) {
if ( ! (selector instanceof $) ) {
selector = $( selector );
}
// Resolve the deferred when the first element finishes animating.
selector.first().one( $.support.transition.end, deferred.resolve );
// Just in case the event doesn't trigger, fire a callback.
_.delay( deferred.resolve, sensitivity );
// Otherwise, execute on the spot.
} else {
deferred.resolve();
if ( $.support.transition ) {
if ( ! (selector instanceof $) ) {
selector = $( selector );
}
return deferred.promise();
};
// Resolve the deferred when the first element finishes animating.
selector.first().one( $.support.transition.end, deferred.resolve );
media.controller.Region = require( './controllers/region.js' );
media.controller.StateMachine = require( './controllers/state-machine.js' );
media.controller.State = require( './controllers/state.js' );
// Just in case the event doesn't trigger, fire a callback.
_.delay( deferred.resolve, sensitivity );
media.selectionSync = require( './utils/selection-sync.js' );
media.controller.Library = require( './controllers/library.js' );
media.controller.ImageDetails = require( './controllers/image-details.js' );
media.controller.GalleryEdit = require( './controllers/gallery-edit.js' );
media.controller.GalleryAdd = require( './controllers/gallery-add.js' );
media.controller.CollectionEdit = require( './controllers/collection-edit.js' );
media.controller.CollectionAdd = require( './controllers/collection-add.js' );
media.controller.FeaturedImage = require( './controllers/featured-image.js' );
media.controller.ReplaceImage = require( './controllers/replace-image.js' );
media.controller.EditImage = require( './controllers/edit-image.js' );
media.controller.MediaLibrary = require( './controllers/media-library.js' );
media.controller.Embed = require( './controllers/embed.js' );
media.controller.Cropper = require( './controllers/cropper.js' );
// Otherwise, execute on the spot.
} else {
deferred.resolve();
}
media.View = require( './views/view.js' );
media.view.Frame = require( './views/view.js' );
media.view.MediaFrame = require( './views/media-frame.js' );
media.view.MediaFrame.Select = require( './views/frame/select.js' );
media.view.MediaFrame.Post = require( './views/frame/post.js' );
media.view.MediaFrame.ImageDetails = require( './views/frame/image-details.js' );
media.view.Modal = require( './views/modal.js' );
media.view.FocusManager = require( './views/focus-manager.js' );
media.view.UploaderWindow = require( './views/uploader/window.js' );
media.view.EditorUploader = require( './views/uploader/editor.js' );
media.view.UploaderInline = require( './views/uploader/inline.js' );
media.view.UploaderStatus = require( './views/uploader/status.js' );
media.view.UploaderStatusError = require( './views/uploader/status-error.js' );
media.view.Toolbar = require( './views/toolbar.js' );
media.view.Toolbar.Select = require( './views/toolbar/select.js' );
media.view.Toolbar.Embed = require( './views/toolbar/embed.js' );
media.view.Button = require( './views/button.js' );
media.view.ButtonGroup = require( './views/button-group.js' );
media.view.PriorityList = require( './views/priority-list.js' );
media.view.MenuItem = require( './views/menu-item.js' );
media.view.Menu = require( './views/menu.js' );
media.view.RouterItem = require( './views/router-item.js' );
media.view.Router = require( './views/router.js' );
media.view.Sidebar = require( './views/sidebar.js' );
media.view.Attachment = require( './views/attachment.js' );
media.view.Attachment.Library = require( './views/attachment/library.js' );
media.view.Attachment.EditLibrary = require( './views/attachment/edit-library.js' );
media.view.Attachments = require( './views/attachments.js' );
media.view.Search = require( './views/search.js' );
media.view.AttachmentFilters = require( './views/attachment-filters.js' );
media.view.DateFilter = require( './views/attachment-filters/date.js' );
media.view.AttachmentFilters.Uploaded = require( './views/attachment-filters/uploaded.js' );
media.view.AttachmentFilters.All = require( './views/attachment-filters/all.js' );
media.view.AttachmentsBrowser = require( './views/attachments/browser.js' );
media.view.Selection = require( './views/selection.js' );
media.view.Attachment.Selection = require( './views/attachment/selection.js' );
media.view.Attachments.Selection = require( './views/attachments/selection.js' );
media.view.Attachment.EditSelection = require( './views/attachment/edit-selection.js' );
media.view.Settings = require( './views/settings.js' );
media.view.Settings.AttachmentDisplay = require( './views/settings/attachment-display.js' );
media.view.Settings.Gallery = require( './views/settings/gallery.js' );
media.view.Settings.Playlist = require( './views/settings/playlist.js' );
media.view.Attachment.Details = require( './views/attachment/details.js' );
media.view.AttachmentCompat = require( './views/attachment-compat.js' );
media.view.Iframe = require( './views/iframe.js' );
media.view.Embed = require( './views/embed.js' );
media.view.Label = require( './views/label.js' );
media.view.EmbedUrl = require( './views/embed/url.js' );
media.view.EmbedLink = require( './views/embed/link.js' );
media.view.EmbedImage = require( './views/embed/image.js' );
media.view.ImageDetails = require( './views/image-details.js' );
media.view.Cropper = require( './views/cropper.js' );
media.view.EditImage = require( './views/edit-image.js' );
media.view.Spinner = require( './views/spinner.js' );
return deferred.promise();
};
}(jQuery, _));
media.controller.Region = require( './controllers/region.js' );
media.controller.StateMachine = require( './controllers/state-machine.js' );
media.controller.State = require( './controllers/state.js' );
media.selectionSync = require( './utils/selection-sync.js' );
media.controller.Library = require( './controllers/library.js' );
media.controller.ImageDetails = require( './controllers/image-details.js' );
media.controller.GalleryEdit = require( './controllers/gallery-edit.js' );
media.controller.GalleryAdd = require( './controllers/gallery-add.js' );
media.controller.CollectionEdit = require( './controllers/collection-edit.js' );
media.controller.CollectionAdd = require( './controllers/collection-add.js' );
media.controller.FeaturedImage = require( './controllers/featured-image.js' );
media.controller.ReplaceImage = require( './controllers/replace-image.js' );
media.controller.EditImage = require( './controllers/edit-image.js' );
media.controller.MediaLibrary = require( './controllers/media-library.js' );
media.controller.Embed = require( './controllers/embed.js' );
media.controller.Cropper = require( './controllers/cropper.js' );
media.View = require( './views/view.js' );
media.view.Frame = require( './views/view.js' );
media.view.MediaFrame = require( './views/media-frame.js' );
media.view.MediaFrame.Select = require( './views/frame/select.js' );
media.view.MediaFrame.Post = require( './views/frame/post.js' );
media.view.MediaFrame.ImageDetails = require( './views/frame/image-details.js' );
media.view.Modal = require( './views/modal.js' );
media.view.FocusManager = require( './views/focus-manager.js' );
media.view.UploaderWindow = require( './views/uploader/window.js' );
media.view.EditorUploader = require( './views/uploader/editor.js' );
media.view.UploaderInline = require( './views/uploader/inline.js' );
media.view.UploaderStatus = require( './views/uploader/status.js' );
media.view.UploaderStatusError = require( './views/uploader/status-error.js' );
media.view.Toolbar = require( './views/toolbar.js' );
media.view.Toolbar.Select = require( './views/toolbar/select.js' );
media.view.Toolbar.Embed = require( './views/toolbar/embed.js' );
media.view.Button = require( './views/button.js' );
media.view.ButtonGroup = require( './views/button-group.js' );
media.view.PriorityList = require( './views/priority-list.js' );
media.view.MenuItem = require( './views/menu-item.js' );
media.view.Menu = require( './views/menu.js' );
media.view.RouterItem = require( './views/router-item.js' );
media.view.Router = require( './views/router.js' );
media.view.Sidebar = require( './views/sidebar.js' );
media.view.Attachment = require( './views/attachment.js' );
media.view.Attachment.Library = require( './views/attachment/library.js' );
media.view.Attachment.EditLibrary = require( './views/attachment/edit-library.js' );
media.view.Attachments = require( './views/attachments.js' );
media.view.Search = require( './views/search.js' );
media.view.AttachmentFilters = require( './views/attachment-filters.js' );
media.view.DateFilter = require( './views/attachment-filters/date.js' );
media.view.AttachmentFilters.Uploaded = require( './views/attachment-filters/uploaded.js' );
media.view.AttachmentFilters.All = require( './views/attachment-filters/all.js' );
media.view.AttachmentsBrowser = require( './views/attachments/browser.js' );
media.view.Selection = require( './views/selection.js' );
media.view.Attachment.Selection = require( './views/attachment/selection.js' );
media.view.Attachments.Selection = require( './views/attachments/selection.js' );
media.view.Attachment.EditSelection = require( './views/attachment/edit-selection.js' );
media.view.Settings = require( './views/settings.js' );
media.view.Settings.AttachmentDisplay = require( './views/settings/attachment-display.js' );
media.view.Settings.Gallery = require( './views/settings/gallery.js' );
media.view.Settings.Playlist = require( './views/settings/playlist.js' );
media.view.Attachment.Details = require( './views/attachment/details.js' );
media.view.AttachmentCompat = require( './views/attachment-compat.js' );
media.view.Iframe = require( './views/iframe.js' );
media.view.Embed = require( './views/embed.js' );
media.view.Label = require( './views/label.js' );
media.view.EmbedUrl = require( './views/embed/url.js' );
media.view.EmbedLink = require( './views/embed/link.js' );
media.view.EmbedImage = require( './views/embed/image.js' );
media.view.ImageDetails = require( './views/image-details.js' );
media.view.Cropper = require( './views/cropper.js' );
media.view.EditImage = require( './views/edit-image.js' );
media.view.Spinner = require( './views/spinner.js' );

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,3 @@
/*globals _ */
/**
* wp.media.view.AttachmentCompat
*
@ -82,4 +80,4 @@ AttachmentCompat = View.extend({
}
});
module.exports = AttachmentCompat;
module.exports = AttachmentCompat;

View File

@ -1,5 +1,3 @@
/*globals _, jQuery */
/**
* wp.media.view.AttachmentFilters
*
@ -75,4 +73,4 @@ AttachmentFilters = View.extend({
}
});
module.exports = AttachmentFilters;
module.exports = AttachmentFilters;

View File

@ -1,5 +1,3 @@
/*globals _, wp */
/**
* wp.media.view.AttachmentFilters.All
*
@ -88,4 +86,4 @@ All = AttachmentFilters.extend({
}
});
module.exports = All;
module.exports = All;

View File

@ -1,5 +1,3 @@
/*globals _, wp */
/**
* A filter dropdown for month/dates.
*
@ -39,4 +37,4 @@ DateFilter = AttachmentFilters.extend({
}
});
module.exports = DateFilter;
module.exports = DateFilter;

View File

@ -1,5 +1,3 @@
/*globals wp */
/**
* wp.media.view.AttachmentFilters.Uploaded
*
@ -57,4 +55,4 @@ Uploaded = AttachmentFilters.extend({
}
});
module.exports = Uploaded;
module.exports = Uploaded;

View File

@ -1,5 +1,3 @@
/*globals _, wp, jQuery */
/**
* wp.media.view.Attachment
*
@ -551,4 +549,4 @@ _.each({
};
});
module.exports = Attachment;
module.exports = Attachment;

View File

@ -1,5 +1,3 @@
/*globals wp */
/**
* A similar view to media.view.Attachment.Details
* for use in the Edit Attachment modal.
@ -34,9 +32,9 @@ TwoColumn = Details.extend({
wp.media.mixin.removeAllPlayers();
this.$( 'audio, video' ).each( function (i, elem) {
var el = MediaDetails.prepareSrc( elem );
new MediaElementPlayer( el, wp.media.mixin.mejsSettings );
new window.MediaElementPlayer( el, wp.media.mixin.mejsSettings );
} );
}
});
module.exports = TwoColumn;
module.exports = TwoColumn;

View File

@ -1,5 +1,3 @@
/*globals _, wp */
/**
* wp.media.view.Attachment.Details
*
@ -59,7 +57,7 @@ Details = Attachment.extend({
deleteAttachment: function( event ) {
event.preventDefault();
if ( confirm( l10n.warnDelete ) ) {
if ( window.confirm( l10n.warnDelete ) ) {
this.model.destroy();
// Keep focus inside media modal
// after image is deleted
@ -137,4 +135,4 @@ Details = Attachment.extend({
}
});
module.exports = Details;
module.exports = Details;

View File

@ -16,4 +16,4 @@ EditLibrary = Attachment.extend({
}
});
module.exports = EditLibrary;
module.exports = EditLibrary;

View File

@ -17,4 +17,4 @@ EditSelection = Selection.extend({
}
});
module.exports = EditSelection;
module.exports = EditSelection;

View File

@ -16,4 +16,4 @@ Library = Attachment.extend({
}
});
module.exports = Library;
module.exports = Library;

View File

@ -20,4 +20,4 @@ Selection = Attachment.extend({
}
});
module.exports = Selection;
module.exports = Selection;

View File

@ -1,5 +1,3 @@
/*globals _, wp, jQuery */
/**
* wp.media.view.Attachments
*
@ -272,7 +270,7 @@ Attachments = View.extend({
// The scroll event occurs on the document, but the element
// that should be checked is the document body.
if ( el == document ) {
if ( el === document ) {
el = document.body;
scrollTop = $(document).scrollTop();
}
@ -297,4 +295,4 @@ Attachments = View.extend({
}
});
module.exports = Attachments;
module.exports = Attachments;

View File

@ -1,5 +1,3 @@
/*globals _, wp, jQuery */
/**
* wp.media.view.AttachmentsBrowser
*
@ -190,13 +188,13 @@ AttachmentsBrowser = View.extend({
return;
}
if ( ! mediaTrash && ! confirm( l10n.warnBulkDelete ) ) {
if ( ! mediaTrash && ! window.confirm( l10n.warnBulkDelete ) ) {
return;
}
if ( mediaTrash &&
'trash' !== selection.at( 0 ).get( 'status' ) &&
! confirm( l10n.warnBulkTrash ) ) {
! window.confirm( l10n.warnBulkTrash ) ) {
return;
}
@ -244,7 +242,7 @@ AttachmentsBrowser = View.extend({
click: function() {
var removed = [], selection = this.controller.state().get( 'selection' );
if ( ! selection.length || ! confirm( l10n.warnBulkDelete ) ) {
if ( ! selection.length || ! window.confirm( l10n.warnBulkDelete ) ) {
return;
}
@ -456,4 +454,4 @@ AttachmentsBrowser = View.extend({
}
});
module.exports = AttachmentsBrowser;
module.exports = AttachmentsBrowser;

View File

@ -1,5 +1,3 @@
/*globals _ */
/**
* wp.media.view.Attachments.Selection
*
@ -28,4 +26,4 @@ Selection = Attachments.extend({
}
});
module.exports = Selection;
module.exports = Selection;

View File

@ -1,5 +1,3 @@
/*globals wp */
/**
* wp.media.view.AudioDetails
*
@ -35,4 +33,4 @@ AudioDetails = MediaDetails.extend({
}
});
module.exports = AudioDetails;
module.exports = AudioDetails;

View File

@ -1,5 +1,3 @@
/*globals _, Backbone, jQuery */
/**
* wp.media.view.ButtonGroup
*
@ -45,4 +43,4 @@ ButtonGroup = View.extend({
}
});
module.exports = ButtonGroup;
module.exports = ButtonGroup;

View File

@ -1,5 +1,3 @@
/*globals _, Backbone */
/**
* wp.media.view.Button
*
@ -86,4 +84,4 @@ Button = View.extend({
}
});
module.exports = Button;
module.exports = Button;

View File

@ -40,4 +40,4 @@ DeleteSelectedPermanently = DeleteSelected.extend({
}
});
module.exports = DeleteSelectedPermanently;
module.exports = DeleteSelectedPermanently;

View File

@ -1,5 +1,3 @@
/*globals wp */
/**
* A button that handles bulk Delete/Trash logic
*
@ -48,4 +46,4 @@ DeleteSelected = Button.extend({
}
});
module.exports = DeleteSelected;
module.exports = DeleteSelected;

View File

@ -1,5 +1,3 @@
/*globals wp */
var Button = require( '../button.js' ),
l10n = wp.media.view.l10n,
SelectModeToggle;
@ -52,4 +50,4 @@ SelectModeToggle = Button.extend({
}
});
module.exports = SelectModeToggle;
module.exports = SelectModeToggle;

View File

@ -1,5 +1,3 @@
/*globals _, wp, jQuery */
/**
* wp.media.view.Cropper
*
@ -60,9 +58,9 @@ Cropper = View.extend({
this.views.add( '.upload-errors', new UploaderStatusError({
filename: UploaderStatus.prototype.filename(filename),
message: _wpMediaViewsL10n.cropError
message: window._wpMediaViewsL10n.cropError
}), { at: 0 });
}
});
module.exports = Cropper;
module.exports = Cropper;

View File

@ -21,4 +21,4 @@ Details = EditImage.extend({
}
});
module.exports = Details;
module.exports = Details;

View File

@ -1,5 +1,3 @@
/*globals _, wp */
var View = require( './view.js' ),
EditImage;
@ -50,4 +48,4 @@ EditImage = View.extend({
});
module.exports = EditImage;
module.exports = EditImage;

View File

@ -65,4 +65,4 @@ Embed = View.extend({
}
});
module.exports = Embed;
module.exports = Embed;

View File

@ -1,5 +1,3 @@
/*globals wp */
/**
* wp.media.view.EmbedImage
*
@ -30,4 +28,4 @@ EmbedImage = AttachmentDisplay.extend({
}
});
module.exports = EmbedImage;
module.exports = EmbedImage;

View File

@ -1,5 +1,3 @@
/*globals _, wp, jQuery */
/**
* wp.media.view.EmbedLink
*
@ -64,4 +62,4 @@ EmbedLink = Settings.extend({
}
});
module.exports = EmbedLink;
module.exports = EmbedLink;

View File

@ -1,5 +1,3 @@
/*globals _, wp, jQuery */
/**
* wp.media.view.EmbedUrl
*
@ -76,4 +74,4 @@ EmbedUrl = View.extend({
}
});
module.exports = EmbedUrl;
module.exports = EmbedUrl;

View File

@ -44,4 +44,4 @@ FocusManager = View.extend({
});
module.exports = FocusManager;
module.exports = FocusManager;

View File

@ -1,5 +1,3 @@
/*globals _, Backbone */
/**
* wp.media.view.Frame
*
@ -169,4 +167,4 @@ Frame = View.extend({
// Make the `Frame` a `StateMachine`.
_.extend( Frame.prototype, StateMachine.prototype );
module.exports = Frame;
module.exports = Frame;

View File

@ -1,5 +1,3 @@
/*globals wp */
/**
* wp.media.view.MediaFrame.AudioDetails
*
@ -74,4 +72,4 @@ AudioDetails = MediaDetails.extend({
}
});
module.exports = AudioDetails;
module.exports = AudioDetails;

View File

@ -1,5 +1,3 @@
/*globals _, wp, jQuery */
/**
* A frame for editing the details of a specific media item.
*
@ -243,4 +241,4 @@ EditAttachments = MediaFrame.extend({
}
});
module.exports = EditAttachments;
module.exports = EditAttachments;

View File

@ -1,5 +1,3 @@
/*globals wp */
/**
* wp.media.view.MediaFrame.ImageDetails
*
@ -180,4 +178,4 @@ ImageDetails = Select.extend({
});
module.exports = ImageDetails;
module.exports = ImageDetails;

View File

@ -1,5 +1,3 @@
/*globals _, Backbone, wp, jQuery */
/**
* wp.media.view.MediaFrame.Manage
*
@ -237,11 +235,11 @@ Manage = MediaFrame.extend({
// Verify pushState support and activate
if ( window.history && window.history.pushState ) {
Backbone.history.start( {
root: _wpMediaGridSettings.adminUrl,
root: window._wpMediaGridSettings.adminUrl,
pushState: true
} );
}
}
});
module.exports = Manage;
module.exports = Manage;

View File

@ -1,5 +1,3 @@
/*globals wp */
/**
* wp.media.view.MediaFrame.MediaDetails
*
@ -129,4 +127,4 @@ MediaDetails = Select.extend({
}
});
module.exports = MediaDetails;
module.exports = MediaDetails;

View File

@ -1,5 +1,3 @@
/*globals _, wp */
/**
* wp.media.view.MediaFrame.Post
*
@ -748,4 +746,4 @@ Post = Select.extend({
}
});
module.exports = Post;
module.exports = Post;

View File

@ -1,5 +1,3 @@
/*globals _, wp */
/**
* wp.media.view.MediaFrame.Select
*
@ -171,4 +169,4 @@ Select = MediaFrame.extend({
}
});
module.exports = Select;
module.exports = Select;

View File

@ -1,5 +1,3 @@
/*globals _, wp */
/**
* wp.media.view.MediaFrame.VideoDetails
*
@ -134,4 +132,4 @@ VideoDetails = MediaDetails.extend({
}
});
module.exports = VideoDetails;
module.exports = VideoDetails;

View File

@ -22,4 +22,4 @@ Iframe = View.extend({
}
});
module.exports = Iframe;
module.exports = Iframe;

View File

@ -1,5 +1,3 @@
/*globals _, wp, jQuery */
/**
* wp.media.view.ImageDetails
*
@ -73,7 +71,7 @@ ImageDetails = AttachmentDisplay.extend({
postRender: function() {
setTimeout( _.bind( this.resetFocus, this ), 10 );
this.toggleLinkSettings();
if ( getUserSetting( 'advImgDetails' ) === 'show' ) {
if ( window.getUserSetting( 'advImgDetails' ) === 'show' ) {
this.toggleAdvanced( true );
}
this.trigger( 'post-render' );
@ -146,7 +144,7 @@ ImageDetails = AttachmentDisplay.extend({
mode = 'show';
}
setUserSetting( 'advImgDetails', mode );
window.setUserSetting( 'advImgDetails', mode );
},
editAttachment: function( event ) {
@ -165,4 +163,4 @@ ImageDetails = AttachmentDisplay.extend({
}
});
module.exports = AttachmentDisplay;
module.exports = AttachmentDisplay;

View File

@ -22,4 +22,4 @@ Label = View.extend({
}
});
module.exports = Label;
module.exports = Label;

View File

@ -1,5 +1,3 @@
/*globals _, wp, jQuery */
/**
* wp.media.view.MediaDetails
*
@ -83,7 +81,7 @@ MediaDetails = AttachmentDisplay.extend({
*/
setPlayer : function() {
if ( ! this.players.length && this.media ) {
this.players.push( new MediaElementPlayer( this.media, this.settings ) );
this.players.push( new window.MediaElementPlayer( this.media, this.settings ) );
}
},
@ -111,7 +109,7 @@ MediaDetails = AttachmentDisplay.extend({
*/
render: function() {
AttachmentDisplay.prototype.render.apply( this, arguments );
setTimeout( _.bind( function() {
this.resetFocus();
}, this ), 10 );
@ -149,4 +147,4 @@ MediaDetails = AttachmentDisplay.extend({
}
});
module.exports = MediaDetails;
module.exports = MediaDetails;

View File

@ -1,5 +1,3 @@
/*globals _, wp, jQuery */
/**
* wp.media.view.MediaFrame
*
@ -251,4 +249,4 @@ _.each(['open','close','attach','detach','escape'], function( method ) {
};
});
module.exports = MediaFrame;
module.exports = MediaFrame;

View File

@ -1,5 +1,3 @@
/*globals wp, jQuery */
/**
* wp.media.view.MenuItem
*
@ -70,4 +68,4 @@ MenuItem = View.extend({
}
});
module.exports = MenuItem;
module.exports = MenuItem;

View File

@ -112,4 +112,4 @@ Menu = PriorityList.extend({
}
});
module.exports = Menu;
module.exports = Menu;

View File

@ -1,5 +1,3 @@
/*globals _, wp, jQuery */
/**
* wp.media.view.Modal
*
@ -212,4 +210,4 @@ Modal = View.extend({
}
});
module.exports = Modal;
module.exports = Modal;

View File

@ -1,5 +1,3 @@
/*globals _, Backbone */
/**
* wp.media.view.PriorityList
*
@ -97,4 +95,4 @@ PriorityList = View.extend({
}
});
module.exports = PriorityList;
module.exports = PriorityList;

View File

@ -22,4 +22,4 @@ RouterItem = MenuItem.extend({
}
});
module.exports = RouterItem;
module.exports = RouterItem;

View File

@ -33,4 +33,4 @@ Router = Menu.extend({
}
});
module.exports = Router;
module.exports = Router;

View File

@ -1,5 +1,3 @@
/*globals wp */
/**
* wp.media.view.Search
*
@ -46,4 +44,4 @@ Search = View.extend({
}
});
module.exports = Search;
module.exports = Search;

View File

@ -1,5 +1,3 @@
/*globals _, Backbone, wp */
/**
* wp.media.view.Selection
*
@ -82,4 +80,4 @@ Selection = View.extend({
}
});
module.exports = Selection;
module.exports = Selection;

View File

@ -1,5 +1,3 @@
/*globals _, Backbone, jQuery */
/**
* wp.media.view.Settings
*
@ -107,7 +105,7 @@ Settings = View.extend({
// If the setting has a corresponding user setting,
// update that as well.
if ( userSetting = $setting.data('userSetting') ) {
setUserSetting( userSetting, value );
window.setUserSetting( userSetting, value );
}
},
@ -118,4 +116,4 @@ Settings = View.extend({
}
});
module.exports = Settings;
module.exports = Settings;

View File

@ -1,5 +1,3 @@
/*globals _, wp */
/**
* wp.media.view.Settings.AttachmentDisplay
*
@ -91,4 +89,4 @@ AttachmentDisplay = Settings.extend({
}
});
module.exports = AttachmentDisplay;
module.exports = AttachmentDisplay;

View File

@ -1,5 +1,3 @@
/*globals wp */
/**
* wp.media.view.Settings.Gallery
*
@ -17,4 +15,4 @@ Gallery = Settings.extend({
template: wp.template('gallery-settings')
});
module.exports = Gallery;
module.exports = Gallery;

View File

@ -1,5 +1,3 @@
/*globals wp */
/**
* wp.media.view.Settings.Playlist
*
@ -17,4 +15,4 @@ Playlist = Settings.extend({
template: wp.template('playlist-settings')
});
module.exports = Playlist;
module.exports = Playlist;

View File

@ -14,4 +14,4 @@ Sidebar = PriorityList.extend({
className: 'media-sidebar'
});
module.exports = Sidebar;
module.exports = Sidebar;

View File

@ -1,5 +1,3 @@
/*globals _, wp */
/**
* wp.media.view.Spinner
*
@ -35,4 +33,4 @@ Spinner = View.extend({
}
});
module.exports = Spinner;
module.exports = Spinner;

View File

@ -1,5 +1,3 @@
/*globals Backbone, _ */
/**
* wp.media.view.Toolbar
*
@ -159,4 +157,4 @@ Toolbar = View.extend({
}
});
module.exports = Toolbar;
module.exports = Toolbar;

View File

@ -1,5 +1,3 @@
/*globals _, wp */
/**
* wp.media.view.Toolbar.Embed
*
@ -34,4 +32,4 @@ Embed = Select.extend({
}
});
module.exports = Embed;
module.exports = Embed;

View File

@ -1,5 +1,3 @@
/*globals _, wp */
/**
* wp.media.view.Toolbar.Select
*
@ -67,4 +65,4 @@ Select = Toolbar.extend({
}
});
module.exports = Select;
module.exports = Select;

View File

@ -1,5 +1,3 @@
/*globals _, wp, jQuery */
/**
* Creates a dropzone on WP editor instances (elements with .wp-editor-wrap
* or #wp-fullscreen-body) and relays drag'n'dropped files to a media workflow.
@ -216,4 +214,4 @@ EditorUploader = View.extend({
}
});
module.exports = EditorUploader;
module.exports = EditorUploader;

View File

@ -1,5 +1,3 @@
/*globals _, wp */
/**
* wp.media.view.UploaderInline
*
@ -129,4 +127,4 @@ UploaderInline = View.extend({
});
module.exports = UploaderInline;
module.exports = UploaderInline;

Some files were not shown because too many files have changed in this diff Show More