Changeset 31385
- Timestamp:
- 02/09/2015 04:00:44 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 88 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Gruntfile.js
r31373 r31385 124 124 'src/wp-includes/js/media/audio-video.js' : [ SOURCE_DIR + 'wp-includes/js/media/audio-video.manifest.js' ], 125 125 'src/wp-includes/js/media/grid.js' : [ SOURCE_DIR + 'wp-includes/js/media/grid.manifest.js' ] 126 }, 127 options: { debug: true } 126 } 128 127 } 129 128 }, … … 234 233 // Third party scripts 235 234 '!twenty{fourteen,fifteen}/js/html5.js' 235 ] 236 }, 237 media: { 238 options: { 239 browserify: true 240 }, 241 expand: true, 242 cwd: SOURCE_DIR, 243 src: [ 244 'wp-includes/js/media/**/*.js', 245 '!wp-includes/js/media/*.js', 246 'wp-includes/js/media/*.manifest.js' 236 247 ] 237 248 }, … … 508 519 509 520 // JSHint task. 510 grunt.registerTask('jshint:corejs', ['jshint:grunt', 'jshint:tests', 'jshint:themes', 'jshint:core']); 521 grunt.registerTask( 'jshint:corejs', [ 522 'jshint:grunt', 523 'jshint:tests', 524 'jshint:themes', 525 'jshint:core', 526 'jshint:media' 527 ] ); 511 528 512 529 // Pre-commit task. -
trunk/src/wp-includes/js/media/audio-video.js
r31380 r31385 1 1 (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){ 2 /* global wp, _wpMediaViewsL10n, _wpmejsSettings, MediaElementPlayer */ 3 4 (function(_) { 5 var media = wp.media, 6 baseSettings = {}, 7 l10n = typeof _wpMediaViewsL10n === 'undefined' ? {} : _wpMediaViewsL10n; 8 9 if ( ! _.isUndefined( window._wpmejsSettings ) ) { 10 baseSettings = _wpmejsSettings; 2 var media = wp.media, 3 baseSettings = window._wpmejsSettings || {}, 4 l10n = window._wpMediaViewsL10n || {}; 5 6 /** 7 * @mixin 8 */ 9 wp.media.mixin = { 10 mejsSettings: baseSettings, 11 12 removeAllPlayers: function() { 13 var p; 14 15 if ( window.mejs && window.mejs.players ) { 16 for ( p in window.mejs.players ) { 17 window.mejs.players[p].pause(); 18 this.removePlayer( window.mejs.players[p] ); 19 } 20 } 21 }, 22 23 /** 24 * Override the MediaElement method for removing a player. 25 * MediaElement tries to pull the audio/video tag out of 26 * its container and re-add it to the DOM. 27 */ 28 removePlayer: function(t) { 29 var featureIndex, feature; 30 31 if ( ! t.options ) { 32 return; 33 } 34 35 // invoke features cleanup 36 for ( featureIndex in t.options.features ) { 37 feature = t.options.features[featureIndex]; 38 if ( t['clean' + feature] ) { 39 try { 40 t['clean' + feature](t); 41 } catch (e) {} 42 } 43 } 44 45 if ( ! t.isDynamic ) { 46 t.$node.remove(); 47 } 48 49 if ( 'native' !== t.media.pluginType ) { 50 t.media.remove(); 51 } 52 53 delete window.mejs.players[t.id]; 54 55 t.container.remove(); 56 t.globalUnbind(); 57 delete t.node.player; 58 }, 59 60 /** 61 * Allows any class that has set 'player' to a MediaElementPlayer 62 * instance to remove the player when listening to events. 63 * 64 * Examples: modal closes, shortcode properties are removed, etc. 65 */ 66 unsetPlayers : function() { 67 if ( this.players && this.players.length ) { 68 _.each( this.players, function (player) { 69 player.pause(); 70 wp.media.mixin.removePlayer( player ); 71 } ); 72 this.players = []; 73 } 11 74 } 12 13 /** 14 * @mixin 15 */ 16 wp.media.mixin = { 17 mejsSettings: baseSettings, 18 19 removeAllPlayers: function() { 20 var p; 21 22 if ( window.mejs && window.mejs.players ) { 23 for ( p in window.mejs.players ) { 24 window.mejs.players[p].pause(); 25 this.removePlayer( window.mejs.players[p] ); 26 } 75 }; 76 77 /** 78 * Autowire "collection"-type shortcodes 79 */ 80 wp.media.playlist = new wp.media.collection({ 81 tag: 'playlist', 82 editTitle : l10n.editPlaylistTitle, 83 defaults : { 84 id: wp.media.view.settings.post.id, 85 style: 'light', 86 tracklist: true, 87 tracknumbers: true, 88 images: true, 89 artists: true, 90 type: 'audio' 91 } 92 }); 93 94 /** 95 * Shortcode modeling for audio 96 * `edit()` prepares the shortcode for the media modal 97 * `shortcode()` builds the new shortcode after update 98 * 99 * @namespace 100 */ 101 wp.media.audio = { 102 coerce : wp.media.coerce, 103 104 defaults : { 105 id : wp.media.view.settings.post.id, 106 src : '', 107 loop : false, 108 autoplay : false, 109 preload : 'none', 110 width : 400 111 }, 112 113 edit : function( data ) { 114 var frame, shortcode = wp.shortcode.next( 'audio', data ).shortcode; 115 116 frame = wp.media({ 117 frame: 'audio', 118 state: 'audio-details', 119 metadata: _.defaults( shortcode.attrs.named, this.defaults ) 120 }); 121 122 return frame; 123 }, 124 125 shortcode : function( model ) { 126 var content; 127 128 _.each( this.defaults, function( value, key ) { 129 model[ key ] = this.coerce( model, key ); 130 131 if ( value === model[ key ] ) { 132 delete model[ key ]; 27 133 } 28 }, 29 30 /** 31 * Override the MediaElement method for removing a player. 32 * MediaElement tries to pull the audio/video tag out of 33 * its container and re-add it to the DOM. 34 */ 35 removePlayer: function(t) { 36 var featureIndex, feature; 37 38 if ( ! t.options ) { 39 return; 134 }, this ); 135 136 content = model.content; 137 delete model.content; 138 139 return new wp.shortcode({ 140 tag: 'audio', 141 attrs: model, 142 content: content 143 }); 144 } 145 }; 146 147 /** 148 * Shortcode modeling for video 149 * `edit()` prepares the shortcode for the media modal 150 * `shortcode()` builds the new shortcode after update 151 * 152 * @namespace 153 */ 154 wp.media.video = { 155 coerce : wp.media.coerce, 156 157 defaults : { 158 id : wp.media.view.settings.post.id, 159 src : '', 160 poster : '', 161 loop : false, 162 autoplay : false, 163 preload : 'metadata', 164 content : '', 165 width : 640, 166 height : 360 167 }, 168 169 edit : function( data ) { 170 var frame, 171 shortcode = wp.shortcode.next( 'video', data ).shortcode, 172 attrs; 173 174 attrs = shortcode.attrs.named; 175 attrs.content = shortcode.content; 176 177 frame = wp.media({ 178 frame: 'video', 179 state: 'video-details', 180 metadata: _.defaults( attrs, this.defaults ) 181 }); 182 183 return frame; 184 }, 185 186 shortcode : function( model ) { 187 var content; 188 189 _.each( this.defaults, function( value, key ) { 190 model[ key ] = this.coerce( model, key ); 191 192 if ( value === model[ key ] ) { 193 delete model[ key ]; 40 194 } 41 42 // invoke features cleanup 43 for ( featureIndex in t.options.features ) { 44 feature = t.options.features[featureIndex]; 45 if ( t['clean' + feature] ) { 46 try { 47 t['clean' + feature](t); 48 } catch (e) {} 49 } 50 } 51 52 if ( ! t.isDynamic ) { 53 t.$node.remove(); 54 } 55 56 if ( 'native' !== t.media.pluginType ) { 57 t.media.remove(); 58 } 59 60 delete window.mejs.players[t.id]; 61 62 t.container.remove(); 63 t.globalUnbind(); 64 delete t.node.player; 65 }, 66 67 /** 68 * Allows any class that has set 'player' to a MediaElementPlayer 69 * instance to remove the player when listening to events. 70 * 71 * Examples: modal closes, shortcode properties are removed, etc. 72 */ 73 unsetPlayers : function() { 74 if ( this.players && this.players.length ) { 75 _.each( this.players, function (player) { 76 player.pause(); 77 wp.media.mixin.removePlayer( player ); 78 } ); 79 this.players = []; 80 } 81 } 82 }; 83 84 /** 85 * Autowire "collection"-type shortcodes 86 */ 87 wp.media.playlist = new wp.media.collection({ 88 tag: 'playlist', 89 editTitle : l10n.editPlaylistTitle, 90 defaults : { 91 id: wp.media.view.settings.post.id, 92 style: 'light', 93 tracklist: true, 94 tracknumbers: true, 95 images: true, 96 artists: true, 97 type: 'audio' 98 } 99 }); 100 101 /** 102 * Shortcode modeling for audio 103 * `edit()` prepares the shortcode for the media modal 104 * `shortcode()` builds the new shortcode after update 105 * 106 * @namespace 107 */ 108 wp.media.audio = { 109 coerce : wp.media.coerce, 110 111 defaults : { 112 id : wp.media.view.settings.post.id, 113 src : '', 114 loop : false, 115 autoplay : false, 116 preload : 'none', 117 width : 400 118 }, 119 120 edit : function( data ) { 121 var frame, shortcode = wp.shortcode.next( 'audio', data ).shortcode; 122 123 frame = wp.media({ 124 frame: 'audio', 125 state: 'audio-details', 126 metadata: _.defaults( shortcode.attrs.named, this.defaults ) 127 }); 128 129 return frame; 130 }, 131 132 shortcode : function( model ) { 133 var content; 134 135 _.each( this.defaults, function( value, key ) { 136 model[ key ] = self.coerce( model, key ); 137 138 if ( value === model[ key ] ) { 139 delete model[ key ]; 140 } 141 }, this ); 142 143 content = model.content; 144 delete model.content; 145 146 return new wp.shortcode({ 147 tag: 'audio', 148 attrs: model, 149 content: content 150 }); 151 } 152 }; 153 154 /** 155 * Shortcode modeling for video 156 * `edit()` prepares the shortcode for the media modal 157 * `shortcode()` builds the new shortcode after update 158 * 159 * @namespace 160 */ 161 wp.media.video = { 162 coerce : wp.media.coerce, 163 164 defaults : { 165 id : wp.media.view.settings.post.id, 166 src : '', 167 poster : '', 168 loop : false, 169 autoplay : false, 170 preload : 'metadata', 171 content : '', 172 width : 640, 173 height : 360 174 }, 175 176 edit : function( data ) { 177 var frame, 178 shortcode = wp.shortcode.next( 'video', data ).shortcode, 179 attrs; 180 181 attrs = shortcode.attrs.named; 182 attrs.content = shortcode.content; 183 184 frame = wp.media({ 185 frame: 'video', 186 state: 'video-details', 187 metadata: _.defaults( attrs, this.defaults ) 188 }); 189 190 return frame; 191 }, 192 193 shortcode : function( model ) { 194 var content; 195 196 _.each( this.defaults, function( value, key ) { 197 model[ key ] = this.coerce( model, key ); 198 199 if ( value === model[ key ] ) { 200 delete model[ key ]; 201 } 202 }, this ); 203 204 content = model.content; 205 delete model.content; 206 207 return new wp.shortcode({ 208 tag: 'video', 209 attrs: model, 210 content: content 211 }); 212 } 213 }; 214 215 media.model.PostMedia = require( './models/post-media.js' ); 216 media.controller.AudioDetails = require( './controllers/audio-details.js' ); 217 media.controller.VideoDetails = require( './controllers/video-details.js' ); 218 media.view.MediaFrame.MediaDetails = require( './views/frame/media-details.js' ); 219 media.view.MediaFrame.AudioDetails = require( './views/frame/audio-details.js' ); 220 media.view.MediaFrame.VideoDetails = require( './views/frame/video-details.js' ); 221 media.view.MediaDetails = require( './views/media-details.js' ); 222 media.view.AudioDetails = require( './views/audio-details.js' ); 223 media.view.VideoDetails = require( './views/video-details.js' ); 224 225 }(_)); 195 }, this ); 196 197 content = model.content; 198 delete model.content; 199 200 return new wp.shortcode({ 201 tag: 'video', 202 attrs: model, 203 content: content 204 }); 205 } 206 }; 207 208 media.model.PostMedia = require( './models/post-media.js' ); 209 media.controller.AudioDetails = require( './controllers/audio-details.js' ); 210 media.controller.VideoDetails = require( './controllers/video-details.js' ); 211 media.view.MediaFrame.MediaDetails = require( './views/frame/media-details.js' ); 212 media.view.MediaFrame.AudioDetails = require( './views/frame/audio-details.js' ); 213 media.view.MediaFrame.VideoDetails = require( './views/frame/video-details.js' ); 214 media.view.MediaDetails = require( './views/media-details.js' ); 215 media.view.AudioDetails = require( './views/audio-details.js' ); 216 media.view.VideoDetails = require( './views/video-details.js' ); 217 226 218 },{"./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){ 227 /*globals wp */228 229 219 /** 230 220 * The controller for the Audio Details state … … 256 246 257 247 module.exports = AudioDetails; 248 258 249 },{"./state.js":7}],3:[function(require,module,exports){ 259 /*globals _, wp, Backbone, getUserSetting, setUserSetting */260 261 250 /** 262 251 * wp.media.controller.Library … … 296 285 State = require( './state.js' ), 297 286 l10n = wp.media.view.l10n, 287 getUserSetting = window.getUserSetting, 288 setUserSetting = window.setUserSetting, 298 289 Library; 299 290 … … 330 321 } 331 322 332 if ( ! ( selection instanceof Selection) ) {323 if ( ! ( selection instanceof wp.media.model.Selection ) ) { 333 324 props = selection; 334 325 … … 529 520 530 521 module.exports = Library; 522 531 523 },{"../utils/selection-sync.js":10,"./state.js":7}],4:[function(require,module,exports){ 532 /*globals _, wp */533 534 524 /** 535 525 * wp.media.controller.MediaLibrary … … 580 570 581 571 module.exports = MediaLibrary; 572 582 573 },{"./library.js":3}],5:[function(require,module,exports){ 583 /*globals _, Backbone */584 585 574 /** 586 575 * wp.media.controller.Region … … 760 749 761 750 module.exports = Region; 751 762 752 },{}],6:[function(require,module,exports){ 763 /*globals _, Backbone */764 765 753 /** 766 754 * wp.media.controller.StateMachine … … 885 873 886 874 module.exports = StateMachine; 875 887 876 },{}],7:[function(require,module,exports){ 888 /*globals _, Backbone */889 890 877 /** 891 878 * wp.media.controller.State … … 1127 1114 1128 1115 module.exports = State; 1116 1129 1117 },{}],8:[function(require,module,exports){ 1130 /*globals wp */1131 1132 1118 /** 1133 1119 * The controller for the Video Details state … … 1159 1145 1160 1146 module.exports = VideoDetails; 1147 1161 1148 },{"./state.js":7}],9:[function(require,module,exports){ 1162 /*globals Backbone, _, wp */1163 1164 1149 /** 1165 1150 * Shared model class for audio and video. Updates the model after … … 1200 1185 1201 1186 module.exports = PostMedia; 1187 1202 1188 },{}],10:[function(require,module,exports){ 1203 /*globals _ */1204 1205 1189 /** 1206 1190 * wp.media.selectionSync … … 1267 1251 1268 1252 module.exports = selectionSync; 1253 1269 1254 },{}],11:[function(require,module,exports){ 1270 /*globals _ */1271 1272 1255 /** 1273 1256 * wp.media.view.AttachmentCompat … … 1353 1336 1354 1337 module.exports = AttachmentCompat; 1338 1355 1339 },{"./view.js":51}],12:[function(require,module,exports){ 1356 /*globals _, jQuery */1357 1358 1340 /** 1359 1341 * wp.media.view.AttachmentFilters … … 1432 1414 1433 1415 module.exports = AttachmentFilters; 1416 1434 1417 },{"./view.js":51}],13:[function(require,module,exports){ 1435 /*globals _, wp */1436 1437 1418 /** 1438 1419 * wp.media.view.AttachmentFilters.All … … 1524 1505 1525 1506 module.exports = All; 1507 1526 1508 },{"../attachment-filters.js":12}],14:[function(require,module,exports){ 1527 /*globals _, wp */1528 1529 1509 /** 1530 1510 * A filter dropdown for month/dates. … … 1567 1547 1568 1548 module.exports = DateFilter; 1549 1569 1550 },{"../attachment-filters.js":12}],15:[function(require,module,exports){ 1570 /*globals wp */1571 1572 1551 /** 1573 1552 * wp.media.view.AttachmentFilters.Uploaded … … 1628 1607 1629 1608 module.exports = Uploaded; 1609 1630 1610 },{"../attachment-filters.js":12}],16:[function(require,module,exports){ 1631 /*globals _, wp, jQuery */1632 1633 1611 /** 1634 1612 * wp.media.view.Attachment … … 2183 2161 2184 2162 module.exports = Attachment; 2163 2185 2164 },{"./view.js":51}],17:[function(require,module,exports){ 2186 /*globals _, wp */2187 2188 2165 /** 2189 2166 * wp.media.view.Attachment.Details … … 2245 2222 event.preventDefault(); 2246 2223 2247 if ( confirm( l10n.warnDelete ) ) {2224 if ( window.confirm( l10n.warnDelete ) ) { 2248 2225 this.model.destroy(); 2249 2226 // Keep focus inside media modal … … 2324 2301 2325 2302 module.exports = Details; 2303 2326 2304 },{"../attachment.js":16}],18:[function(require,module,exports){ 2327 2305 /** … … 2344 2322 2345 2323 module.exports = Library; 2324 2346 2325 },{"../attachment.js":16}],19:[function(require,module,exports){ 2347 /*globals _, wp, jQuery */2348 2349 2326 /** 2350 2327 * wp.media.view.Attachments … … 2619 2596 // The scroll event occurs on the document, but the element 2620 2597 // that should be checked is the document body. 2621 if ( el == document ) {2598 if ( el === document ) { 2622 2599 el = document.body; 2623 2600 scrollTop = $(document).scrollTop(); … … 2645 2622 2646 2623 module.exports = Attachments; 2624 2647 2625 },{"./attachment.js":16,"./view.js":51}],20:[function(require,module,exports){ 2648 /*globals _, wp, jQuery */2649 2650 2626 /** 2651 2627 * wp.media.view.AttachmentsBrowser … … 2838 2814 } 2839 2815 2840 if ( ! mediaTrash && ! confirm( l10n.warnBulkDelete ) ) {2816 if ( ! mediaTrash && ! window.confirm( l10n.warnBulkDelete ) ) { 2841 2817 return; 2842 2818 } … … 2844 2820 if ( mediaTrash && 2845 2821 'trash' !== selection.at( 0 ).get( 'status' ) && 2846 ! confirm( l10n.warnBulkTrash ) ) {2822 ! window.confirm( l10n.warnBulkTrash ) ) { 2847 2823 2848 2824 return; … … 2892 2868 var removed = [], selection = this.controller.state().get( 'selection' ); 2893 2869 2894 if ( ! selection.length || ! confirm( l10n.warnBulkDelete ) ) {2870 if ( ! selection.length || ! window.confirm( l10n.warnBulkDelete ) ) { 2895 2871 return; 2896 2872 } … … 3105 3081 3106 3082 module.exports = AttachmentsBrowser; 3083 3107 3084 },{"../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){ 3108 /*globals wp */3109 3110 3085 /** 3111 3086 * wp.media.view.AudioDetails … … 3144 3119 3145 3120 module.exports = AudioDetails; 3121 3146 3122 },{"./media-details":31}],22:[function(require,module,exports){ 3147 /*globals _, Backbone */3148 3149 3123 /** 3150 3124 * wp.media.view.Button … … 3234 3208 3235 3209 module.exports = Button; 3210 3236 3211 },{"./view.js":51}],23:[function(require,module,exports){ 3237 3212 /** … … 3282 3257 3283 3258 module.exports = FocusManager; 3259 3284 3260 },{"./view.js":51}],24:[function(require,module,exports){ 3285 /*globals _, Backbone */3286 3287 3261 /** 3288 3262 * wp.media.view.Frame … … 3455 3429 3456 3430 module.exports = Frame; 3431 3457 3432 },{"../controllers/region.js":5,"../controllers/state-machine.js":6,"../controllers/state.js":7,"./view.js":51}],25:[function(require,module,exports){ 3458 /*globals wp */3459 3460 3433 /** 3461 3434 * wp.media.view.MediaFrame.AudioDetails … … 3533 3506 3534 3507 module.exports = AudioDetails; 3508 3535 3509 },{"../../controllers/audio-details.js":2,"../../controllers/media-library.js":4,"../audio-details.js":21,"./media-details":26}],26:[function(require,module,exports){ 3536 /*globals wp */3537 3538 3510 /** 3539 3511 * wp.media.view.MediaFrame.MediaDetails … … 3666 3638 3667 3639 module.exports = MediaDetails; 3640 3668 3641 },{"../toolbar.js":44,"../view.js":51,"./select.js":27}],27:[function(require,module,exports){ 3669 /*globals _, wp */3670 3671 3642 /** 3672 3643 * wp.media.view.MediaFrame.Select … … 3841 3812 3842 3813 module.exports = Select; 3814 3843 3815 },{"../../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){ 3844 /*globals _, wp */3845 3846 3816 /** 3847 3817 * wp.media.view.MediaFrame.VideoDetails … … 3979 3949 3980 3950 module.exports = VideoDetails; 3951 3981 3952 },{"../../controllers/media-library.js":4,"../../controllers/video-details.js":8,"../video-details.js":50,"./media-details":26}],29:[function(require,module,exports){ 3982 3953 /** … … 4005 3976 4006 3977 module.exports = Iframe; 3978 4007 3979 },{"./view.js":51}],30:[function(require,module,exports){ 4008 3980 /** … … 4031 4003 4032 4004 module.exports = Label; 4005 4033 4006 },{"./view.js":51}],31:[function(require,module,exports){ 4034 /*globals _, wp, jQuery */4035 4036 4007 /** 4037 4008 * wp.media.view.MediaDetails … … 4117 4088 setPlayer : function() { 4118 4089 if ( ! this.players.length && this.media ) { 4119 this.players.push( new MediaElementPlayer( this.media, this.settings ) );4090 this.players.push( new window.MediaElementPlayer( this.media, this.settings ) ); 4120 4091 } 4121 4092 }, … … 4145 4116 render: function() { 4146 4117 AttachmentDisplay.prototype.render.apply( this, arguments ); 4147 4118 4148 4119 setTimeout( _.bind( function() { 4149 4120 this.resetFocus(); … … 4184 4155 4185 4156 module.exports = MediaDetails; 4157 4186 4158 },{"./settings/attachment-display.js":41}],32:[function(require,module,exports){ 4187 /*globals _, wp, jQuery */4188 4189 4159 /** 4190 4160 * wp.media.view.MediaFrame … … 4439 4409 4440 4410 module.exports = MediaFrame; 4411 4441 4412 },{"./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){ 4442 /*globals wp, jQuery */4443 4444 4413 /** 4445 4414 * wp.media.view.MenuItem … … 4513 4482 4514 4483 module.exports = MenuItem; 4484 4515 4485 },{"./view.js":51}],34:[function(require,module,exports){ 4516 4486 /** … … 4629 4599 4630 4600 module.exports = Menu; 4601 4631 4602 },{"./menu-item.js":33,"./priority-list.js":36}],35:[function(require,module,exports){ 4632 /*globals _, wp, jQuery */4633 4634 4603 /** 4635 4604 * wp.media.view.Modal … … 4845 4814 4846 4815 module.exports = Modal; 4816 4847 4817 },{"./focus-manager.js":23,"./view.js":51}],36:[function(require,module,exports){ 4848 /*globals _, Backbone */4849 4850 4818 /** 4851 4819 * wp.media.view.PriorityList … … 4946 4914 4947 4915 module.exports = PriorityList; 4916 4948 4917 },{"./view.js":51}],37:[function(require,module,exports){ 4949 4918 /** … … 4972 4941 4973 4942 module.exports = RouterItem; 4943 4974 4944 },{"./menu-item.js":33}],38:[function(require,module,exports){ 4975 4945 /** … … 5009 4979 5010 4980 module.exports = Router; 4981 5011 4982 },{"./menu.js":34,"./router-item.js":37}],39:[function(require,module,exports){ 5012 /*globals wp */5013 5014 4983 /** 5015 4984 * wp.media.view.Search … … 5059 5028 5060 5029 module.exports = Search; 5030 5061 5031 },{"./view.js":51}],40:[function(require,module,exports){ 5062 /*globals _, Backbone, jQuery */5063 5064 5032 /** 5065 5033 * wp.media.view.Settings … … 5169 5137 // update that as well. 5170 5138 if ( userSetting = $setting.data('userSetting') ) { 5171 setUserSetting( userSetting, value );5139 window.setUserSetting( userSetting, value ); 5172 5140 } 5173 5141 }, … … 5181 5149 5182 5150 module.exports = Settings; 5151 5183 5152 },{"./view.js":51}],41:[function(require,module,exports){ 5184 /*globals _, wp */5185 5186 5153 /** 5187 5154 * wp.media.view.Settings.AttachmentDisplay … … 5276 5243 5277 5244 module.exports = AttachmentDisplay; 5245 5278 5246 },{"../settings.js":40}],42:[function(require,module,exports){ 5279 5247 /** … … 5294 5262 5295 5263 module.exports = Sidebar; 5264 5296 5265 },{"./priority-list.js":36}],43:[function(require,module,exports){ 5297 /*globals _, wp */5298 5299 5266 /** 5300 5267 * wp.media.view.Spinner … … 5333 5300 5334 5301 module.exports = Spinner; 5302 5335 5303 },{"./view.js":51}],44:[function(require,module,exports){ 5336 /*globals Backbone, _ */5337 5338 5304 /** 5339 5305 * wp.media.view.Toolbar … … 5496 5462 5497 5463 module.exports = Toolbar; 5464 5498 5465 },{"./button.js":22,"./priority-list.js":36,"./view.js":51}],45:[function(require,module,exports){ 5499 /*globals _, wp */5500 5501 5466 /** 5502 5467 * wp.media.view.Toolbar.Select … … 5567 5532 5568 5533 module.exports = Select; 5534 5569 5535 },{"../toolbar.js":44}],46:[function(require,module,exports){ 5570 /*globals _, wp */5571 5572 5536 /** 5573 5537 * wp.media.view.UploaderInline … … 5700 5664 5701 5665 module.exports = UploaderInline; 5666 5702 5667 },{"../view.js":51,"./status.js":48}],47:[function(require,module,exports){ 5703 /*globals wp */5704 5705 5668 /** 5706 5669 * wp.media.view.UploaderStatusError … … 5720 5683 5721 5684 module.exports = UploaderStatusError; 5685 5722 5686 },{"../view.js":51}],48:[function(require,module,exports){ 5723 /*globals _, wp */5724 5725 5687 /** 5726 5688 * wp.media.view.UploaderStatus … … 5860 5822 5861 5823 module.exports = UploaderStatus; 5824 5862 5825 },{"../view.js":51,"./status-error.js":47}],49:[function(require,module,exports){ 5863 /*globals _, wp, jQuery */5864 5865 5826 /** 5866 5827 * wp.media.view.UploaderWindow … … 5973 5934 5974 5935 module.exports = UploaderWindow; 5936 5975 5937 },{"../view.js":51}],50:[function(require,module,exports){ 5976 /*globals wp */5977 5978 5938 /** 5979 5939 * wp.media.view.VideoDetails … … 6017 5977 6018 5978 module.exports = VideoDetails; 5979 6019 5980 },{"./media-details":31}],51:[function(require,module,exports){ 6020 /*globals wp */6021 6022 5981 /** 6023 5982 * wp.media.View … … 6084 6043 6085 6044 module.exports = View; 6045 6086 6046 },{}]},{},[1]); -
trunk/src/wp-includes/js/media/audio-video.manifest.js
r31380 r31385 1 /* global wp, _wpMediaViewsL10n, _wpmejsSettings, MediaElementPlayer */ 2 3 (function(_) { 4 var media = wp.media, 5 baseSettings = {}, 6 l10n = typeof _wpMediaViewsL10n === 'undefined' ? {} : _wpMediaViewsL10n; 7 8 if ( ! _.isUndefined( window._wpmejsSettings ) ) { 9 baseSettings = _wpmejsSettings; 10 } 1 var media = wp.media, 2 baseSettings = window._wpmejsSettings || {}, 3 l10n = window._wpMediaViewsL10n || {}; 4 5 /** 6 * @mixin 7 */ 8 wp.media.mixin = { 9 mejsSettings: baseSettings, 10 11 removeAllPlayers: function() { 12 var p; 13 14 if ( window.mejs && window.mejs.players ) { 15 for ( p in window.mejs.players ) { 16 window.mejs.players[p].pause(); 17 this.removePlayer( window.mejs.players[p] ); 18 } 19 } 20 }, 11 21 12 22 /** 13 * @mixin 23 * Override the MediaElement method for removing a player. 24 * MediaElement tries to pull the audio/video tag out of 25 * its container and re-add it to the DOM. 14 26 */ 15 wp.media.mixin = { 16 mejsSettings: baseSettings, 17 18 removeAllPlayers: function() { 19 var p; 20 21 if ( window.mejs && window.mejs.players ) { 22 for ( p in window.mejs.players ) { 23 window.mejs.players[p].pause(); 24 this.removePlayer( window.mejs.players[p] ); 25 } 26 } 27 }, 28 29 /** 30 * Override the MediaElement method for removing a player. 31 * MediaElement tries to pull the audio/video tag out of 32 * its container and re-add it to the DOM. 33 */ 34 removePlayer: function(t) { 35 var featureIndex, feature; 36 37 if ( ! t.options ) { 38 return; 39 } 40 41 // invoke features cleanup 42 for ( featureIndex in t.options.features ) { 43 feature = t.options.features[featureIndex]; 44 if ( t['clean' + feature] ) { 45 try { 46 t['clean' + feature](t); 47 } catch (e) {} 48 } 49 } 50 51 if ( ! t.isDynamic ) { 52 t.$node.remove(); 53 } 54 55 if ( 'native' !== t.media.pluginType ) { 56 t.media.remove(); 57 } 58 59 delete window.mejs.players[t.id]; 60 61 t.container.remove(); 62 t.globalUnbind(); 63 delete t.node.player; 64 }, 65 66 /** 67 * Allows any class that has set 'player' to a MediaElementPlayer 68 * instance to remove the player when listening to events. 69 * 70 * Examples: modal closes, shortcode properties are removed, etc. 71 */ 72 unsetPlayers : function() { 73 if ( this.players && this.players.length ) { 74 _.each( this.players, function (player) { 75 player.pause(); 76 wp.media.mixin.removePlayer( player ); 77 } ); 78 this.players = []; 79 } 80 } 81 }; 27 removePlayer: function(t) { 28 var featureIndex, feature; 29 30 if ( ! t.options ) { 31 return; 32 } 33 34 // invoke features cleanup 35 for ( featureIndex in t.options.features ) { 36 feature = t.options.features[featureIndex]; 37 if ( t['clean' + feature] ) { 38 try { 39 t['clean' + feature](t); 40 } catch (e) {} 41 } 42 } 43 44 if ( ! t.isDynamic ) { 45 t.$node.remove(); 46 } 47 48 if ( 'native' !== t.media.pluginType ) { 49 t.media.remove(); 50 } 51 52 delete window.mejs.players[t.id]; 53 54 t.container.remove(); 55 t.globalUnbind(); 56 delete t.node.player; 57 }, 82 58 83 59 /** 84 * Autowire "collection"-type shortcodes 60 * Allows any class that has set 'player' to a MediaElementPlayer 61 * instance to remove the player when listening to events. 62 * 63 * Examples: modal closes, shortcode properties are removed, etc. 85 64 */ 86 wp.media.playlist = new wp.media.collection({ 87 tag: 'playlist', 88 editTitle : l10n.editPlaylistTitle, 89 defaults : { 90 id: wp.media.view.settings.post.id, 91 style: 'light', 92 tracklist: true, 93 tracknumbers: true, 94 images: true, 95 artists: true, 96 type: 'audio' 97 } 98 }); 99 100 /** 101 * Shortcode modeling for audio 102 * `edit()` prepares the shortcode for the media modal 103 * `shortcode()` builds the new shortcode after update 104 * 105 * @namespace 106 */ 107 wp.media.audio = { 108 coerce : wp.media.coerce, 109 110 defaults : { 111 id : wp.media.view.settings.post.id, 112 src : '', 113 loop : false, 114 autoplay : false, 115 preload : 'none', 116 width : 400 117 }, 118 119 edit : function( data ) { 120 var frame, shortcode = wp.shortcode.next( 'audio', data ).shortcode; 121 122 frame = wp.media({ 123 frame: 'audio', 124 state: 'audio-details', 125 metadata: _.defaults( shortcode.attrs.named, this.defaults ) 126 }); 127 128 return frame; 129 }, 130 131 shortcode : function( model ) { 132 var content; 133 134 _.each( this.defaults, function( value, key ) { 135 model[ key ] = self.coerce( model, key ); 136 137 if ( value === model[ key ] ) { 138 delete model[ key ]; 139 } 140 }, this ); 141 142 content = model.content; 143 delete model.content; 144 145 return new wp.shortcode({ 146 tag: 'audio', 147 attrs: model, 148 content: content 149 }); 150 } 151 }; 152 153 /** 154 * Shortcode modeling for video 155 * `edit()` prepares the shortcode for the media modal 156 * `shortcode()` builds the new shortcode after update 157 * 158 * @namespace 159 */ 160 wp.media.video = { 161 coerce : wp.media.coerce, 162 163 defaults : { 164 id : wp.media.view.settings.post.id, 165 src : '', 166 poster : '', 167 loop : false, 168 autoplay : false, 169 preload : 'metadata', 170 content : '', 171 width : 640, 172 height : 360 173 }, 174 175 edit : function( data ) { 176 var frame, 177 shortcode = wp.shortcode.next( 'video', data ).shortcode, 178 attrs; 179 180 attrs = shortcode.attrs.named; 181 attrs.content = shortcode.content; 182 183 frame = wp.media({ 184 frame: 'video', 185 state: 'video-details', 186 metadata: _.defaults( attrs, this.defaults ) 187 }); 188 189 return frame; 190 }, 191 192 shortcode : function( model ) { 193 var content; 194 195 _.each( this.defaults, function( value, key ) { 196 model[ key ] = this.coerce( model, key ); 197 198 if ( value === model[ key ] ) { 199 delete model[ key ]; 200 } 201 }, this ); 202 203 content = model.content; 204 delete model.content; 205 206 return new wp.shortcode({ 207 tag: 'video', 208 attrs: model, 209 content: content 210 }); 211 } 212 }; 213 214 media.model.PostMedia = require( './models/post-media.js' ); 215 media.controller.AudioDetails = require( './controllers/audio-details.js' ); 216 media.controller.VideoDetails = require( './controllers/video-details.js' ); 217 media.view.MediaFrame.MediaDetails = require( './views/frame/media-details.js' ); 218 media.view.MediaFrame.AudioDetails = require( './views/frame/audio-details.js' ); 219 media.view.MediaFrame.VideoDetails = require( './views/frame/video-details.js' ); 220 media.view.MediaDetails = require( './views/media-details.js' ); 221 media.view.AudioDetails = require( './views/audio-details.js' ); 222 media.view.VideoDetails = require( './views/video-details.js' ); 223 224 }(_)); 65 unsetPlayers : function() { 66 if ( this.players && this.players.length ) { 67 _.each( this.players, function (player) { 68 player.pause(); 69 wp.media.mixin.removePlayer( player ); 70 } ); 71 this.players = []; 72 } 73 } 74 }; 75 76 /** 77 * Autowire "collection"-type shortcodes 78 */ 79 wp.media.playlist = new wp.media.collection({ 80 tag: 'playlist', 81 editTitle : l10n.editPlaylistTitle, 82 defaults : { 83 id: wp.media.view.settings.post.id, 84 style: 'light', 85 tracklist: true, 86 tracknumbers: true, 87 images: true, 88 artists: true, 89 type: 'audio' 90 } 91 }); 92 93 /** 94 * Shortcode modeling for audio 95 * `edit()` prepares the shortcode for the media modal 96 * `shortcode()` builds the new shortcode after update 97 * 98 * @namespace 99 */ 100 wp.media.audio = { 101 coerce : wp.media.coerce, 102 103 defaults : { 104 id : wp.media.view.settings.post.id, 105 src : '', 106 loop : false, 107 autoplay : false, 108 preload : 'none', 109 width : 400 110 }, 111 112 edit : function( data ) { 113 var frame, shortcode = wp.shortcode.next( 'audio', data ).shortcode; 114 115 frame = wp.media({ 116 frame: 'audio', 117 state: 'audio-details', 118 metadata: _.defaults( shortcode.attrs.named, this.defaults ) 119 }); 120 121 return frame; 122 }, 123 124 shortcode : function( model ) { 125 var content; 126 127 _.each( this.defaults, function( value, key ) { 128 model[ key ] = this.coerce( model, key ); 129 130 if ( value === model[ key ] ) { 131 delete model[ key ]; 132 } 133 }, this ); 134 135 content = model.content; 136 delete model.content; 137 138 return new wp.shortcode({ 139 tag: 'audio', 140 attrs: model, 141 content: content 142 }); 143 } 144 }; 145 146 /** 147 * Shortcode modeling for video 148 * `edit()` prepares the shortcode for the media modal 149 * `shortcode()` builds the new shortcode after update 150 * 151 * @namespace 152 */ 153 wp.media.video = { 154 coerce : wp.media.coerce, 155 156 defaults : { 157 id : wp.media.view.settings.post.id, 158 src : '', 159 poster : '', 160 loop : false, 161 autoplay : false, 162 preload : 'metadata', 163 content : '', 164 width : 640, 165 height : 360 166 }, 167 168 edit : function( data ) { 169 var frame, 170 shortcode = wp.shortcode.next( 'video', data ).shortcode, 171 attrs; 172 173 attrs = shortcode.attrs.named; 174 attrs.content = shortcode.content; 175 176 frame = wp.media({ 177 frame: 'video', 178 state: 'video-details', 179 metadata: _.defaults( attrs, this.defaults ) 180 }); 181 182 return frame; 183 }, 184 185 shortcode : function( model ) { 186 var content; 187 188 _.each( this.defaults, function( value, key ) { 189 model[ key ] = this.coerce( model, key ); 190 191 if ( value === model[ key ] ) { 192 delete model[ key ]; 193 } 194 }, this ); 195 196 content = model.content; 197 delete model.content; 198 199 return new wp.shortcode({ 200 tag: 'video', 201 attrs: model, 202 content: content 203 }); 204 } 205 }; 206 207 media.model.PostMedia = require( './models/post-media.js' ); 208 media.controller.AudioDetails = require( './controllers/audio-details.js' ); 209 media.controller.VideoDetails = require( './controllers/video-details.js' ); 210 media.view.MediaFrame.MediaDetails = require( './views/frame/media-details.js' ); 211 media.view.MediaFrame.AudioDetails = require( './views/frame/audio-details.js' ); 212 media.view.MediaFrame.VideoDetails = require( './views/frame/video-details.js' ); 213 media.view.MediaDetails = require( './views/media-details.js' ); 214 media.view.AudioDetails = require( './views/audio-details.js' ); 215 media.view.VideoDetails = require( './views/video-details.js' ); -
trunk/src/wp-includes/js/media/controllers/audio-details.js
r31373 r31385 1 /*globals wp */2 3 1 /** 4 2 * The controller for the Audio Details state -
trunk/src/wp-includes/js/media/controllers/collection-add.js
r31379 r31385 1 /*globals _, wp */2 3 1 /** 4 2 * wp.media.controller.CollectionAdd -
trunk/src/wp-includes/js/media/controllers/collection-edit.js
r31379 r31385 1 /*globals wp, jQuery, Backbone */2 3 1 /** 4 2 * wp.media.controller.CollectionEdit -
trunk/src/wp-includes/js/media/controllers/cropper.js
r31380 r31385 1 /*globals _, wp, Backbone */2 3 1 /** 4 2 * wp.media.controller.Cropper … … 76 74 this.$el.text(l10n.cropping); 77 75 this.$el.attr('disabled', true); 78 76 79 77 controller.state().doCrop( selection ).done( function( croppedImage ) { 80 78 controller.trigger('cropped', croppedImage ); -
trunk/src/wp-includes/js/media/controllers/edit-attachment-metadata.js
r31373 r31385 1 /*globals wp */2 3 1 /** 4 2 * wp.media.controller.EditAttachmentMetadata -
trunk/src/wp-includes/js/media/controllers/edit-image.js
r31373 r31385 1 /*globals _, wp */2 3 1 /** 4 2 * wp.media.controller.EditImage -
trunk/src/wp-includes/js/media/controllers/embed.js
r31373 r31385 1 /*globals _, wp, jQuery, Backbone */2 3 1 /** 4 2 * wp.media.controller.Embed -
trunk/src/wp-includes/js/media/controllers/featured-image.js
r31379 r31385 1 /*globals _, wp */2 3 1 /** 4 2 * wp.media.controller.FeaturedImage -
trunk/src/wp-includes/js/media/controllers/gallery-add.js
r31379 r31385 1 /*globals _, wp */2 3 1 /** 4 2 * A state for selecting more images to add to a gallery. … … 52 50 initialize: function() { 53 51 // If a library wasn't supplied, create a library of images. 54 if ( ! this.get('library') ) 52 if ( ! this.get('library') ) { 55 53 this.set( 'library', wp.media.query({ type: 'image' }) ); 54 } 56 55 57 56 Library.prototype.initialize.apply( this, arguments ); … … 65 64 edit = this.frame.state('gallery-edit').get('library'); 66 65 67 if ( this.editLibrary && this.editLibrary !== edit ) 66 if ( this.editLibrary && this.editLibrary !== edit ) { 68 67 library.unobserve( this.editLibrary ); 68 } 69 69 70 70 // Accepts attachments that exist in the original library and -
trunk/src/wp-includes/js/media/controllers/gallery-edit.js
r31379 r31385 1 /*globals wp, Backbone */2 3 1 /** 4 2 * wp.media.controller.GalleryEdit … … 62 60 initialize: function() { 63 61 // If we haven't been provided a `library`, create a `Selection`. 64 if ( ! this.get('library') ) 62 if ( ! this.get('library') ) { 65 63 this.set( 'library', new wp.media.model.Selection() ); 64 } 66 65 67 66 // The single `Attachment` view to be used in the `Attachments` view. 68 if ( ! this.get('AttachmentView') ) 67 if ( ! this.get('AttachmentView') ) { 69 68 this.set( 'AttachmentView', EditLibraryView ); 69 } 70 70 71 Library.prototype.initialize.apply( this, arguments ); 71 72 }, -
trunk/src/wp-includes/js/media/controllers/image-details.js
r31373 r31385 1 /*globals _, wp */2 3 1 /** 4 2 * wp.media.controller.ImageDetails -
trunk/src/wp-includes/js/media/controllers/library.js
r31379 r31385 1 /*globals _, wp, Backbone, getUserSetting, setUserSetting */2 3 1 /** 4 2 * wp.media.controller.Library … … 38 36 State = require( './state.js' ), 39 37 l10n = wp.media.view.l10n, 38 getUserSetting = window.getUserSetting, 39 setUserSetting = window.setUserSetting, 40 40 Library; 41 41 … … 72 72 } 73 73 74 if ( ! ( selection instanceof Selection) ) {74 if ( ! ( selection instanceof wp.media.model.Selection ) ) { 75 75 props = selection; 76 76 -
trunk/src/wp-includes/js/media/controllers/media-library.js
r31373 r31385 1 /*globals _, wp */2 3 1 /** 4 2 * wp.media.controller.MediaLibrary -
trunk/src/wp-includes/js/media/controllers/region.js
r31373 r31385 1 /*globals _, Backbone */2 3 1 /** 4 2 * wp.media.controller.Region -
trunk/src/wp-includes/js/media/controllers/replace-image.js
r31373 r31385 1 /*globals _, wp */2 3 1 /** 4 2 * wp.media.controller.ReplaceImage -
trunk/src/wp-includes/js/media/controllers/state-machine.js
r31373 r31385 1 /*globals _, Backbone */2 3 1 /** 4 2 * wp.media.controller.StateMachine -
trunk/src/wp-includes/js/media/controllers/state.js
r31373 r31385 1 /*globals _, Backbone */2 3 1 /** 4 2 * wp.media.controller.State -
trunk/src/wp-includes/js/media/controllers/video-details.js
r31373 r31385 1 /*globals wp */2 3 1 /** 4 2 * The controller for the Video Details state -
trunk/src/wp-includes/js/media/grid.js
r31380 r31385 1 1 (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){ 2 /*globals wp */3 4 2 /** 5 3 * wp.media.controller.EditAttachmentMetadata … … 29 27 30 28 module.exports = EditAttachmentMetadata; 29 31 30 },{"./state.js":6}],2:[function(require,module,exports){ 32 /*globals _, wp */33 34 31 /** 35 32 * wp.media.controller.EditImage … … 108 105 109 106 module.exports = EditImage; 107 110 108 },{"../views/toolbar.js":46,"./state.js":6}],3:[function(require,module,exports){ 111 /*globals _, wp, Backbone, getUserSetting, setUserSetting */112 113 109 /** 114 110 * wp.media.controller.Library … … 148 144 State = require( './state.js' ), 149 145 l10n = wp.media.view.l10n, 146 getUserSetting = window.getUserSetting, 147 setUserSetting = window.setUserSetting, 150 148 Library; 151 149 … … 182 180 } 183 181 184 if ( ! ( selection instanceof Selection) ) {182 if ( ! ( selection instanceof wp.media.model.Selection ) ) { 185 183 props = selection; 186 184 … … 381 379 382 380 module.exports = Library; 381 383 382 },{"../utils/selection-sync.js":9,"./state.js":6}],4:[function(require,module,exports){ 384 /*globals _, Backbone */385 386 383 /** 387 384 * wp.media.controller.Region … … 561 558 562 559 module.exports = Region; 560 563 561 },{}],5:[function(require,module,exports){ 564 /*globals _, Backbone */565 566 562 /** 567 563 * wp.media.controller.StateMachine … … 686 682 687 683 module.exports = StateMachine; 684 688 685 },{}],6:[function(require,module,exports){ 689 /*globals _, Backbone */690 691 686 /** 692 687 * wp.media.controller.State … … 928 923 929 924 module.exports = State; 925 930 926 },{}],7:[function(require,module,exports){ 931 /* global wp, _wpMediaViewsL10n, MediaElementPlayer, _wpMediaGridSettings */ 932 (function (wp) { 933 var media = wp.media; 934 935 media.controller.EditAttachmentMetadata = require( './controllers/edit-attachment-metadata.js' ); 936 media.view.MediaFrame.Manage = require( './views/frame/manage.js' ); 937 media.view.Attachment.Details.TwoColumn = require( './views/attachment/details-two-column.js' ); 938 media.view.MediaFrame.Manage.Router = require( './routers/manage.js' ); 939 media.view.EditImage.Details = require( './views/edit-image-details.js' ); 940 media.view.MediaFrame.EditAttachments = require( './views/frame/edit-attachments.js' ); 941 media.view.SelectModeToggleButton = require( './views/button/select-mode-toggle.js' ); 942 media.view.DeleteSelectedButton = require( './views/button/delete-selected.js' ); 943 media.view.DeleteSelectedPermanentlyButton = require( './views/button/delete-selected-permanently.js' ); 944 945 }(wp)); 927 var media = wp.media; 928 929 media.controller.EditAttachmentMetadata = require( './controllers/edit-attachment-metadata.js' ); 930 media.view.MediaFrame.Manage = require( './views/frame/manage.js' ); 931 media.view.Attachment.Details.TwoColumn = require( './views/attachment/details-two-column.js' ); 932 media.view.MediaFrame.Manage.Router = require( './routers/manage.js' ); 933 media.view.EditImage.Details = require( './views/edit-image-details.js' ); 934 media.view.MediaFrame.EditAttachments = require( './views/frame/edit-attachments.js' ); 935 media.view.SelectModeToggleButton = require( './views/button/select-mode-toggle.js' ); 936 media.view.DeleteSelectedButton = require( './views/button/delete-selected.js' ); 937 media.view.DeleteSelectedPermanentlyButton = require( './views/button/delete-selected-permanently.js' ); 938 946 939 },{"./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){ 947 /*globals jQuery, Backbone */948 949 940 /** 950 941 * A router for handling the browser history and application state. … … 991 982 992 983 module.exports = Router; 984 993 985 },{}],9:[function(require,module,exports){ 994 /*globals _ */995 996 986 /** 997 987 * wp.media.selectionSync … … 1058 1048 1059 1049 module.exports = selectionSync; 1050 1060 1051 },{}],10:[function(require,module,exports){ 1061 /*globals _ */1062 1063 1052 /** 1064 1053 * wp.media.view.AttachmentCompat … … 1144 1133 1145 1134 module.exports = AttachmentCompat; 1135 1146 1136 },{"./view.js":51}],11:[function(require,module,exports){ 1147 /*globals _, jQuery */1148 1149 1137 /** 1150 1138 * wp.media.view.AttachmentFilters … … 1223 1211 1224 1212 module.exports = AttachmentFilters; 1213 1225 1214 },{"./view.js":51}],12:[function(require,module,exports){ 1226 /*globals _, wp */1227 1228 1215 /** 1229 1216 * wp.media.view.AttachmentFilters.All … … 1315 1302 1316 1303 module.exports = All; 1304 1317 1305 },{"../attachment-filters.js":11}],13:[function(require,module,exports){ 1318 /*globals _, wp */1319 1320 1306 /** 1321 1307 * A filter dropdown for month/dates. … … 1358 1344 1359 1345 module.exports = DateFilter; 1346 1360 1347 },{"../attachment-filters.js":11}],14:[function(require,module,exports){ 1361 /*globals wp */1362 1363 1348 /** 1364 1349 * wp.media.view.AttachmentFilters.Uploaded … … 1419 1404 1420 1405 module.exports = Uploaded; 1406 1421 1407 },{"../attachment-filters.js":11}],15:[function(require,module,exports){ 1422 /*globals _, wp, jQuery */1423 1424 1408 /** 1425 1409 * wp.media.view.Attachment … … 1974 1958 1975 1959 module.exports = Attachment; 1960 1976 1961 },{"./view.js":51}],16:[function(require,module,exports){ 1977 /*globals wp */1978 1979 1962 /** 1980 1963 * A similar view to media.view.Attachment.Details … … 2011 1994 this.$( 'audio, video' ).each( function (i, elem) { 2012 1995 var el = MediaDetails.prepareSrc( elem ); 2013 new MediaElementPlayer( el, wp.media.mixin.mejsSettings );1996 new window.MediaElementPlayer( el, wp.media.mixin.mejsSettings ); 2014 1997 } ); 2015 1998 } … … 2017 2000 2018 2001 module.exports = TwoColumn; 2002 2019 2003 },{"../media-details.js":33,"./details.js":17}],17:[function(require,module,exports){ 2020 /*globals _, wp */2021 2022 2004 /** 2023 2005 * wp.media.view.Attachment.Details … … 2079 2061 event.preventDefault(); 2080 2062 2081 if ( confirm( l10n.warnDelete ) ) {2063 if ( window.confirm( l10n.warnDelete ) ) { 2082 2064 this.model.destroy(); 2083 2065 // Keep focus inside media modal … … 2158 2140 2159 2141 module.exports = Details; 2142 2160 2143 },{"../attachment.js":15}],18:[function(require,module,exports){ 2161 2144 /** … … 2178 2161 2179 2162 module.exports = Library; 2163 2180 2164 },{"../attachment.js":15}],19:[function(require,module,exports){ 2181 /*globals _, wp, jQuery */2182 2183 2165 /** 2184 2166 * wp.media.view.Attachments … … 2453 2435 // The scroll event occurs on the document, but the element 2454 2436 // that should be checked is the document body. 2455 if ( el == document ) {2437 if ( el === document ) { 2456 2438 el = document.body; 2457 2439 scrollTop = $(document).scrollTop(); … … 2479 2461 2480 2462 module.exports = Attachments; 2463 2481 2464 },{"./attachment.js":15,"./view.js":51}],20:[function(require,module,exports){ 2482 /*globals _, wp, jQuery */2483 2484 2465 /** 2485 2466 * wp.media.view.AttachmentsBrowser … … 2672 2653 } 2673 2654 2674 if ( ! mediaTrash && ! confirm( l10n.warnBulkDelete ) ) {2655 if ( ! mediaTrash && ! window.confirm( l10n.warnBulkDelete ) ) { 2675 2656 return; 2676 2657 } … … 2678 2659 if ( mediaTrash && 2679 2660 'trash' !== selection.at( 0 ).get( 'status' ) && 2680 ! confirm( l10n.warnBulkTrash ) ) {2661 ! window.confirm( l10n.warnBulkTrash ) ) { 2681 2662 2682 2663 return; … … 2726 2707 var removed = [], selection = this.controller.state().get( 'selection' ); 2727 2708 2728 if ( ! selection.length || ! confirm( l10n.warnBulkDelete ) ) {2709 if ( ! selection.length || ! window.confirm( l10n.warnBulkDelete ) ) { 2729 2710 return; 2730 2711 } … … 2939 2920 2940 2921 module.exports = AttachmentsBrowser; 2922 2941 2923 },{"../attachment-compat.js":10,"../attachment-filters/all.js":12,"../attachment-filters/date.js":13,"../attachment-filters/uploaded.js":14,"../attachment/details.js":17,"../attachment/library.js":18,"../attachments.js":19,"../label.js":32,"../search.js":41,"../settings/attachment-display.js":43,"../sidebar.js":44,"../spinner.js":45,"../toolbar.js":46,"../uploader/inline.js":47,"../uploader/status.js":49,"../view.js":51}],21:[function(require,module,exports){ 2942 /*globals _, Backbone */2943 2944 2924 /** 2945 2925 * wp.media.view.Button … … 3029 3009 3030 3010 module.exports = Button; 3011 3031 3012 },{"./view.js":51}],22:[function(require,module,exports){ 3032 3013 /** … … 3073 3054 3074 3055 module.exports = DeleteSelectedPermanently; 3056 3075 3057 },{"../button.js":21,"./delete-selected.js":23}],23:[function(require,module,exports){ 3076 /*globals wp */3077 3078 3058 /** 3079 3059 * A button that handles bulk Delete/Trash logic … … 3125 3105 3126 3106 module.exports = DeleteSelected; 3107 3127 3108 },{"../button.js":21}],24:[function(require,module,exports){ 3128 /*globals wp */3129 3130 3109 var Button = require( '../button.js' ), 3131 3110 l10n = wp.media.view.l10n, … … 3181 3160 3182 3161 module.exports = SelectModeToggle; 3162 3183 3163 },{"../button.js":21}],25:[function(require,module,exports){ 3184 3164 var View = require( './view.js' ), … … 3206 3186 3207 3187 module.exports = Details; 3188 3208 3189 },{"./edit-image.js":26,"./view.js":51}],26:[function(require,module,exports){ 3209 /*globals _, wp */3210 3211 3190 var View = require( './view.js' ), 3212 3191 EditImage; … … 3260 3239 3261 3240 module.exports = EditImage; 3241 3262 3242 },{"./view.js":51}],27:[function(require,module,exports){ 3263 3243 /** … … 3308 3288 3309 3289 module.exports = FocusManager; 3290 3310 3291 },{"./view.js":51}],28:[function(require,module,exports){ 3311 /*globals _, Backbone */3312 3313 3292 /** 3314 3293 * wp.media.view.Frame … … 3481 3460 3482 3461 module.exports = Frame; 3462 3483 3463 },{"../controllers/region.js":4,"../controllers/state-machine.js":5,"../controllers/state.js":6,"./view.js":51}],29:[function(require,module,exports){ 3484 /*globals _, wp, jQuery */3485 3486 3464 /** 3487 3465 * A frame for editing the details of a specific media item. … … 3728 3706 3729 3707 module.exports = EditAttachments; 3708 3730 3709 },{"../../controllers/edit-attachment-metadata.js":1,"../../controllers/edit-image.js":2,"../attachment-compat.js":10,"../attachment/details-two-column.js":16,"../edit-image-details.js":25,"../frame.js":28,"../media-frame.js":34,"../modal.js":37}],30:[function(require,module,exports){ 3731 /*globals _, Backbone, wp, jQuery */3732 3733 3710 /** 3734 3711 * wp.media.view.MediaFrame.Manage … … 3968 3945 if ( window.history && window.history.pushState ) { 3969 3946 Backbone.history.start( { 3970 root: _wpMediaGridSettings.adminUrl,3947 root: window._wpMediaGridSettings.adminUrl, 3971 3948 pushState: true 3972 3949 } ); … … 3976 3953 3977 3954 module.exports = Manage; 3955 3978 3956 },{"../../controllers/library.js":3,"../../routers/manage.js":8,"../attachments/browser.js":20,"../media-frame.js":34,"../uploader/window.js":50}],31:[function(require,module,exports){ 3979 3957 /** … … 4002 3980 4003 3981 module.exports = Iframe; 3982 4004 3983 },{"./view.js":51}],32:[function(require,module,exports){ 4005 3984 /** … … 4028 4007 4029 4008 module.exports = Label; 4009 4030 4010 },{"./view.js":51}],33:[function(require,module,exports){ 4031 /*globals _, wp, jQuery */4032 4033 4011 /** 4034 4012 * wp.media.view.MediaDetails … … 4114 4092 setPlayer : function() { 4115 4093 if ( ! this.players.length && this.media ) { 4116 this.players.push( new MediaElementPlayer( this.media, this.settings ) );4094 this.players.push( new window.MediaElementPlayer( this.media, this.settings ) ); 4117 4095 } 4118 4096 }, … … 4142 4120 render: function() { 4143 4121 AttachmentDisplay.prototype.render.apply( this, arguments ); 4144 4122 4145 4123 setTimeout( _.bind( function() { 4146 4124 this.resetFocus(); … … 4181 4159 4182 4160 module.exports = MediaDetails; 4161 4183 4162 },{"./settings/attachment-display.js":43}],34:[function(require,module,exports){ 4184 /*globals _, wp, jQuery */4185 4186 4163 /** 4187 4164 * wp.media.view.MediaFrame … … 4436 4413 4437 4414 module.exports = MediaFrame; 4415 4438 4416 },{"./frame.js":28,"./iframe.js":31,"./menu.js":36,"./modal.js":37,"./router.js":40,"./toolbar.js":46,"./uploader/window.js":50,"./view.js":51}],35:[function(require,module,exports){ 4439 /*globals wp, jQuery */4440 4441 4417 /** 4442 4418 * wp.media.view.MenuItem … … 4510 4486 4511 4487 module.exports = MenuItem; 4488 4512 4489 },{"./view.js":51}],36:[function(require,module,exports){ 4513 4490 /** … … 4626 4603 4627 4604 module.exports = Menu; 4605 4628 4606 },{"./menu-item.js":35,"./priority-list.js":38}],37:[function(require,module,exports){ 4629 /*globals _, wp, jQuery */4630 4631 4607 /** 4632 4608 * wp.media.view.Modal … … 4842 4818 4843 4819 module.exports = Modal; 4820 4844 4821 },{"./focus-manager.js":27,"./view.js":51}],38:[function(require,module,exports){ 4845 /*globals _, Backbone */4846 4847 4822 /** 4848 4823 * wp.media.view.PriorityList … … 4943 4918 4944 4919 module.exports = PriorityList; 4920 4945 4921 },{"./view.js":51}],39:[function(require,module,exports){ 4946 4922 /** … … 4969 4945 4970 4946 module.exports = RouterItem; 4947 4971 4948 },{"./menu-item.js":35}],40:[function(require,module,exports){ 4972 4949 /** … … 5006 4983 5007 4984 module.exports = Router; 4985 5008 4986 },{"./menu.js":36,"./router-item.js":39}],41:[function(require,module,exports){ 5009 /*globals wp */5010 5011 4987 /** 5012 4988 * wp.media.view.Search … … 5056 5032 5057 5033 module.exports = Search; 5034 5058 5035 },{"./view.js":51}],42:[function(require,module,exports){ 5059 /*globals _, Backbone, jQuery */5060 5061 5036 /** 5062 5037 * wp.media.view.Settings … … 5166 5141 // update that as well. 5167 5142 if ( userSetting = $setting.data('userSetting') ) { 5168 setUserSetting( userSetting, value );5143 window.setUserSetting( userSetting, value ); 5169 5144 } 5170 5145 }, … … 5178 5153 5179 5154 module.exports = Settings; 5155 5180 5156 },{"./view.js":51}],43:[function(require,module,exports){ 5181 /*globals _, wp */5182 5183 5157 /** 5184 5158 * wp.media.view.Settings.AttachmentDisplay … … 5273 5247 5274 5248 module.exports = AttachmentDisplay; 5249 5275 5250 },{"../settings.js":42}],44:[function(require,module,exports){ 5276 5251 /** … … 5291 5266 5292 5267 module.exports = Sidebar; 5268 5293 5269 },{"./priority-list.js":38}],45:[function(require,module,exports){ 5294 /*globals _, wp */5295 5296 5270 /** 5297 5271 * wp.media.view.Spinner … … 5330 5304 5331 5305 module.exports = Spinner; 5306 5332 5307 },{"./view.js":51}],46:[function(require,module,exports){ 5333 /*globals Backbone, _ */5334 5335 5308 /** 5336 5309 * wp.media.view.Toolbar … … 5493 5466 5494 5467 module.exports = Toolbar; 5468 5495 5469 },{"./button.js":21,"./priority-list.js":38,"./view.js":51}],47:[function(require,module,exports){ 5496 /*globals _, wp */5497 5498 5470 /** 5499 5471 * wp.media.view.UploaderInline … … 5626 5598 5627 5599 module.exports = UploaderInline; 5600 5628 5601 },{"../view.js":51,"./status.js":49}],48:[function(require,module,exports){ 5629 /*globals wp */5630 5631 5602 /** 5632 5603 * wp.media.view.UploaderStatusError … … 5646 5617 5647 5618 module.exports = UploaderStatusError; 5619 5648 5620 },{"../view.js":51}],49:[function(require,module,exports){ 5649 /*globals _, wp */5650 5651 5621 /** 5652 5622 * wp.media.view.UploaderStatus … … 5786 5756 5787 5757 module.exports = UploaderStatus; 5758 5788 5759 },{"../view.js":51,"./status-error.js":48}],50:[function(require,module,exports){ 5789 /*globals _, wp, jQuery */5790 5791 5760 /** 5792 5761 * wp.media.view.UploaderWindow … … 5899 5868 5900 5869 module.exports = UploaderWindow; 5870 5901 5871 },{"../view.js":51}],51:[function(require,module,exports){ 5902 /*globals wp */5903 5904 5872 /** 5905 5873 * wp.media.View … … 5966 5934 5967 5935 module.exports = View; 5936 5968 5937 },{}]},{},[7]); -
trunk/src/wp-includes/js/media/grid.manifest.js
r31373 r31385 1 /* global wp, _wpMediaViewsL10n, MediaElementPlayer, _wpMediaGridSettings */ 2 (function (wp) { 3 var media = wp.media; 1 var media = wp.media; 4 2 5 media.controller.EditAttachmentMetadata = require( './controllers/edit-attachment-metadata.js' ); 6 media.view.MediaFrame.Manage = require( './views/frame/manage.js' ); 7 media.view.Attachment.Details.TwoColumn = require( './views/attachment/details-two-column.js' ); 8 media.view.MediaFrame.Manage.Router = require( './routers/manage.js' ); 9 media.view.EditImage.Details = require( './views/edit-image-details.js' ); 10 media.view.MediaFrame.EditAttachments = require( './views/frame/edit-attachments.js' ); 11 media.view.SelectModeToggleButton = require( './views/button/select-mode-toggle.js' ); 12 media.view.DeleteSelectedButton = require( './views/button/delete-selected.js' ); 13 media.view.DeleteSelectedPermanentlyButton = require( './views/button/delete-selected-permanently.js' ); 14 15 }(wp)); 3 media.controller.EditAttachmentMetadata = require( './controllers/edit-attachment-metadata.js' ); 4 media.view.MediaFrame.Manage = require( './views/frame/manage.js' ); 5 media.view.Attachment.Details.TwoColumn = require( './views/attachment/details-two-column.js' ); 6 media.view.MediaFrame.Manage.Router = require( './routers/manage.js' ); 7 media.view.EditImage.Details = require( './views/edit-image-details.js' ); 8 media.view.MediaFrame.EditAttachments = require( './views/frame/edit-attachments.js' ); 9 media.view.SelectModeToggleButton = require( './views/button/select-mode-toggle.js' ); 10 media.view.DeleteSelectedButton = require( './views/button/delete-selected.js' ); 11 media.view.DeleteSelectedPermanentlyButton = require( './views/button/delete-selected-permanently.js' ); -
trunk/src/wp-includes/js/media/models.js
r31373 r31385 1 1 (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){ 2 /* global _wpMediaModelsL10n:false */ 2 var $ = jQuery, 3 Attachment, Attachments, l10n, media; 4 3 5 window.wp = window.wp || {}; 4 6 5 (function($){ 6 var Attachment, Attachments, l10n, media; 7 8 /** 9 * Create and return a media frame. 10 * 11 * Handles the default media experience. 12 * 13 * @param {object} attributes The properties passed to the main media controller. 14 * @return {wp.media.view.MediaFrame} A media workflow. 15 */ 16 media = wp.media = function( attributes ) { 17 var MediaFrame = media.view.MediaFrame, 18 frame; 19 20 if ( ! MediaFrame ) { 21 return; 22 } 23 24 attributes = _.defaults( attributes || {}, { 25 frame: 'select' 26 }); 27 28 if ( 'select' === attributes.frame && MediaFrame.Select ) { 29 frame = new MediaFrame.Select( attributes ); 30 } else if ( 'post' === attributes.frame && MediaFrame.Post ) { 31 frame = new MediaFrame.Post( attributes ); 32 } else if ( 'manage' === attributes.frame && MediaFrame.Manage ) { 33 frame = new MediaFrame.Manage( attributes ); 34 } else if ( 'image' === attributes.frame && MediaFrame.ImageDetails ) { 35 frame = new MediaFrame.ImageDetails( attributes ); 36 } else if ( 'audio' === attributes.frame && MediaFrame.AudioDetails ) { 37 frame = new MediaFrame.AudioDetails( attributes ); 38 } else if ( 'video' === attributes.frame && MediaFrame.VideoDetails ) { 39 frame = new MediaFrame.VideoDetails( attributes ); 40 } else if ( 'edit-attachments' === attributes.frame && MediaFrame.EditAttachments ) { 41 frame = new MediaFrame.EditAttachments( attributes ); 42 } 43 44 delete attributes.frame; 45 46 media.frame = frame; 47 48 return frame; 49 }; 50 51 _.extend( media, { model: {}, view: {}, controller: {}, frames: {} }); 52 53 // Link any localized strings. 54 l10n = media.model.l10n = typeof _wpMediaModelsL10n === 'undefined' ? {} : _wpMediaModelsL10n; 55 56 // Link any settings. 57 media.model.settings = l10n.settings || {}; 58 delete l10n.settings; 59 60 Attachments = media.model.Attachments = require( './models/attachments.js' ); 61 Attachment = media.model.Attachment = require( './models/attachment.js' ); 62 63 media.model.Query = require( './models/query.js' ); 64 media.model.PostImage = require( './models/post-image.js' ); 65 media.model.Selection = require( './models/selection.js' ); 66 67 /** 68 * ======================================================================== 69 * UTILITIES 70 * ======================================================================== 71 */ 72 73 /** 74 * A basic equality comparator for Backbone models. 75 * 76 * Used to order models within a collection - @see wp.media.model.Attachments.comparator(). 77 * 78 * @param {mixed} a The primary parameter to compare. 79 * @param {mixed} b The primary parameter to compare. 80 * @param {string} ac The fallback parameter to compare, a's cid. 81 * @param {string} bc The fallback parameter to compare, b's cid. 82 * @return {number} -1: a should come before b. 83 * 0: a and b are of the same rank. 84 * 1: b should come before a. 85 */ 86 media.compare = function( a, b, ac, bc ) { 87 if ( _.isEqual( a, b ) ) { 88 return ac === bc ? 0 : (ac > bc ? -1 : 1); 7 /** 8 * Create and return a media frame. 9 * 10 * Handles the default media experience. 11 * 12 * @param {object} attributes The properties passed to the main media controller. 13 * @return {wp.media.view.MediaFrame} A media workflow. 14 */ 15 media = wp.media = function( attributes ) { 16 var MediaFrame = media.view.MediaFrame, 17 frame; 18 19 if ( ! MediaFrame ) { 20 return; 21 } 22 23 attributes = _.defaults( attributes || {}, { 24 frame: 'select' 25 }); 26 27 if ( 'select' === attributes.frame && MediaFrame.Select ) { 28 frame = new MediaFrame.Select( attributes ); 29 } else if ( 'post' === attributes.frame && MediaFrame.Post ) { 30 frame = new MediaFrame.Post( attributes ); 31 } else if ( 'manage' === attributes.frame && MediaFrame.Manage ) { 32 frame = new MediaFrame.Manage( attributes ); 33 } else if ( 'image' === attributes.frame && MediaFrame.ImageDetails ) { 34 frame = new MediaFrame.ImageDetails( attributes ); 35 } else if ( 'audio' === attributes.frame && MediaFrame.AudioDetails ) { 36 frame = new MediaFrame.AudioDetails( attributes ); 37 } else if ( 'video' === attributes.frame && MediaFrame.VideoDetails ) { 38 frame = new MediaFrame.VideoDetails( attributes ); 39 } else if ( 'edit-attachments' === attributes.frame && MediaFrame.EditAttachments ) { 40 frame = new MediaFrame.EditAttachments( attributes ); 41 } 42 43 delete attributes.frame; 44 45 media.frame = frame; 46 47 return frame; 48 }; 49 50 _.extend( media, { model: {}, view: {}, controller: {}, frames: {} }); 51 52 // Link any localized strings. 53 l10n = media.model.l10n = window._wpMediaModelsL10n || {}; 54 55 // Link any settings. 56 media.model.settings = l10n.settings || {}; 57 delete l10n.settings; 58 59 Attachments = media.model.Attachments = require( './models/attachments.js' ); 60 Attachment = media.model.Attachment = require( './models/attachment.js' ); 61 62 media.model.Query = require( './models/query.js' ); 63 media.model.PostImage = require( './models/post-image.js' ); 64 media.model.Selection = require( './models/selection.js' ); 65 66 /** 67 * ======================================================================== 68 * UTILITIES 69 * ======================================================================== 70 */ 71 72 /** 73 * A basic equality comparator for Backbone models. 74 * 75 * Used to order models within a collection - @see wp.media.model.Attachments.comparator(). 76 * 77 * @param {mixed} a The primary parameter to compare. 78 * @param {mixed} b The primary parameter to compare. 79 * @param {string} ac The fallback parameter to compare, a's cid. 80 * @param {string} bc The fallback parameter to compare, b's cid. 81 * @return {number} -1: a should come before b. 82 * 0: a and b are of the same rank. 83 * 1: b should come before a. 84 */ 85 media.compare = function( a, b, ac, bc ) { 86 if ( _.isEqual( a, b ) ) { 87 return ac === bc ? 0 : (ac > bc ? -1 : 1); 88 } else { 89 return a > b ? -1 : 1; 90 } 91 }; 92 93 _.extend( media, { 94 /** 95 * media.template( id ) 96 * 97 * Fetch a JavaScript template for an id, and return a templating function for it. 98 * 99 * See wp.template() in `wp-includes/js/wp-util.js`. 100 * 101 * @borrows wp.template as template 102 */ 103 template: wp.template, 104 105 /** 106 * media.post( [action], [data] ) 107 * 108 * Sends a POST request to WordPress. 109 * See wp.ajax.post() in `wp-includes/js/wp-util.js`. 110 * 111 * @borrows wp.ajax.post as post 112 */ 113 post: wp.ajax.post, 114 115 /** 116 * media.ajax( [action], [options] ) 117 * 118 * Sends an XHR request to WordPress. 119 * See wp.ajax.send() in `wp-includes/js/wp-util.js`. 120 * 121 * @borrows wp.ajax.send as ajax 122 */ 123 ajax: wp.ajax.send, 124 125 /** 126 * Scales a set of dimensions to fit within bounding dimensions. 127 * 128 * @param {Object} dimensions 129 * @returns {Object} 130 */ 131 fit: function( dimensions ) { 132 var width = dimensions.width, 133 height = dimensions.height, 134 maxWidth = dimensions.maxWidth, 135 maxHeight = dimensions.maxHeight, 136 constraint; 137 138 // Compare ratios between the two values to determine which 139 // max to constrain by. If a max value doesn't exist, then the 140 // opposite side is the constraint. 141 if ( ! _.isUndefined( maxWidth ) && ! _.isUndefined( maxHeight ) ) { 142 constraint = ( width / height > maxWidth / maxHeight ) ? 'width' : 'height'; 143 } else if ( _.isUndefined( maxHeight ) ) { 144 constraint = 'width'; 145 } else if ( _.isUndefined( maxWidth ) && height > maxHeight ) { 146 constraint = 'height'; 147 } 148 149 // If the value of the constrained side is larger than the max, 150 // then scale the values. Otherwise return the originals; they fit. 151 if ( 'width' === constraint && width > maxWidth ) { 152 return { 153 width : maxWidth, 154 height: Math.round( maxWidth * height / width ) 155 }; 156 } else if ( 'height' === constraint && height > maxHeight ) { 157 return { 158 width : Math.round( maxHeight * width / height ), 159 height: maxHeight 160 }; 89 161 } else { 90 return a > b ? -1 : 1; 91 } 92 }; 93 94 _.extend( media, { 95 /** 96 * media.template( id ) 97 * 98 * Fetch a JavaScript template for an id, and return a templating function for it. 99 * 100 * See wp.template() in `wp-includes/js/wp-util.js`. 101 * 102 * @borrows wp.template as template 103 */ 104 template: wp.template, 105 106 /** 107 * media.post( [action], [data] ) 108 * 109 * Sends a POST request to WordPress. 110 * See wp.ajax.post() in `wp-includes/js/wp-util.js`. 111 * 112 * @borrows wp.ajax.post as post 113 */ 114 post: wp.ajax.post, 115 116 /** 117 * media.ajax( [action], [options] ) 118 * 119 * Sends an XHR request to WordPress. 120 * See wp.ajax.send() in `wp-includes/js/wp-util.js`. 121 * 122 * @borrows wp.ajax.send as ajax 123 */ 124 ajax: wp.ajax.send, 125 126 /** 127 * Scales a set of dimensions to fit within bounding dimensions. 128 * 129 * @param {Object} dimensions 130 * @returns {Object} 131 */ 132 fit: function( dimensions ) { 133 var width = dimensions.width, 134 height = dimensions.height, 135 maxWidth = dimensions.maxWidth, 136 maxHeight = dimensions.maxHeight, 137 constraint; 138 139 // Compare ratios between the two values to determine which 140 // max to constrain by. If a max value doesn't exist, then the 141 // opposite side is the constraint. 142 if ( ! _.isUndefined( maxWidth ) && ! _.isUndefined( maxHeight ) ) { 143 constraint = ( width / height > maxWidth / maxHeight ) ? 'width' : 'height'; 144 } else if ( _.isUndefined( maxHeight ) ) { 145 constraint = 'width'; 146 } else if ( _.isUndefined( maxWidth ) && height > maxHeight ) { 147 constraint = 'height'; 148 } 149 150 // If the value of the constrained side is larger than the max, 151 // then scale the values. Otherwise return the originals; they fit. 152 if ( 'width' === constraint && width > maxWidth ) { 153 return { 154 width : maxWidth, 155 height: Math.round( maxWidth * height / width ) 156 }; 157 } else if ( 'height' === constraint && height > maxHeight ) { 158 return { 159 width : Math.round( maxHeight * width / height ), 160 height: maxHeight 161 }; 162 } else { 163 return { 164 width : width, 165 height: height 166 }; 167 } 168 }, 169 /** 170 * Truncates a string by injecting an ellipsis into the middle. 171 * Useful for filenames. 172 * 173 * @param {String} string 174 * @param {Number} [length=30] 175 * @param {String} [replacement=…] 176 * @returns {String} The string, unless length is greater than string.length. 177 */ 178 truncate: function( string, length, replacement ) { 179 length = length || 30; 180 replacement = replacement || '…'; 181 182 if ( string.length <= length ) { 183 return string; 184 } 185 186 return string.substr( 0, length / 2 ) + replacement + string.substr( -1 * length / 2 ); 187 } 162 return { 163 width : width, 164 height: height 165 }; 166 } 167 }, 168 /** 169 * Truncates a string by injecting an ellipsis into the middle. 170 * Useful for filenames. 171 * 172 * @param {String} string 173 * @param {Number} [length=30] 174 * @param {String} [replacement=…] 175 * @returns {String} The string, unless length is greater than string.length. 176 */ 177 truncate: function( string, length, replacement ) { 178 length = length || 30; 179 replacement = replacement || '…'; 180 181 if ( string.length <= length ) { 182 return string; 183 } 184 185 return string.substr( 0, length / 2 ) + replacement + string.substr( -1 * length / 2 ); 186 } 187 }); 188 189 /** 190 * ======================================================================== 191 * MODELS 192 * ======================================================================== 193 */ 194 /** 195 * wp.media.attachment 196 * 197 * @static 198 * @param {String} id A string used to identify a model. 199 * @returns {wp.media.model.Attachment} 200 */ 201 media.attachment = function( id ) { 202 return Attachment.get( id ); 203 }; 204 205 /** 206 * A collection of all attachments that have been fetched from the server. 207 * 208 * @static 209 * @member {wp.media.model.Attachments} 210 */ 211 Attachments.all = new Attachments(); 212 213 /** 214 * wp.media.query 215 * 216 * Shorthand for creating a new Attachments Query. 217 * 218 * @param {object} [props] 219 * @returns {wp.media.model.Attachments} 220 */ 221 media.query = function( props ) { 222 return new Attachments( null, { 223 props: _.extend( _.defaults( props || {}, { orderby: 'date' } ), { query: true } ) 188 224 }); 189 190 /** 191 * ======================================================================== 192 * MODELS 193 * ======================================================================== 194 */ 195 /** 196 * wp.media.attachment 197 * 198 * @static 199 * @param {String} id A string used to identify a model. 200 * @returns {wp.media.model.Attachment} 201 */ 202 media.attachment = function( id ) { 203 return Attachment.get( id ); 204 }; 205 206 /** 207 * A collection of all attachments that have been fetched from the server. 208 * 209 * @static 210 * @member {wp.media.model.Attachments} 211 */ 212 Attachments.all = new Attachments(); 213 214 /** 215 * wp.media.query 216 * 217 * Shorthand for creating a new Attachments Query. 218 * 219 * @param {object} [props] 220 * @returns {wp.media.model.Attachments} 221 */ 222 media.query = function( props ) { 223 return new Attachments( null, { 224 props: _.extend( _.defaults( props || {}, { orderby: 'date' } ), { query: true } ) 225 }); 226 }; 227 228 // Clean up. Prevents mobile browsers caching 229 $(window).on('unload', function(){ 230 window.wp = null; 231 }); 232 233 }(jQuery)); 225 }; 226 227 // Clean up. Prevents mobile browsers caching 228 $(window).on('unload', function(){ 229 window.wp = null; 230 }); 231 234 232 },{"./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){ 235 /*globals jQuery, Backbone, _, wp */236 237 233 /** 238 234 * wp.media.model.Attachment … … 363 359 } 364 360 365 return media.post( 'save-attachment-compat', _.defaults({361 return wp.media.post( 'save-attachment-compat', _.defaults({ 366 362 id: this.id, 367 363 nonce: this.get('nonces').update, … … 401 397 402 398 module.exports = Attachment; 399 403 400 },{"./attachments.js":3}],3:[function(require,module,exports){ 404 /*globals jQuery, Backbone, _, wp */405 406 401 /** 407 402 * wp.media.model.Attachments … … 727 722 // the request resolves. 728 723 mirroring.more( options ).done( function() { 729 if ( this === attachments.mirroring ) 724 if ( this === attachments.mirroring ) { 730 725 deferred.resolveWith( this ); 726 } 731 727 }); 732 728 … … 937 933 938 934 module.exports = Attachments; 935 939 936 },{"./attachment.js":2,"./query.js":5}],4:[function(require,module,exports){ 940 /*globals jQuery, Backbone */941 942 937 /** 943 938 * wp.media.model.PostImage … … 1094 1089 1095 1090 module.exports = PostImage; 1091 1096 1092 },{"./attachment":2}],5:[function(require,module,exports){ 1097 /*globals jQuery, _, wp */1098 1099 1093 /** 1100 1094 * wp.media.model.Query … … 1403 1397 1404 1398 module.exports = Query; 1399 1405 1400 },{"./attachments.js":3}],6:[function(require,module,exports){ 1406 /*globals _ */1407 1408 1401 /** 1409 1402 * wp.media.model.Selection … … 1501 1494 1502 1495 module.exports = Selection; 1496 1503 1497 },{"./attachments.js":3}]},{},[1]); -
trunk/src/wp-includes/js/media/models.manifest.js
r31373 r31385 1 /* global _wpMediaModelsL10n:false */ 1 var $ = jQuery, 2 Attachment, Attachments, l10n, media; 3 2 4 window.wp = window.wp || {}; 3 5 4 (function($){ 5 var Attachment, Attachments, l10n, media; 6 7 /** 8 * Create and return a media frame. 9 * 10 * Handles the default media experience. 11 * 12 * @param {object} attributes The properties passed to the main media controller. 13 * @return {wp.media.view.MediaFrame} A media workflow. 14 */ 15 media = wp.media = function( attributes ) { 16 var MediaFrame = media.view.MediaFrame, 17 frame; 18 19 if ( ! MediaFrame ) { 20 return; 6 /** 7 * Create and return a media frame. 8 * 9 * Handles the default media experience. 10 * 11 * @param {object} attributes The properties passed to the main media controller. 12 * @return {wp.media.view.MediaFrame} A media workflow. 13 */ 14 media = wp.media = function( attributes ) { 15 var MediaFrame = media.view.MediaFrame, 16 frame; 17 18 if ( ! MediaFrame ) { 19 return; 20 } 21 22 attributes = _.defaults( attributes || {}, { 23 frame: 'select' 24 }); 25 26 if ( 'select' === attributes.frame && MediaFrame.Select ) { 27 frame = new MediaFrame.Select( attributes ); 28 } else if ( 'post' === attributes.frame && MediaFrame.Post ) { 29 frame = new MediaFrame.Post( attributes ); 30 } else if ( 'manage' === attributes.frame && MediaFrame.Manage ) { 31 frame = new MediaFrame.Manage( attributes ); 32 } else if ( 'image' === attributes.frame && MediaFrame.ImageDetails ) { 33 frame = new MediaFrame.ImageDetails( attributes ); 34 } else if ( 'audio' === attributes.frame && MediaFrame.AudioDetails ) { 35 frame = new MediaFrame.AudioDetails( attributes ); 36 } else if ( 'video' === attributes.frame && MediaFrame.VideoDetails ) { 37 frame = new MediaFrame.VideoDetails( attributes ); 38 } else if ( 'edit-attachments' === attributes.frame && MediaFrame.EditAttachments ) { 39 frame = new MediaFrame.EditAttachments( attributes ); 40 } 41 42 delete attributes.frame; 43 44 media.frame = frame; 45 46 return frame; 47 }; 48 49 _.extend( media, { model: {}, view: {}, controller: {}, frames: {} }); 50 51 // Link any localized strings. 52 l10n = media.model.l10n = window._wpMediaModelsL10n || {}; 53 54 // Link any settings. 55 media.model.settings = l10n.settings || {}; 56 delete l10n.settings; 57 58 Attachments = media.model.Attachments = require( './models/attachments.js' ); 59 Attachment = media.model.Attachment = require( './models/attachment.js' ); 60 61 media.model.Query = require( './models/query.js' ); 62 media.model.PostImage = require( './models/post-image.js' ); 63 media.model.Selection = require( './models/selection.js' ); 64 65 /** 66 * ======================================================================== 67 * UTILITIES 68 * ======================================================================== 69 */ 70 71 /** 72 * A basic equality comparator for Backbone models. 73 * 74 * Used to order models within a collection - @see wp.media.model.Attachments.comparator(). 75 * 76 * @param {mixed} a The primary parameter to compare. 77 * @param {mixed} b The primary parameter to compare. 78 * @param {string} ac The fallback parameter to compare, a's cid. 79 * @param {string} bc The fallback parameter to compare, b's cid. 80 * @return {number} -1: a should come before b. 81 * 0: a and b are of the same rank. 82 * 1: b should come before a. 83 */ 84 media.compare = function( a, b, ac, bc ) { 85 if ( _.isEqual( a, b ) ) { 86 return ac === bc ? 0 : (ac > bc ? -1 : 1); 87 } else { 88 return a > b ? -1 : 1; 89 } 90 }; 91 92 _.extend( media, { 93 /** 94 * media.template( id ) 95 * 96 * Fetch a JavaScript template for an id, and return a templating function for it. 97 * 98 * See wp.template() in `wp-includes/js/wp-util.js`. 99 * 100 * @borrows wp.template as template 101 */ 102 template: wp.template, 103 104 /** 105 * media.post( [action], [data] ) 106 * 107 * Sends a POST request to WordPress. 108 * See wp.ajax.post() in `wp-includes/js/wp-util.js`. 109 * 110 * @borrows wp.ajax.post as post 111 */ 112 post: wp.ajax.post, 113 114 /** 115 * media.ajax( [action], [options] ) 116 * 117 * Sends an XHR request to WordPress. 118 * See wp.ajax.send() in `wp-includes/js/wp-util.js`. 119 * 120 * @borrows wp.ajax.send as ajax 121 */ 122 ajax: wp.ajax.send, 123 124 /** 125 * Scales a set of dimensions to fit within bounding dimensions. 126 * 127 * @param {Object} dimensions 128 * @returns {Object} 129 */ 130 fit: function( dimensions ) { 131 var width = dimensions.width, 132 height = dimensions.height, 133 maxWidth = dimensions.maxWidth, 134 maxHeight = dimensions.maxHeight, 135 constraint; 136 137 // Compare ratios between the two values to determine which 138 // max to constrain by. If a max value doesn't exist, then the 139 // opposite side is the constraint. 140 if ( ! _.isUndefined( maxWidth ) && ! _.isUndefined( maxHeight ) ) { 141 constraint = ( width / height > maxWidth / maxHeight ) ? 'width' : 'height'; 142 } else if ( _.isUndefined( maxHeight ) ) { 143 constraint = 'width'; 144 } else if ( _.isUndefined( maxWidth ) && height > maxHeight ) { 145 constraint = 'height'; 21 146 } 22 147 23 attributes = _.defaults( attributes || {}, { 24 frame: 'select' 25 }); 26 27 if ( 'select' === attributes.frame && MediaFrame.Select ) { 28 frame = new MediaFrame.Select( attributes ); 29 } else if ( 'post' === attributes.frame && MediaFrame.Post ) { 30 frame = new MediaFrame.Post( attributes ); 31 } else if ( 'manage' === attributes.frame && MediaFrame.Manage ) { 32 frame = new MediaFrame.Manage( attributes ); 33 } else if ( 'image' === attributes.frame && MediaFrame.ImageDetails ) { 34 frame = new MediaFrame.ImageDetails( attributes ); 35 } else if ( 'audio' === attributes.frame && MediaFrame.AudioDetails ) { 36 frame = new MediaFrame.AudioDetails( attributes ); 37 } else if ( 'video' === attributes.frame && MediaFrame.VideoDetails ) { 38 frame = new MediaFrame.VideoDetails( attributes ); 39 } else if ( 'edit-attachments' === attributes.frame && MediaFrame.EditAttachments ) { 40 frame = new MediaFrame.EditAttachments( attributes ); 148 // If the value of the constrained side is larger than the max, 149 // then scale the values. Otherwise return the originals; they fit. 150 if ( 'width' === constraint && width > maxWidth ) { 151 return { 152 width : maxWidth, 153 height: Math.round( maxWidth * height / width ) 154 }; 155 } else if ( 'height' === constraint && height > maxHeight ) { 156 return { 157 width : Math.round( maxHeight * width / height ), 158 height: maxHeight 159 }; 160 } else { 161 return { 162 width : width, 163 height: height 164 }; 41 165 } 42 43 delete attributes.frame; 44 45 media.frame = frame; 46 47 return frame; 48 }; 49 50 _.extend( media, { model: {}, view: {}, controller: {}, frames: {} }); 51 52 // Link any localized strings. 53 l10n = media.model.l10n = typeof _wpMediaModelsL10n === 'undefined' ? {} : _wpMediaModelsL10n; 54 55 // Link any settings. 56 media.model.settings = l10n.settings || {}; 57 delete l10n.settings; 58 59 Attachments = media.model.Attachments = require( './models/attachments.js' ); 60 Attachment = media.model.Attachment = require( './models/attachment.js' ); 61 62 media.model.Query = require( './models/query.js' ); 63 media.model.PostImage = require( './models/post-image.js' ); 64 media.model.Selection = require( './models/selection.js' ); 65 66 /** 67 * ======================================================================== 68 * UTILITIES 69 * ======================================================================== 70 */ 71 72 /** 73 * A basic equality comparator for Backbone models. 74 * 75 * Used to order models within a collection - @see wp.media.model.Attachments.comparator(). 76 * 77 * @param {mixed} a The primary parameter to compare. 78 * @param {mixed} b The primary parameter to compare. 79 * @param {string} ac The fallback parameter to compare, a's cid. 80 * @param {string} bc The fallback parameter to compare, b's cid. 81 * @return {number} -1: a should come before b. 82 * 0: a and b are of the same rank. 83 * 1: b should come before a. 84 */ 85 media.compare = function( a, b, ac, bc ) { 86 if ( _.isEqual( a, b ) ) { 87 return ac === bc ? 0 : (ac > bc ? -1 : 1); 88 } else { 89 return a > b ? -1 : 1; 166 }, 167 /** 168 * Truncates a string by injecting an ellipsis into the middle. 169 * Useful for filenames. 170 * 171 * @param {String} string 172 * @param {Number} [length=30] 173 * @param {String} [replacement=…] 174 * @returns {String} The string, unless length is greater than string.length. 175 */ 176 truncate: function( string, length, replacement ) { 177 length = length || 30; 178 replacement = replacement || '…'; 179 180 if ( string.length <= length ) { 181 return string; 90 182 } 91 }; 92 93 _.extend( media, { 94 /** 95 * media.template( id ) 96 * 97 * Fetch a JavaScript template for an id, and return a templating function for it. 98 * 99 * See wp.template() in `wp-includes/js/wp-util.js`. 100 * 101 * @borrows wp.template as template 102 */ 103 template: wp.template, 104 105 /** 106 * media.post( [action], [data] ) 107 * 108 * Sends a POST request to WordPress. 109 * See wp.ajax.post() in `wp-includes/js/wp-util.js`. 110 * 111 * @borrows wp.ajax.post as post 112 */ 113 post: wp.ajax.post, 114 115 /** 116 * media.ajax( [action], [options] ) 117 * 118 * Sends an XHR request to WordPress. 119 * See wp.ajax.send() in `wp-includes/js/wp-util.js`. 120 * 121 * @borrows wp.ajax.send as ajax 122 */ 123 ajax: wp.ajax.send, 124 125 /** 126 * Scales a set of dimensions to fit within bounding dimensions. 127 * 128 * @param {Object} dimensions 129 * @returns {Object} 130 */ 131 fit: function( dimensions ) { 132 var width = dimensions.width, 133 height = dimensions.height, 134 maxWidth = dimensions.maxWidth, 135 maxHeight = dimensions.maxHeight, 136 constraint; 137 138 // Compare ratios between the two values to determine which 139 // max to constrain by. If a max value doesn't exist, then the 140 // opposite side is the constraint. 141 if ( ! _.isUndefined( maxWidth ) && ! _.isUndefined( maxHeight ) ) { 142 constraint = ( width / height > maxWidth / maxHeight ) ? 'width' : 'height'; 143 } else if ( _.isUndefined( maxHeight ) ) { 144 constraint = 'width'; 145 } else if ( _.isUndefined( maxWidth ) && height > maxHeight ) { 146 constraint = 'height'; 147 } 148 149 // If the value of the constrained side is larger than the max, 150 // then scale the values. Otherwise return the originals; they fit. 151 if ( 'width' === constraint && width > maxWidth ) { 152 return { 153 width : maxWidth, 154 height: Math.round( maxWidth * height / width ) 155 }; 156 } else if ( 'height' === constraint && height > maxHeight ) { 157 return { 158 width : Math.round( maxHeight * width / height ), 159 height: maxHeight 160 }; 161 } else { 162 return { 163 width : width, 164 height: height 165 }; 166 } 167 }, 168 /** 169 * Truncates a string by injecting an ellipsis into the middle. 170 * Useful for filenames. 171 * 172 * @param {String} string 173 * @param {Number} [length=30] 174 * @param {String} [replacement=…] 175 * @returns {String} The string, unless length is greater than string.length. 176 */ 177 truncate: function( string, length, replacement ) { 178 length = length || 30; 179 replacement = replacement || '…'; 180 181 if ( string.length <= length ) { 182 return string; 183 } 184 185 return string.substr( 0, length / 2 ) + replacement + string.substr( -1 * length / 2 ); 186 } 183 184 return string.substr( 0, length / 2 ) + replacement + string.substr( -1 * length / 2 ); 185 } 186 }); 187 188 /** 189 * ======================================================================== 190 * MODELS 191 * ======================================================================== 192 */ 193 /** 194 * wp.media.attachment 195 * 196 * @static 197 * @param {String} id A string used to identify a model. 198 * @returns {wp.media.model.Attachment} 199 */ 200 media.attachment = function( id ) { 201 return Attachment.get( id ); 202 }; 203 204 /** 205 * A collection of all attachments that have been fetched from the server. 206 * 207 * @static 208 * @member {wp.media.model.Attachments} 209 */ 210 Attachments.all = new Attachments(); 211 212 /** 213 * wp.media.query 214 * 215 * Shorthand for creating a new Attachments Query. 216 * 217 * @param {object} [props] 218 * @returns {wp.media.model.Attachments} 219 */ 220 media.query = function( props ) { 221 return new Attachments( null, { 222 props: _.extend( _.defaults( props || {}, { orderby: 'date' } ), { query: true } ) 187 223 }); 188 189 /** 190 * ======================================================================== 191 * MODELS 192 * ======================================================================== 193 */ 194 /** 195 * wp.media.attachment 196 * 197 * @static 198 * @param {String} id A string used to identify a model. 199 * @returns {wp.media.model.Attachment} 200 */ 201 media.attachment = function( id ) { 202 return Attachment.get( id ); 203 }; 204 205 /** 206 * A collection of all attachments that have been fetched from the server. 207 * 208 * @static 209 * @member {wp.media.model.Attachments} 210 */ 211 Attachments.all = new Attachments(); 212 213 /** 214 * wp.media.query 215 * 216 * Shorthand for creating a new Attachments Query. 217 * 218 * @param {object} [props] 219 * @returns {wp.media.model.Attachments} 220 */ 221 media.query = function( props ) { 222 return new Attachments( null, { 223 props: _.extend( _.defaults( props || {}, { orderby: 'date' } ), { query: true } ) 224 }); 225 }; 226 227 // Clean up. Prevents mobile browsers caching 228 $(window).on('unload', function(){ 229 window.wp = null; 230 }); 231 232 }(jQuery)); 224 }; 225 226 // Clean up. Prevents mobile browsers caching 227 $(window).on('unload', function(){ 228 window.wp = null; 229 }); -
trunk/src/wp-includes/js/media/models/attachment.js
r31373 r31385 1 /*globals jQuery, Backbone, _, wp */2 3 1 /** 4 2 * wp.media.model.Attachment … … 129 127 } 130 128 131 return media.post( 'save-attachment-compat', _.defaults({129 return wp.media.post( 'save-attachment-compat', _.defaults({ 132 130 id: this.id, 133 131 nonce: this.get('nonces').update, -
trunk/src/wp-includes/js/media/models/attachments.js
r31373 r31385 1 /*globals jQuery, Backbone, _, wp */2 3 1 /** 4 2 * wp.media.model.Attachments … … 324 322 // the request resolves. 325 323 mirroring.more( options ).done( function() { 326 if ( this === attachments.mirroring ) 324 if ( this === attachments.mirroring ) { 327 325 deferred.resolveWith( this ); 326 } 328 327 }); 329 328 -
trunk/src/wp-includes/js/media/models/post-image.js
r31373 r31385 1 /*globals jQuery, Backbone */2 3 1 /** 4 2 * wp.media.model.PostImage -
trunk/src/wp-includes/js/media/models/post-media.js
r31380 r31385 1 /*globals Backbone, _, wp */2 3 1 /** 4 2 * Shared model class for audio and video. Updates the model after -
trunk/src/wp-includes/js/media/models/query.js
r31373 r31385 1 /*globals jQuery, _, wp */2 3 1 /** 4 2 * wp.media.model.Query -
trunk/src/wp-includes/js/media/models/selection.js
r31373 r31385 1 /*globals _ */2 3 1 /** 4 2 * wp.media.model.Selection -
trunk/src/wp-includes/js/media/routers/manage.js
r31373 r31385 1 /*globals jQuery, Backbone */2 3 1 /** 4 2 * A router for handling the browser history and application state. -
trunk/src/wp-includes/js/media/utils/selection-sync.js
r31373 r31385 1 /*globals _ */2 3 1 /** 4 2 * wp.media.selectionSync -
trunk/src/wp-includes/js/media/views.js
r31380 r31385 1 1 (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){ 2 /*globals _, wp */3 4 2 /** 5 3 * wp.media.controller.CollectionAdd … … 101 99 102 100 module.exports = CollectionAdd; 101 103 102 },{"./library.js":10}],2:[function(require,module,exports){ 104 /*globals wp, jQuery, Backbone */105 106 103 /** 107 104 * wp.media.controller.CollectionEdit … … 264 261 265 262 module.exports = CollectionEdit; 263 266 264 },{"../views/attachment/edit-library.js":25,"../views/view.js":71,"./library.js":10}],3:[function(require,module,exports){ 267 /*globals _, wp, Backbone */268 269 265 /** 270 266 * wp.media.controller.Cropper … … 342 338 this.$el.text(l10n.cropping); 343 339 this.$el.attr('disabled', true); 344 340 345 341 controller.state().doCrop( selection ).done( function( croppedImage ) { 346 342 controller.trigger('cropped', croppedImage ); … … 384 380 385 381 module.exports = Cropper; 382 386 383 },{"../views/cropper.js":34,"../views/toolbar.js":63,"./state.js":15}],4:[function(require,module,exports){ 387 /*globals _, wp */388 389 384 /** 390 385 * wp.media.controller.EditImage … … 463 458 464 459 module.exports = EditImage; 460 465 461 },{"../views/toolbar.js":63,"./state.js":15}],5:[function(require,module,exports){ 466 /*globals _, wp, jQuery, Backbone */467 468 462 /** 469 463 * wp.media.controller.Embed … … 601 595 602 596 module.exports = Embed; 597 603 598 },{"./state.js":15}],6:[function(require,module,exports){ 604 /*globals _, wp */605 606 599 /** 607 600 * wp.media.controller.FeaturedImage … … 724 717 725 718 module.exports = FeaturedImage; 719 726 720 },{"./library.js":10}],7:[function(require,module,exports){ 727 /*globals _, wp */728 729 721 /** 730 722 * A state for selecting more images to add to a gallery. … … 778 770 initialize: function() { 779 771 // If a library wasn't supplied, create a library of images. 780 if ( ! this.get('library') ) 772 if ( ! this.get('library') ) { 781 773 this.set( 'library', wp.media.query({ type: 'image' }) ); 774 } 782 775 783 776 Library.prototype.initialize.apply( this, arguments ); … … 791 784 edit = this.frame.state('gallery-edit').get('library'); 792 785 793 if ( this.editLibrary && this.editLibrary !== edit ) 786 if ( this.editLibrary && this.editLibrary !== edit ) { 794 787 library.unobserve( this.editLibrary ); 788 } 795 789 796 790 // Accepts attachments that exist in the original library and … … 812 806 813 807 module.exports = GalleryAdd; 808 814 809 },{"./library.js":10}],8:[function(require,module,exports){ 815 /*globals wp, Backbone */816 817 810 /** 818 811 * wp.media.controller.GalleryEdit … … 876 869 initialize: function() { 877 870 // If we haven't been provided a `library`, create a `Selection`. 878 if ( ! this.get('library') ) 871 if ( ! this.get('library') ) { 879 872 this.set( 'library', new wp.media.model.Selection() ); 873 } 880 874 881 875 // The single `Attachment` view to be used in the `Attachments` view. 882 if ( ! this.get('AttachmentView') ) 876 if ( ! this.get('AttachmentView') ) { 883 877 this.set( 'AttachmentView', EditLibraryView ); 878 } 879 884 880 Library.prototype.initialize.apply( this, arguments ); 885 881 }, … … 952 948 953 949 module.exports = GalleryEdit; 950 954 951 },{"../views/attachment/edit-library.js":25,"../views/settings/gallery.js":59,"./library.js":10}],9:[function(require,module,exports){ 955 /*globals _, wp */956 957 952 /** 958 953 * wp.media.controller.ImageDetails … … 1015 1010 1016 1011 module.exports = ImageDetails; 1012 1017 1013 },{"./library.js":10,"./state.js":15}],10:[function(require,module,exports){ 1018 /*globals _, wp, Backbone, getUserSetting, setUserSetting */1019 1020 1014 /** 1021 1015 * wp.media.controller.Library … … 1055 1049 State = require( './state.js' ), 1056 1050 l10n = wp.media.view.l10n, 1051 getUserSetting = window.getUserSetting, 1052 setUserSetting = window.setUserSetting, 1057 1053 Library; 1058 1054 … … 1089 1085 } 1090 1086 1091 if ( ! ( selection instanceof Selection) ) {1087 if ( ! ( selection instanceof wp.media.model.Selection ) ) { 1092 1088 props = selection; 1093 1089 … … 1288 1284 1289 1285 module.exports = Library; 1286 1290 1287 },{"../utils/selection-sync.js":16,"./state.js":15}],11:[function(require,module,exports){ 1291 /*globals _, wp */1292 1293 1288 /** 1294 1289 * wp.media.controller.MediaLibrary … … 1339 1334 1340 1335 module.exports = MediaLibrary; 1336 1341 1337 },{"./library.js":10}],12:[function(require,module,exports){ 1342 /*globals _, Backbone */1343 1344 1338 /** 1345 1339 * wp.media.controller.Region … … 1519 1513 1520 1514 module.exports = Region; 1515 1521 1516 },{}],13:[function(require,module,exports){ 1522 /*globals _, wp */1523 1524 1517 /** 1525 1518 * wp.media.controller.ReplaceImage … … 1628 1621 1629 1622 module.exports = ReplaceImage; 1623 1630 1624 },{"./library.js":10}],14:[function(require,module,exports){ 1631 /*globals _, Backbone */1632 1633 1625 /** 1634 1626 * wp.media.controller.StateMachine … … 1753 1745 1754 1746 module.exports = StateMachine; 1747 1755 1748 },{}],15:[function(require,module,exports){ 1756 /*globals _, Backbone */1757 1758 1749 /** 1759 1750 * wp.media.controller.State … … 1995 1986 1996 1987 module.exports = State; 1988 1997 1989 },{}],16:[function(require,module,exports){ 1998 /*globals _ */1999 2000 1990 /** 2001 1991 * wp.media.selectionSync … … 2062 2052 2063 2053 module.exports = selectionSync; 2054 2064 2055 },{}],17:[function(require,module,exports){ 2065 /* global _wpMediaViewsL10n, confirm, getUserSetting, setUserSetting */ 2066 ( function( $, _ ) { 2067 var l10n, 2068 media = wp.media; 2069 2070 media.isTouchDevice = ( 'ontouchend' in document ); 2071 2072 // Link any localized strings. 2073 l10n = media.view.l10n = typeof _wpMediaViewsL10n === 'undefined' ? {} : _wpMediaViewsL10n; 2074 2075 // Link any settings. 2076 media.view.settings = l10n.settings || {}; 2077 delete l10n.settings; 2078 2079 // Copy the `post` setting over to the model settings. 2080 media.model.settings.post = media.view.settings.post; 2081 2082 // Check if the browser supports CSS 3.0 transitions 2083 $.support.transition = (function(){ 2084 var style = document.documentElement.style, 2085 transitions = { 2086 WebkitTransition: 'webkitTransitionEnd', 2087 MozTransition: 'transitionend', 2088 OTransition: 'oTransitionEnd otransitionend', 2089 transition: 'transitionend' 2090 }, transition; 2091 2092 transition = _.find( _.keys( transitions ), function( transition ) { 2093 return ! _.isUndefined( style[ transition ] ); 2094 }); 2095 2096 return transition && { 2097 end: transitions[ transition ] 2098 }; 2099 }()); 2100 2101 /** 2102 * A shared event bus used to provide events into 2103 * the media workflows that 3rd-party devs can use to hook 2104 * in. 2105 */ 2106 media.events = _.extend( {}, Backbone.Events ); 2107 2108 /** 2109 * Makes it easier to bind events using transitions. 2110 * 2111 * @param {string} selector 2112 * @param {Number} sensitivity 2113 * @returns {Promise} 2114 */ 2115 media.transition = function( selector, sensitivity ) { 2116 var deferred = $.Deferred(); 2117 2118 sensitivity = sensitivity || 2000; 2119 2120 if ( $.support.transition ) { 2121 if ( ! (selector instanceof $) ) { 2122 selector = $( selector ); 2123 } 2124 2125 // Resolve the deferred when the first element finishes animating. 2126 selector.first().one( $.support.transition.end, deferred.resolve ); 2127 2128 // Just in case the event doesn't trigger, fire a callback. 2129 _.delay( deferred.resolve, sensitivity ); 2130 2131 // Otherwise, execute on the spot. 2132 } else { 2133 deferred.resolve(); 2134 } 2135 2136 return deferred.promise(); 2056 var media = wp.media, 2057 $ = jQuery, 2058 l10n; 2059 2060 media.isTouchDevice = ( 'ontouchend' in document ); 2061 2062 // Link any localized strings. 2063 l10n = media.view.l10n = window._wpMediaViewsL10n || {}; 2064 2065 // Link any settings. 2066 media.view.settings = l10n.settings || {}; 2067 delete l10n.settings; 2068 2069 // Copy the `post` setting over to the model settings. 2070 media.model.settings.post = media.view.settings.post; 2071 2072 // Check if the browser supports CSS 3.0 transitions 2073 $.support.transition = (function(){ 2074 var style = document.documentElement.style, 2075 transitions = { 2076 WebkitTransition: 'webkitTransitionEnd', 2077 MozTransition: 'transitionend', 2078 OTransition: 'oTransitionEnd otransitionend', 2079 transition: 'transitionend' 2080 }, transition; 2081 2082 transition = _.find( _.keys( transitions ), function( transition ) { 2083 return ! _.isUndefined( style[ transition ] ); 2084 }); 2085 2086 return transition && { 2087 end: transitions[ transition ] 2137 2088 }; 2138 2139 media.controller.Region = require( './controllers/region.js' ); 2140 media.controller.StateMachine = require( './controllers/state-machine.js' ); 2141 media.controller.State = require( './controllers/state.js' ); 2142 2143 media.selectionSync = require( './utils/selection-sync.js' ); 2144 media.controller.Library = require( './controllers/library.js' ); 2145 media.controller.ImageDetails = require( './controllers/image-details.js' ); 2146 media.controller.GalleryEdit = require( './controllers/gallery-edit.js' ); 2147 media.controller.GalleryAdd = require( './controllers/gallery-add.js' ); 2148 media.controller.CollectionEdit = require( './controllers/collection-edit.js' ); 2149 media.controller.CollectionAdd = require( './controllers/collection-add.js' ); 2150 media.controller.FeaturedImage = require( './controllers/featured-image.js' ); 2151 media.controller.ReplaceImage = require( './controllers/replace-image.js' ); 2152 media.controller.EditImage = require( './controllers/edit-image.js' ); 2153 media.controller.MediaLibrary = require( './controllers/media-library.js' ); 2154 media.controller.Embed = require( './controllers/embed.js' ); 2155 media.controller.Cropper = require( './controllers/cropper.js' ); 2156 2157 media.View = require( './views/view.js' ); 2158 media.view.Frame = require( './views/view.js' ); 2159 media.view.MediaFrame = require( './views/media-frame.js' ); 2160 media.view.MediaFrame.Select = require( './views/frame/select.js' ); 2161 media.view.MediaFrame.Post = require( './views/frame/post.js' ); 2162 media.view.MediaFrame.ImageDetails = require( './views/frame/image-details.js' ); 2163 media.view.Modal = require( './views/modal.js' ); 2164 media.view.FocusManager = require( './views/focus-manager.js' ); 2165 media.view.UploaderWindow = require( './views/uploader/window.js' ); 2166 media.view.EditorUploader = require( './views/uploader/editor.js' ); 2167 media.view.UploaderInline = require( './views/uploader/inline.js' ); 2168 media.view.UploaderStatus = require( './views/uploader/status.js' ); 2169 media.view.UploaderStatusError = require( './views/uploader/status-error.js' ); 2170 media.view.Toolbar = require( './views/toolbar.js' ); 2171 media.view.Toolbar.Select = require( './views/toolbar/select.js' ); 2172 media.view.Toolbar.Embed = require( './views/toolbar/embed.js' ); 2173 media.view.Button = require( './views/button.js' ); 2174 media.view.ButtonGroup = require( './views/button-group.js' ); 2175 media.view.PriorityList = require( './views/priority-list.js' ); 2176 media.view.MenuItem = require( './views/menu-item.js' ); 2177 media.view.Menu = require( './views/menu.js' ); 2178 media.view.RouterItem = require( './views/router-item.js' ); 2179 media.view.Router = require( './views/router.js' ); 2180 media.view.Sidebar = require( './views/sidebar.js' ); 2181 media.view.Attachment = require( './views/attachment.js' ); 2182 media.view.Attachment.Library = require( './views/attachment/library.js' ); 2183 media.view.Attachment.EditLibrary = require( './views/attachment/edit-library.js' ); 2184 media.view.Attachments = require( './views/attachments.js' ); 2185 media.view.Search = require( './views/search.js' ); 2186 media.view.AttachmentFilters = require( './views/attachment-filters.js' ); 2187 media.view.DateFilter = require( './views/attachment-filters/date.js' ); 2188 media.view.AttachmentFilters.Uploaded = require( './views/attachment-filters/uploaded.js' ); 2189 media.view.AttachmentFilters.All = require( './views/attachment-filters/all.js' ); 2190 media.view.AttachmentsBrowser = require( './views/attachments/browser.js' ); 2191 media.view.Selection = require( './views/selection.js' ); 2192 media.view.Attachment.Selection = require( './views/attachment/selection.js' ); 2193 media.view.Attachments.Selection = require( './views/attachments/selection.js' ); 2194 media.view.Attachment.EditSelection = require( './views/attachment/edit-selection.js' ); 2195 media.view.Settings = require( './views/settings.js' ); 2196 media.view.Settings.AttachmentDisplay = require( './views/settings/attachment-display.js' ); 2197 media.view.Settings.Gallery = require( './views/settings/gallery.js' ); 2198 media.view.Settings.Playlist = require( './views/settings/playlist.js' ); 2199 media.view.Attachment.Details = require( './views/attachment/details.js' ); 2200 media.view.AttachmentCompat = require( './views/attachment-compat.js' ); 2201 media.view.Iframe = require( './views/iframe.js' ); 2202 media.view.Embed = require( './views/embed.js' ); 2203 media.view.Label = require( './views/label.js' ); 2204 media.view.EmbedUrl = require( './views/embed/url.js' ); 2205 media.view.EmbedLink = require( './views/embed/link.js' ); 2206 media.view.EmbedImage = require( './views/embed/image.js' ); 2207 media.view.ImageDetails = require( './views/image-details.js' ); 2208 media.view.Cropper = require( './views/cropper.js' ); 2209 media.view.EditImage = require( './views/edit-image.js' ); 2210 media.view.Spinner = require( './views/spinner.js' ); 2211 2212 }(jQuery, _)); 2089 }()); 2090 2091 /** 2092 * A shared event bus used to provide events into 2093 * the media workflows that 3rd-party devs can use to hook 2094 * in. 2095 */ 2096 media.events = _.extend( {}, Backbone.Events ); 2097 2098 /** 2099 * Makes it easier to bind events using transitions. 2100 * 2101 * @param {string} selector 2102 * @param {Number} sensitivity 2103 * @returns {Promise} 2104 */ 2105 media.transition = function( selector, sensitivity ) { 2106 var deferred = $.Deferred(); 2107 2108 sensitivity = sensitivity || 2000; 2109 2110 if ( $.support.transition ) { 2111 if ( ! (selector instanceof $) ) { 2112 selector = $( selector ); 2113 } 2114 2115 // Resolve the deferred when the first element finishes animating. 2116 selector.first().one( $.support.transition.end, deferred.resolve ); 2117 2118 // Just in case the event doesn't trigger, fire a callback. 2119 _.delay( deferred.resolve, sensitivity ); 2120 2121 // Otherwise, execute on the spot. 2122 } else { 2123 deferred.resolve(); 2124 } 2125 2126 return deferred.promise(); 2127 }; 2128 2129 media.controller.Region = require( './controllers/region.js' ); 2130 media.controller.StateMachine = require( './controllers/state-machine.js' ); 2131 media.controller.State = require( './controllers/state.js' ); 2132 2133 media.selectionSync = require( './utils/selection-sync.js' ); 2134 media.controller.Library = require( './controllers/library.js' ); 2135 media.controller.ImageDetails = require( './controllers/image-details.js' ); 2136 media.controller.GalleryEdit = require( './controllers/gallery-edit.js' ); 2137 media.controller.GalleryAdd = require( './controllers/gallery-add.js' ); 2138 media.controller.CollectionEdit = require( './controllers/collection-edit.js' ); 2139 media.controller.CollectionAdd = require( './controllers/collection-add.js' ); 2140 media.controller.FeaturedImage = require( './controllers/featured-image.js' ); 2141 media.controller.ReplaceImage = require( './controllers/replace-image.js' ); 2142 media.controller.EditImage = require( './controllers/edit-image.js' ); 2143 media.controller.MediaLibrary = require( './controllers/media-library.js' ); 2144 media.controller.Embed = require( './controllers/embed.js' ); 2145 media.controller.Cropper = require( './controllers/cropper.js' ); 2146 2147 media.View = require( './views/view.js' ); 2148 media.view.Frame = require( './views/view.js' ); 2149 media.view.MediaFrame = require( './views/media-frame.js' ); 2150 media.view.MediaFrame.Select = require( './views/frame/select.js' ); 2151 media.view.MediaFrame.Post = require( './views/frame/post.js' ); 2152 media.view.MediaFrame.ImageDetails = require( './views/frame/image-details.js' ); 2153 media.view.Modal = require( './views/modal.js' ); 2154 media.view.FocusManager = require( './views/focus-manager.js' ); 2155 media.view.UploaderWindow = require( './views/uploader/window.js' ); 2156 media.view.EditorUploader = require( './views/uploader/editor.js' ); 2157 media.view.UploaderInline = require( './views/uploader/inline.js' ); 2158 media.view.UploaderStatus = require( './views/uploader/status.js' ); 2159 media.view.UploaderStatusError = require( './views/uploader/status-error.js' ); 2160 media.view.Toolbar = require( './views/toolbar.js' ); 2161 media.view.Toolbar.Select = require( './views/toolbar/select.js' ); 2162 media.view.Toolbar.Embed = require( './views/toolbar/embed.js' ); 2163 media.view.Button = require( './views/button.js' ); 2164 media.view.ButtonGroup = require( './views/button-group.js' ); 2165 media.view.PriorityList = require( './views/priority-list.js' ); 2166 media.view.MenuItem = require( './views/menu-item.js' ); 2167 media.view.Menu = require( './views/menu.js' ); 2168 media.view.RouterItem = require( './views/router-item.js' ); 2169 media.view.Router = require( './views/router.js' ); 2170 media.view.Sidebar = require( './views/sidebar.js' ); 2171 media.view.Attachment = require( './views/attachment.js' ); 2172 media.view.Attachment.Library = require( './views/attachment/library.js' ); 2173 media.view.Attachment.EditLibrary = require( './views/attachment/edit-library.js' ); 2174 media.view.Attachments = require( './views/attachments.js' ); 2175 media.view.Search = require( './views/search.js' ); 2176 media.view.AttachmentFilters = require( './views/attachment-filters.js' ); 2177 media.view.DateFilter = require( './views/attachment-filters/date.js' ); 2178 media.view.AttachmentFilters.Uploaded = require( './views/attachment-filters/uploaded.js' ); 2179 media.view.AttachmentFilters.All = require( './views/attachment-filters/all.js' ); 2180 media.view.AttachmentsBrowser = require( './views/attachments/browser.js' ); 2181 media.view.Selection = require( './views/selection.js' ); 2182 media.view.Attachment.Selection = require( './views/attachment/selection.js' ); 2183 media.view.Attachments.Selection = require( './views/attachments/selection.js' ); 2184 media.view.Attachment.EditSelection = require( './views/attachment/edit-selection.js' ); 2185 media.view.Settings = require( './views/settings.js' ); 2186 media.view.Settings.AttachmentDisplay = require( './views/settings/attachment-display.js' ); 2187 media.view.Settings.Gallery = require( './views/settings/gallery.js' ); 2188 media.view.Settings.Playlist = require( './views/settings/playlist.js' ); 2189 media.view.Attachment.Details = require( './views/attachment/details.js' ); 2190 media.view.AttachmentCompat = require( './views/attachment-compat.js' ); 2191 media.view.Iframe = require( './views/iframe.js' ); 2192 media.view.Embed = require( './views/embed.js' ); 2193 media.view.Label = require( './views/label.js' ); 2194 media.view.EmbedUrl = require( './views/embed/url.js' ); 2195 media.view.EmbedLink = require( './views/embed/link.js' ); 2196 media.view.EmbedImage = require( './views/embed/image.js' ); 2197 media.view.ImageDetails = require( './views/image-details.js' ); 2198 media.view.Cropper = require( './views/cropper.js' ); 2199 media.view.EditImage = require( './views/edit-image.js' ); 2200 media.view.Spinner = require( './views/spinner.js' ); 2201 2213 2202 },{"./controllers/collection-add.js":1,"./controllers/collection-edit.js":2,"./controllers/cropper.js":3,"./controllers/edit-image.js":4,"./controllers/embed.js":5,"./controllers/featured-image.js":6,"./controllers/gallery-add.js":7,"./controllers/gallery-edit.js":8,"./controllers/image-details.js":9,"./controllers/library.js":10,"./controllers/media-library.js":11,"./controllers/region.js":12,"./controllers/replace-image.js":13,"./controllers/state-machine.js":14,"./controllers/state.js":15,"./utils/selection-sync.js":16,"./views/attachment-compat.js":18,"./views/attachment-filters.js":19,"./views/attachment-filters/all.js":20,"./views/attachment-filters/date.js":21,"./views/attachment-filters/uploaded.js":22,"./views/attachment.js":23,"./views/attachment/details.js":24,"./views/attachment/edit-library.js":25,"./views/attachment/edit-selection.js":26,"./views/attachment/library.js":27,"./views/attachment/selection.js":28,"./views/attachments.js":29,"./views/attachments/browser.js":30,"./views/attachments/selection.js":31,"./views/button-group.js":32,"./views/button.js":33,"./views/cropper.js":34,"./views/edit-image.js":35,"./views/embed.js":36,"./views/embed/image.js":37,"./views/embed/link.js":38,"./views/embed/url.js":39,"./views/focus-manager.js":40,"./views/frame/image-details.js":42,"./views/frame/post.js":43,"./views/frame/select.js":44,"./views/iframe.js":45,"./views/image-details.js":46,"./views/label.js":47,"./views/media-frame.js":48,"./views/menu-item.js":49,"./views/menu.js":50,"./views/modal.js":51,"./views/priority-list.js":52,"./views/router-item.js":53,"./views/router.js":54,"./views/search.js":55,"./views/selection.js":56,"./views/settings.js":57,"./views/settings/attachment-display.js":58,"./views/settings/gallery.js":59,"./views/settings/playlist.js":60,"./views/sidebar.js":61,"./views/spinner.js":62,"./views/toolbar.js":63,"./views/toolbar/embed.js":64,"./views/toolbar/select.js":65,"./views/uploader/editor.js":66,"./views/uploader/inline.js":67,"./views/uploader/status-error.js":68,"./views/uploader/status.js":69,"./views/uploader/window.js":70,"./views/view.js":71}],18:[function(require,module,exports){ 2214 /*globals _ */2215 2216 2203 /** 2217 2204 * wp.media.view.AttachmentCompat … … 2297 2284 2298 2285 module.exports = AttachmentCompat; 2286 2299 2287 },{"./view.js":71}],19:[function(require,module,exports){ 2300 /*globals _, jQuery */2301 2302 2288 /** 2303 2289 * wp.media.view.AttachmentFilters … … 2376 2362 2377 2363 module.exports = AttachmentFilters; 2364 2378 2365 },{"./view.js":71}],20:[function(require,module,exports){ 2379 /*globals _, wp */2380 2381 2366 /** 2382 2367 * wp.media.view.AttachmentFilters.All … … 2468 2453 2469 2454 module.exports = All; 2455 2470 2456 },{"../attachment-filters.js":19}],21:[function(require,module,exports){ 2471 /*globals _, wp */2472 2473 2457 /** 2474 2458 * A filter dropdown for month/dates. … … 2511 2495 2512 2496 module.exports = DateFilter; 2497 2513 2498 },{"../attachment-filters.js":19}],22:[function(require,module,exports){ 2514 /*globals wp */2515 2516 2499 /** 2517 2500 * wp.media.view.AttachmentFilters.Uploaded … … 2572 2555 2573 2556 module.exports = Uploaded; 2557 2574 2558 },{"../attachment-filters.js":19}],23:[function(require,module,exports){ 2575 /*globals _, wp, jQuery */2576 2577 2559 /** 2578 2560 * wp.media.view.Attachment … … 3127 3109 3128 3110 module.exports = Attachment; 3111 3129 3112 },{"./view.js":71}],24:[function(require,module,exports){ 3130 /*globals _, wp */3131 3132 3113 /** 3133 3114 * wp.media.view.Attachment.Details … … 3189 3170 event.preventDefault(); 3190 3171 3191 if ( confirm( l10n.warnDelete ) ) {3172 if ( window.confirm( l10n.warnDelete ) ) { 3192 3173 this.model.destroy(); 3193 3174 // Keep focus inside media modal … … 3268 3249 3269 3250 module.exports = Details; 3251 3270 3252 },{"../attachment.js":23}],25:[function(require,module,exports){ 3271 3253 /** … … 3288 3270 3289 3271 module.exports = EditLibrary; 3272 3290 3273 },{"../attachment.js":23}],26:[function(require,module,exports){ 3291 3274 /** … … 3309 3292 3310 3293 module.exports = EditSelection; 3294 3311 3295 },{"./selection.js":28}],27:[function(require,module,exports){ 3312 3296 /** … … 3329 3313 3330 3314 module.exports = Library; 3315 3331 3316 },{"../attachment.js":23}],28:[function(require,module,exports){ 3332 3317 /** … … 3353 3338 3354 3339 module.exports = Selection; 3340 3355 3341 },{"../attachment.js":23}],29:[function(require,module,exports){ 3356 /*globals _, wp, jQuery */3357 3358 3342 /** 3359 3343 * wp.media.view.Attachments … … 3628 3612 // The scroll event occurs on the document, but the element 3629 3613 // that should be checked is the document body. 3630 if ( el == document ) {3614 if ( el === document ) { 3631 3615 el = document.body; 3632 3616 scrollTop = $(document).scrollTop(); … … 3654 3638 3655 3639 module.exports = Attachments; 3640 3656 3641 },{"./attachment.js":23,"./view.js":71}],30:[function(require,module,exports){ 3657 /*globals _, wp, jQuery */3658 3659 3642 /** 3660 3643 * wp.media.view.AttachmentsBrowser … … 3847 3830 } 3848 3831 3849 if ( ! mediaTrash && ! confirm( l10n.warnBulkDelete ) ) {3832 if ( ! mediaTrash && ! window.confirm( l10n.warnBulkDelete ) ) { 3850 3833 return; 3851 3834 } … … 3853 3836 if ( mediaTrash && 3854 3837 'trash' !== selection.at( 0 ).get( 'status' ) && 3855 ! confirm( l10n.warnBulkTrash ) ) {3838 ! window.confirm( l10n.warnBulkTrash ) ) { 3856 3839 3857 3840 return; … … 3901 3884 var removed = [], selection = this.controller.state().get( 'selection' ); 3902 3885 3903 if ( ! selection.length || ! confirm( l10n.warnBulkDelete ) ) {3886 if ( ! selection.length || ! window.confirm( l10n.warnBulkDelete ) ) { 3904 3887 return; 3905 3888 } … … 4114 4097 4115 4098 module.exports = AttachmentsBrowser; 4099 4116 4100 },{"../attachment-compat.js":18,"../attachment-filters/all.js":20,"../attachment-filters/date.js":21,"../attachment-filters/uploaded.js":22,"../attachment/details.js":24,"../attachment/library.js":27,"../attachments.js":29,"../label.js":47,"../search.js":55,"../settings/attachment-display.js":58,"../sidebar.js":61,"../spinner.js":62,"../toolbar.js":63,"../uploader/inline.js":67,"../uploader/status.js":69,"../view.js":71}],31:[function(require,module,exports){ 4117 /*globals _ */4118 4119 4101 /** 4120 4102 * wp.media.view.Attachments.Selection … … 4146 4128 4147 4129 module.exports = Selection; 4130 4148 4131 },{"../attachment/selection.js":28,"../attachments.js":29}],32:[function(require,module,exports){ 4149 /*globals _, Backbone, jQuery */4150 4151 4132 /** 4152 4133 * wp.media.view.ButtonGroup … … 4195 4176 4196 4177 module.exports = ButtonGroup; 4178 4197 4179 },{"./button.js":33,"./view.js":71}],33:[function(require,module,exports){ 4198 /*globals _, Backbone */4199 4200 4180 /** 4201 4181 * wp.media.view.Button … … 4285 4265 4286 4266 module.exports = Button; 4267 4287 4268 },{"./view.js":71}],34:[function(require,module,exports){ 4288 /*globals _, wp, jQuery */4289 4290 4269 /** 4291 4270 * wp.media.view.Cropper … … 4348 4327 this.views.add( '.upload-errors', new UploaderStatusError({ 4349 4328 filename: UploaderStatus.prototype.filename(filename), 4350 message: _wpMediaViewsL10n.cropError4329 message: window._wpMediaViewsL10n.cropError 4351 4330 }), { at: 0 }); 4352 4331 } … … 4354 4333 4355 4334 module.exports = Cropper; 4335 4356 4336 },{"./uploader/status-error.js":68,"./uploader/status.js":69,"./view.js":71}],35:[function(require,module,exports){ 4357 /*globals _, wp */4358 4359 4337 var View = require( './view.js' ), 4360 4338 EditImage; … … 4408 4386 4409 4387 module.exports = EditImage; 4388 4410 4389 },{"./view.js":71}],36:[function(require,module,exports){ 4411 4390 /** … … 4477 4456 4478 4457 module.exports = Embed; 4458 4479 4459 },{"./embed/image.js":37,"./embed/link.js":38,"./embed/url.js":39,"./view.js":71}],37:[function(require,module,exports){ 4480 /*globals wp */4481 4482 4460 /** 4483 4461 * wp.media.view.EmbedImage … … 4511 4489 4512 4490 module.exports = EmbedImage; 4491 4513 4492 },{"../settings/attachment-display.js":58}],38:[function(require,module,exports){ 4514 /*globals _, wp, jQuery */4515 4516 4493 /** 4517 4494 * wp.media.view.EmbedLink … … 4579 4556 4580 4557 module.exports = EmbedLink; 4558 4581 4559 },{"../settings.js":57}],39:[function(require,module,exports){ 4582 /*globals _, wp, jQuery */4583 4584 4560 /** 4585 4561 * wp.media.view.EmbedUrl … … 4659 4635 4660 4636 module.exports = EmbedUrl; 4637 4661 4638 },{"../view.js":71}],40:[function(require,module,exports){ 4662 4639 /** … … 4707 4684 4708 4685 module.exports = FocusManager; 4686 4709 4687 },{"./view.js":71}],41:[function(require,module,exports){ 4710 /*globals _, Backbone */4711 4712 4688 /** 4713 4689 * wp.media.view.Frame … … 4880 4856 4881 4857 module.exports = Frame; 4858 4882 4859 },{"../controllers/region.js":12,"../controllers/state-machine.js":14,"../controllers/state.js":15,"./view.js":71}],42:[function(require,module,exports){ 4883 /*globals wp */4884 4885 4860 /** 4886 4861 * wp.media.view.MediaFrame.ImageDetails … … 5064 5039 5065 5040 module.exports = ImageDetails; 5041 5066 5042 },{"../../controllers/edit-image.js":4,"../../controllers/image-details.js":9,"../../controllers/replace-image.js":13,"../edit-image.js":35,"../image-details.js":46,"../toolbar.js":63,"./select.js":44}],43:[function(require,module,exports){ 5067 /*globals _, wp */5068 5069 5043 /** 5070 5044 * wp.media.view.MediaFrame.Post … … 5816 5790 5817 5791 module.exports = Post; 5792 5818 5793 },{"../../controllers/collection-add.js":1,"../../controllers/collection-edit.js":2,"../../controllers/edit-image.js":4,"../../controllers/embed.js":5,"../../controllers/featured-image.js":6,"../../controllers/gallery-add.js":7,"../../controllers/gallery-edit.js":8,"../../controllers/library.js":10,"../attachment/edit-selection.js":26,"../attachments/browser.js":30,"../edit-image.js":35,"../embed.js":36,"../selection.js":56,"../settings/playlist.js":60,"../toolbar.js":63,"../toolbar/embed.js":64,"../view.js":71,"./select.js":44}],44:[function(require,module,exports){ 5819 /*globals _, wp */5820 5821 5794 /** 5822 5795 * wp.media.view.MediaFrame.Select … … 5991 5964 5992 5965 module.exports = Select; 5966 5993 5967 },{"../../controllers/library.js":10,"../attachments/browser.js":30,"../media-frame.js":48,"../toolbar/select.js":65,"../uploader/inline.js":67}],45:[function(require,module,exports){ 5994 5968 /** … … 6017 5991 6018 5992 module.exports = Iframe; 5993 6019 5994 },{"./view.js":71}],46:[function(require,module,exports){ 6020 /*globals _, wp, jQuery */6021 6022 5995 /** 6023 5996 * wp.media.view.ImageDetails … … 6093 6066 setTimeout( _.bind( this.resetFocus, this ), 10 ); 6094 6067 this.toggleLinkSettings(); 6095 if ( getUserSetting( 'advImgDetails' ) === 'show' ) {6068 if ( window.getUserSetting( 'advImgDetails' ) === 'show' ) { 6096 6069 this.toggleAdvanced( true ); 6097 6070 } … … 6166 6139 } 6167 6140 6168 setUserSetting( 'advImgDetails', mode );6141 window.setUserSetting( 'advImgDetails', mode ); 6169 6142 }, 6170 6143 … … 6186 6159 6187 6160 module.exports = AttachmentDisplay; 6161 6188 6162 },{"./settings/attachment-display.js":58}],47:[function(require,module,exports){ 6189 6163 /** … … 6212 6186 6213 6187 module.exports = Label; 6188 6214 6189 },{"./view.js":71}],48:[function(require,module,exports){ 6215 /*globals _, wp, jQuery */6216 6217 6190 /** 6218 6191 * wp.media.view.MediaFrame … … 6467 6440 6468 6441 module.exports = MediaFrame; 6442 6469 6443 },{"./frame.js":41,"./iframe.js":45,"./menu.js":50,"./modal.js":51,"./router.js":54,"./toolbar.js":63,"./uploader/window.js":70,"./view.js":71}],49:[function(require,module,exports){ 6470 /*globals wp, jQuery */6471 6472 6444 /** 6473 6445 * wp.media.view.MenuItem … … 6541 6513 6542 6514 module.exports = MenuItem; 6515 6543 6516 },{"./view.js":71}],50:[function(require,module,exports){ 6544 6517 /** … … 6657 6630 6658 6631 module.exports = Menu; 6632 6659 6633 },{"./menu-item.js":49,"./priority-list.js":52}],51:[function(require,module,exports){ 6660 /*globals _, wp, jQuery */6661 6662 6634 /** 6663 6635 * wp.media.view.Modal … … 6873 6845 6874 6846 module.exports = Modal; 6847 6875 6848 },{"./focus-manager.js":40,"./view.js":71}],52:[function(require,module,exports){ 6876 /*globals _, Backbone */6877 6878 6849 /** 6879 6850 * wp.media.view.PriorityList … … 6974 6945 6975 6946 module.exports = PriorityList; 6947 6976 6948 },{"./view.js":71}],53:[function(require,module,exports){ 6977 6949 /** … … 7000 6972 7001 6973 module.exports = RouterItem; 6974 7002 6975 },{"./menu-item.js":49}],54:[function(require,module,exports){ 7003 6976 /** … … 7037 7010 7038 7011 module.exports = Router; 7012 7039 7013 },{"./menu.js":50,"./router-item.js":53}],55:[function(require,module,exports){ 7040 /*globals wp */7041 7042 7014 /** 7043 7015 * wp.media.view.Search … … 7087 7059 7088 7060 module.exports = Search; 7061 7089 7062 },{"./view.js":71}],56:[function(require,module,exports){ 7090 /*globals _, Backbone, wp */7091 7092 7063 /** 7093 7064 * wp.media.view.Selection … … 7173 7144 7174 7145 module.exports = Selection; 7146 7175 7147 },{"./attachments/selection.js":31,"./view.js":71}],57:[function(require,module,exports){ 7176 /*globals _, Backbone, jQuery */7177 7178 7148 /** 7179 7149 * wp.media.view.Settings … … 7283 7253 // update that as well. 7284 7254 if ( userSetting = $setting.data('userSetting') ) { 7285 setUserSetting( userSetting, value );7255 window.setUserSetting( userSetting, value ); 7286 7256 } 7287 7257 }, … … 7295 7265 7296 7266 module.exports = Settings; 7267 7297 7268 },{"./view.js":71}],58:[function(require,module,exports){ 7298 /*globals _, wp */7299 7300 7269 /** 7301 7270 * wp.media.view.Settings.AttachmentDisplay … … 7390 7359 7391 7360 module.exports = AttachmentDisplay; 7361 7392 7362 },{"../settings.js":57}],59:[function(require,module,exports){ 7393 /*globals wp */7394 7395 7363 /** 7396 7364 * wp.media.view.Settings.Gallery … … 7411 7379 7412 7380 module.exports = Gallery; 7381 7413 7382 },{"../settings.js":57}],60:[function(require,module,exports){ 7414 /*globals wp */7415 7416 7383 /** 7417 7384 * wp.media.view.Settings.Playlist … … 7432 7399 7433 7400 module.exports = Playlist; 7401 7434 7402 },{"../settings.js":57}],61:[function(require,module,exports){ 7435 7403 /** … … 7450 7418 7451 7419 module.exports = Sidebar; 7420 7452 7421 },{"./priority-list.js":52}],62:[function(require,module,exports){ 7453 /*globals _, wp */7454 7455 7422 /** 7456 7423 * wp.media.view.Spinner … … 7489 7456 7490 7457 module.exports = Spinner; 7458 7491 7459 },{"./view.js":71}],63:[function(require,module,exports){ 7492 /*globals Backbone, _ */7493 7494 7460 /** 7495 7461 * wp.media.view.Toolbar … … 7652 7618 7653 7619 module.exports = Toolbar; 7620 7654 7621 },{"./button.js":33,"./priority-list.js":52,"./view.js":71}],64:[function(require,module,exports){ 7655 /*globals _, wp */7656 7657 7622 /** 7658 7623 * wp.media.view.Toolbar.Embed … … 7690 7655 7691 7656 module.exports = Embed; 7657 7692 7658 },{"./select.js":65}],65:[function(require,module,exports){ 7693 /*globals _, wp */7694 7695 7659 /** 7696 7660 * wp.media.view.Toolbar.Select … … 7761 7725 7762 7726 module.exports = Select; 7727 7763 7728 },{"../toolbar.js":63}],66:[function(require,module,exports){ 7764 /*globals _, wp, jQuery */7765 7766 7729 /** 7767 7730 * Creates a dropzone on WP editor instances (elements with .wp-editor-wrap … … 7981 7944 7982 7945 module.exports = EditorUploader; 7946 7983 7947 },{"../view.js":71}],67:[function(require,module,exports){ 7984 /*globals _, wp */7985 7986 7948 /** 7987 7949 * wp.media.view.UploaderInline … … 8114 8076 8115 8077 module.exports = UploaderInline; 8078 8116 8079 },{"../view.js":71,"./status.js":69}],68:[function(require,module,exports){ 8117 /*globals wp */8118 8119 8080 /** 8120 8081 * wp.media.view.UploaderStatusError … … 8134 8095 8135 8096 module.exports = UploaderStatusError; 8097 8136 8098 },{"../view.js":71}],69:[function(require,module,exports){ 8137 /*globals _, wp */8138 8139 8099 /** 8140 8100 * wp.media.view.UploaderStatus … … 8274 8234 8275 8235 module.exports = UploaderStatus; 8236 8276 8237 },{"../view.js":71,"./status-error.js":68}],70:[function(require,module,exports){ 8277 /*globals _, wp, jQuery */8278 8279 8238 /** 8280 8239 * wp.media.view.UploaderWindow … … 8387 8346 8388 8347 module.exports = UploaderWindow; 8348 8389 8349 },{"../view.js":71}],71:[function(require,module,exports){ 8390 /*globals wp */8391 8392 8350 /** 8393 8351 * wp.media.View … … 8454 8412 8455 8413 module.exports = View; 8414 8456 8415 },{}]},{},[17]); -
trunk/src/wp-includes/js/media/views.manifest.js
r31373 r31385 1 /* global _wpMediaViewsL10n, confirm, getUserSetting, setUserSetting */ 2 ( function( $, _ ) { 3 var l10n, 4 media = wp.media; 1 var media = wp.media, 2 $ = jQuery, 3 l10n; 5 4 6 5 media.isTouchDevice = ( 'ontouchend' in document ); 7 6 8 9 l10n = media.view.l10n = typeof _wpMediaViewsL10n === 'undefined' ? {} : _wpMediaViewsL10n;7 // Link any localized strings. 8 l10n = media.view.l10n = window._wpMediaViewsL10n || {}; 10 9 11 12 13 10 // Link any settings. 11 media.view.settings = l10n.settings || {}; 12 delete l10n.settings; 14 13 15 16 14 // Copy the `post` setting over to the model settings. 15 media.model.settings.post = media.view.settings.post; 17 16 18 19 20 21 22 23 24 25 26 17 // Check if the browser supports CSS 3.0 transitions 18 $.support.transition = (function(){ 19 var style = document.documentElement.style, 20 transitions = { 21 WebkitTransition: 'webkitTransitionEnd', 22 MozTransition: 'transitionend', 23 OTransition: 'oTransitionEnd otransitionend', 24 transition: 'transitionend' 25 }, transition; 27 26 28 29 30 27 transition = _.find( _.keys( transitions ), function( transition ) { 28 return ! _.isUndefined( style[ transition ] ); 29 }); 31 30 32 33 34 35 31 return transition && { 32 end: transitions[ transition ] 33 }; 34 }()); 36 35 37 38 39 40 41 42 36 /** 37 * A shared event bus used to provide events into 38 * the media workflows that 3rd-party devs can use to hook 39 * in. 40 */ 41 media.events = _.extend( {}, Backbone.Events ); 43 42 44 45 46 47 48 49 50 51 52 43 /** 44 * Makes it easier to bind events using transitions. 45 * 46 * @param {string} selector 47 * @param {Number} sensitivity 48 * @returns {Promise} 49 */ 50 media.transition = function( selector, sensitivity ) { 51 var deferred = $.Deferred(); 53 52 54 53 sensitivity = sensitivity || 2000; 55 54 56 if ( $.support.transition ) { 57 if ( ! (selector instanceof $) ) { 58 selector = $( selector ); 59 } 60 61 // Resolve the deferred when the first element finishes animating. 62 selector.first().one( $.support.transition.end, deferred.resolve ); 63 64 // Just in case the event doesn't trigger, fire a callback. 65 _.delay( deferred.resolve, sensitivity ); 66 67 // Otherwise, execute on the spot. 68 } else { 69 deferred.resolve(); 55 if ( $.support.transition ) { 56 if ( ! (selector instanceof $) ) { 57 selector = $( selector ); 70 58 } 71 59 72 return deferred.promise();73 };60 // Resolve the deferred when the first element finishes animating. 61 selector.first().one( $.support.transition.end, deferred.resolve ); 74 62 75 media.controller.Region = require( './controllers/region.js' ); 76 media.controller.StateMachine = require( './controllers/state-machine.js' ); 77 media.controller.State = require( './controllers/state.js' ); 63 // Just in case the event doesn't trigger, fire a callback. 64 _.delay( deferred.resolve, sensitivity ); 78 65 79 media.selectionSync = require( './utils/selection-sync.js' ); 80 media.controller.Library = require( './controllers/library.js' ); 81 media.controller.ImageDetails = require( './controllers/image-details.js' ); 82 media.controller.GalleryEdit = require( './controllers/gallery-edit.js' ); 83 media.controller.GalleryAdd = require( './controllers/gallery-add.js' ); 84 media.controller.CollectionEdit = require( './controllers/collection-edit.js' ); 85 media.controller.CollectionAdd = require( './controllers/collection-add.js' ); 86 media.controller.FeaturedImage = require( './controllers/featured-image.js' ); 87 media.controller.ReplaceImage = require( './controllers/replace-image.js' ); 88 media.controller.EditImage = require( './controllers/edit-image.js' ); 89 media.controller.MediaLibrary = require( './controllers/media-library.js' ); 90 media.controller.Embed = require( './controllers/embed.js' ); 91 media.controller.Cropper = require( './controllers/cropper.js' ); 66 // Otherwise, execute on the spot. 67 } else { 68 deferred.resolve(); 69 } 92 70 93 media.View = require( './views/view.js' ); 94 media.view.Frame = require( './views/view.js' ); 95 media.view.MediaFrame = require( './views/media-frame.js' ); 96 media.view.MediaFrame.Select = require( './views/frame/select.js' ); 97 media.view.MediaFrame.Post = require( './views/frame/post.js' ); 98 media.view.MediaFrame.ImageDetails = require( './views/frame/image-details.js' ); 99 media.view.Modal = require( './views/modal.js' ); 100 media.view.FocusManager = require( './views/focus-manager.js' ); 101 media.view.UploaderWindow = require( './views/uploader/window.js' ); 102 media.view.EditorUploader = require( './views/uploader/editor.js' ); 103 media.view.UploaderInline = require( './views/uploader/inline.js' ); 104 media.view.UploaderStatus = require( './views/uploader/status.js' ); 105 media.view.UploaderStatusError = require( './views/uploader/status-error.js' ); 106 media.view.Toolbar = require( './views/toolbar.js' ); 107 media.view.Toolbar.Select = require( './views/toolbar/select.js' ); 108 media.view.Toolbar.Embed = require( './views/toolbar/embed.js' ); 109 media.view.Button = require( './views/button.js' ); 110 media.view.ButtonGroup = require( './views/button-group.js' ); 111 media.view.PriorityList = require( './views/priority-list.js' ); 112 media.view.MenuItem = require( './views/menu-item.js' ); 113 media.view.Menu = require( './views/menu.js' ); 114 media.view.RouterItem = require( './views/router-item.js' ); 115 media.view.Router = require( './views/router.js' ); 116 media.view.Sidebar = require( './views/sidebar.js' ); 117 media.view.Attachment = require( './views/attachment.js' ); 118 media.view.Attachment.Library = require( './views/attachment/library.js' ); 119 media.view.Attachment.EditLibrary = require( './views/attachment/edit-library.js' ); 120 media.view.Attachments = require( './views/attachments.js' ); 121 media.view.Search = require( './views/search.js' ); 122 media.view.AttachmentFilters = require( './views/attachment-filters.js' ); 123 media.view.DateFilter = require( './views/attachment-filters/date.js' ); 124 media.view.AttachmentFilters.Uploaded = require( './views/attachment-filters/uploaded.js' ); 125 media.view.AttachmentFilters.All = require( './views/attachment-filters/all.js' ); 126 media.view.AttachmentsBrowser = require( './views/attachments/browser.js' ); 127 media.view.Selection = require( './views/selection.js' ); 128 media.view.Attachment.Selection = require( './views/attachment/selection.js' ); 129 media.view.Attachments.Selection = require( './views/attachments/selection.js' ); 130 media.view.Attachment.EditSelection = require( './views/attachment/edit-selection.js' ); 131 media.view.Settings = require( './views/settings.js' ); 132 media.view.Settings.AttachmentDisplay = require( './views/settings/attachment-display.js' ); 133 media.view.Settings.Gallery = require( './views/settings/gallery.js' ); 134 media.view.Settings.Playlist = require( './views/settings/playlist.js' ); 135 media.view.Attachment.Details = require( './views/attachment/details.js' ); 136 media.view.AttachmentCompat = require( './views/attachment-compat.js' ); 137 media.view.Iframe = require( './views/iframe.js' ); 138 media.view.Embed = require( './views/embed.js' ); 139 media.view.Label = require( './views/label.js' ); 140 media.view.EmbedUrl = require( './views/embed/url.js' ); 141 media.view.EmbedLink = require( './views/embed/link.js' ); 142 media.view.EmbedImage = require( './views/embed/image.js' ); 143 media.view.ImageDetails = require( './views/image-details.js' ); 144 media.view.Cropper = require( './views/cropper.js' ); 145 media.view.EditImage = require( './views/edit-image.js' ); 146 media.view.Spinner = require( './views/spinner.js' ); 71 return deferred.promise(); 72 }; 147 73 148 }(jQuery, _)); 74 media.controller.Region = require( './controllers/region.js' ); 75 media.controller.StateMachine = require( './controllers/state-machine.js' ); 76 media.controller.State = require( './controllers/state.js' ); 77 78 media.selectionSync = require( './utils/selection-sync.js' ); 79 media.controller.Library = require( './controllers/library.js' ); 80 media.controller.ImageDetails = require( './controllers/image-details.js' ); 81 media.controller.GalleryEdit = require( './controllers/gallery-edit.js' ); 82 media.controller.GalleryAdd = require( './controllers/gallery-add.js' ); 83 media.controller.CollectionEdit = require( './controllers/collection-edit.js' ); 84 media.controller.CollectionAdd = require( './controllers/collection-add.js' ); 85 media.controller.FeaturedImage = require( './controllers/featured-image.js' ); 86 media.controller.ReplaceImage = require( './controllers/replace-image.js' ); 87 media.controller.EditImage = require( './controllers/edit-image.js' ); 88 media.controller.MediaLibrary = require( './controllers/media-library.js' ); 89 media.controller.Embed = require( './controllers/embed.js' ); 90 media.controller.Cropper = require( './controllers/cropper.js' ); 91 92 media.View = require( './views/view.js' ); 93 media.view.Frame = require( './views/view.js' ); 94 media.view.MediaFrame = require( './views/media-frame.js' ); 95 media.view.MediaFrame.Select = require( './views/frame/select.js' ); 96 media.view.MediaFrame.Post = require( './views/frame/post.js' ); 97 media.view.MediaFrame.ImageDetails = require( './views/frame/image-details.js' ); 98 media.view.Modal = require( './views/modal.js' ); 99 media.view.FocusManager = require( './views/focus-manager.js' ); 100 media.view.UploaderWindow = require( './views/uploader/window.js' ); 101 media.view.EditorUploader = require( './views/uploader/editor.js' ); 102 media.view.UploaderInline = require( './views/uploader/inline.js' ); 103 media.view.UploaderStatus = require( './views/uploader/status.js' ); 104 media.view.UploaderStatusError = require( './views/uploader/status-error.js' ); 105 media.view.Toolbar = require( './views/toolbar.js' ); 106 media.view.Toolbar.Select = require( './views/toolbar/select.js' ); 107 media.view.Toolbar.Embed = require( './views/toolbar/embed.js' ); 108 media.view.Button = require( './views/button.js' ); 109 media.view.ButtonGroup = require( './views/button-group.js' ); 110 media.view.PriorityList = require( './views/priority-list.js' ); 111 media.view.MenuItem = require( './views/menu-item.js' ); 112 media.view.Menu = require( './views/menu.js' ); 113 media.view.RouterItem = require( './views/router-item.js' ); 114 media.view.Router = require( './views/router.js' ); 115 media.view.Sidebar = require( './views/sidebar.js' ); 116 media.view.Attachment = require( './views/attachment.js' ); 117 media.view.Attachment.Library = require( './views/attachment/library.js' ); 118 media.view.Attachment.EditLibrary = require( './views/attachment/edit-library.js' ); 119 media.view.Attachments = require( './views/attachments.js' ); 120 media.view.Search = require( './views/search.js' ); 121 media.view.AttachmentFilters = require( './views/attachment-filters.js' ); 122 media.view.DateFilter = require( './views/attachment-filters/date.js' ); 123 media.view.AttachmentFilters.Uploaded = require( './views/attachment-filters/uploaded.js' ); 124 media.view.AttachmentFilters.All = require( './views/attachment-filters/all.js' ); 125 media.view.AttachmentsBrowser = require( './views/attachments/browser.js' ); 126 media.view.Selection = require( './views/selection.js' ); 127 media.view.Attachment.Selection = require( './views/attachment/selection.js' ); 128 media.view.Attachments.Selection = require( './views/attachments/selection.js' ); 129 media.view.Attachment.EditSelection = require( './views/attachment/edit-selection.js' ); 130 media.view.Settings = require( './views/settings.js' ); 131 media.view.Settings.AttachmentDisplay = require( './views/settings/attachment-display.js' ); 132 media.view.Settings.Gallery = require( './views/settings/gallery.js' ); 133 media.view.Settings.Playlist = require( './views/settings/playlist.js' ); 134 media.view.Attachment.Details = require( './views/attachment/details.js' ); 135 media.view.AttachmentCompat = require( './views/attachment-compat.js' ); 136 media.view.Iframe = require( './views/iframe.js' ); 137 media.view.Embed = require( './views/embed.js' ); 138 media.view.Label = require( './views/label.js' ); 139 media.view.EmbedUrl = require( './views/embed/url.js' ); 140 media.view.EmbedLink = require( './views/embed/link.js' ); 141 media.view.EmbedImage = require( './views/embed/image.js' ); 142 media.view.ImageDetails = require( './views/image-details.js' ); 143 media.view.Cropper = require( './views/cropper.js' ); 144 media.view.EditImage = require( './views/edit-image.js' ); 145 media.view.Spinner = require( './views/spinner.js' ); -
trunk/src/wp-includes/js/media/views/attachment-compat.js
r31373 r31385 1 /*globals _ */2 3 1 /** 4 2 * wp.media.view.AttachmentCompat -
trunk/src/wp-includes/js/media/views/attachment-filters.js
r31373 r31385 1 /*globals _, jQuery */2 3 1 /** 4 2 * wp.media.view.AttachmentFilters -
trunk/src/wp-includes/js/media/views/attachment-filters/all.js
r31373 r31385 1 /*globals _, wp */2 3 1 /** 4 2 * wp.media.view.AttachmentFilters.All -
trunk/src/wp-includes/js/media/views/attachment-filters/date.js
r31373 r31385 1 /*globals _, wp */2 3 1 /** 4 2 * A filter dropdown for month/dates. -
trunk/src/wp-includes/js/media/views/attachment-filters/uploaded.js
r31373 r31385 1 /*globals wp */2 3 1 /** 4 2 * wp.media.view.AttachmentFilters.Uploaded -
trunk/src/wp-includes/js/media/views/attachment.js
r31373 r31385 1 /*globals _, wp, jQuery */2 3 1 /** 4 2 * wp.media.view.Attachment -
trunk/src/wp-includes/js/media/views/attachment/details-two-column.js
r31373 r31385 1 /*globals wp */2 3 1 /** 4 2 * A similar view to media.view.Attachment.Details … … 35 33 this.$( 'audio, video' ).each( function (i, elem) { 36 34 var el = MediaDetails.prepareSrc( elem ); 37 new MediaElementPlayer( el, wp.media.mixin.mejsSettings );35 new window.MediaElementPlayer( el, wp.media.mixin.mejsSettings ); 38 36 } ); 39 37 } -
trunk/src/wp-includes/js/media/views/attachment/details.js
r31373 r31385 1 /*globals _, wp */2 3 1 /** 4 2 * wp.media.view.Attachment.Details … … 60 58 event.preventDefault(); 61 59 62 if ( confirm( l10n.warnDelete ) ) {60 if ( window.confirm( l10n.warnDelete ) ) { 63 61 this.model.destroy(); 64 62 // Keep focus inside media modal -
trunk/src/wp-includes/js/media/views/attachments.js
r31373 r31385 1 /*globals _, wp, jQuery */2 3 1 /** 4 2 * wp.media.view.Attachments … … 273 271 // The scroll event occurs on the document, but the element 274 272 // that should be checked is the document body. 275 if ( el == document ) {273 if ( el === document ) { 276 274 el = document.body; 277 275 scrollTop = $(document).scrollTop(); -
trunk/src/wp-includes/js/media/views/attachments/browser.js
r31380 r31385 1 /*globals _, wp, jQuery */2 3 1 /** 4 2 * wp.media.view.AttachmentsBrowser … … 191 189 } 192 190 193 if ( ! mediaTrash && ! confirm( l10n.warnBulkDelete ) ) {191 if ( ! mediaTrash && ! window.confirm( l10n.warnBulkDelete ) ) { 194 192 return; 195 193 } … … 197 195 if ( mediaTrash && 198 196 'trash' !== selection.at( 0 ).get( 'status' ) && 199 ! confirm( l10n.warnBulkTrash ) ) {197 ! window.confirm( l10n.warnBulkTrash ) ) { 200 198 201 199 return; … … 245 243 var removed = [], selection = this.controller.state().get( 'selection' ); 246 244 247 if ( ! selection.length || ! confirm( l10n.warnBulkDelete ) ) {245 if ( ! selection.length || ! window.confirm( l10n.warnBulkDelete ) ) { 248 246 return; 249 247 } -
trunk/src/wp-includes/js/media/views/attachments/selection.js
r31373 r31385 1 /*globals _ */2 3 1 /** 4 2 * wp.media.view.Attachments.Selection -
trunk/src/wp-includes/js/media/views/audio-details.js
r31373 r31385 1 /*globals wp */2 3 1 /** 4 2 * wp.media.view.AudioDetails -
trunk/src/wp-includes/js/media/views/button-group.js
r31373 r31385 1 /*globals _, Backbone, jQuery */2 3 1 /** 4 2 * wp.media.view.ButtonGroup -
trunk/src/wp-includes/js/media/views/button.js
r31373 r31385 1 /*globals _, Backbone */2 3 1 /** 4 2 * wp.media.view.Button -
trunk/src/wp-includes/js/media/views/button/delete-selected.js
r31373 r31385 1 /*globals wp */2 3 1 /** 4 2 * A button that handles bulk Delete/Trash logic -
trunk/src/wp-includes/js/media/views/button/select-mode-toggle.js
r31373 r31385 1 /*globals wp */2 3 1 var Button = require( '../button.js' ), 4 2 l10n = wp.media.view.l10n, -
trunk/src/wp-includes/js/media/views/cropper.js
r31373 r31385 1 /*globals _, wp, jQuery */2 3 1 /** 4 2 * wp.media.view.Cropper … … 61 59 this.views.add( '.upload-errors', new UploaderStatusError({ 62 60 filename: UploaderStatus.prototype.filename(filename), 63 message: _wpMediaViewsL10n.cropError61 message: window._wpMediaViewsL10n.cropError 64 62 }), { at: 0 }); 65 63 } -
trunk/src/wp-includes/js/media/views/edit-image.js
r31380 r31385 1 /*globals _, wp */2 3 1 var View = require( './view.js' ), 4 2 EditImage; -
trunk/src/wp-includes/js/media/views/embed/image.js
r31373 r31385 1 /*globals wp */2 3 1 /** 4 2 * wp.media.view.EmbedImage -
trunk/src/wp-includes/js/media/views/embed/link.js
r31373 r31385 1 /*globals _, wp, jQuery */2 3 1 /** 4 2 * wp.media.view.EmbedLink -
trunk/src/wp-includes/js/media/views/embed/url.js
r31380 r31385 1 /*globals _, wp, jQuery */2 3 1 /** 4 2 * wp.media.view.EmbedUrl -
trunk/src/wp-includes/js/media/views/frame.js
r31373 r31385 1 /*globals _, Backbone */2 3 1 /** 4 2 * wp.media.view.Frame -
trunk/src/wp-includes/js/media/views/frame/audio-details.js
r31373 r31385 1 /*globals wp */2 3 1 /** 4 2 * wp.media.view.MediaFrame.AudioDetails -
trunk/src/wp-includes/js/media/views/frame/edit-attachments.js
r31380 r31385 1 /*globals _, wp, jQuery */2 3 1 /** 4 2 * A frame for editing the details of a specific media item. -
trunk/src/wp-includes/js/media/views/frame/image-details.js
r31379 r31385 1 /*globals wp */2 3 1 /** 4 2 * wp.media.view.MediaFrame.ImageDetails -
trunk/src/wp-includes/js/media/views/frame/manage.js
r31373 r31385 1 /*globals _, Backbone, wp, jQuery */2 3 1 /** 4 2 * wp.media.view.MediaFrame.Manage … … 238 236 if ( window.history && window.history.pushState ) { 239 237 Backbone.history.start( { 240 root: _wpMediaGridSettings.adminUrl,238 root: window._wpMediaGridSettings.adminUrl, 241 239 pushState: true 242 240 } ); -
trunk/src/wp-includes/js/media/views/frame/media-details.js
r31379 r31385 1 /*globals wp */2 3 1 /** 4 2 * wp.media.view.MediaFrame.MediaDetails -
trunk/src/wp-includes/js/media/views/frame/post.js
r31379 r31385 1 /*globals _, wp */2 3 1 /** 4 2 * wp.media.view.MediaFrame.Post -
trunk/src/wp-includes/js/media/views/frame/select.js
r31379 r31385 1 /*globals _, wp */2 3 1 /** 4 2 * wp.media.view.MediaFrame.Select -
trunk/src/wp-includes/js/media/views/frame/video-details.js
r31373 r31385 1 /*globals _, wp */2 3 1 /** 4 2 * wp.media.view.MediaFrame.VideoDetails -
trunk/src/wp-includes/js/media/views/image-details.js
r31380 r31385 1 /*globals _, wp, jQuery */2 3 1 /** 4 2 * wp.media.view.ImageDetails … … 74 72 setTimeout( _.bind( this.resetFocus, this ), 10 ); 75 73 this.toggleLinkSettings(); 76 if ( getUserSetting( 'advImgDetails' ) === 'show' ) {74 if ( window.getUserSetting( 'advImgDetails' ) === 'show' ) { 77 75 this.toggleAdvanced( true ); 78 76 } … … 147 145 } 148 146 149 setUserSetting( 'advImgDetails', mode );147 window.setUserSetting( 'advImgDetails', mode ); 150 148 }, 151 149 -
trunk/src/wp-includes/js/media/views/media-details.js
r31380 r31385 1 /*globals _, wp, jQuery */2 3 1 /** 4 2 * wp.media.view.MediaDetails … … 84 82 setPlayer : function() { 85 83 if ( ! this.players.length && this.media ) { 86 this.players.push( new MediaElementPlayer( this.media, this.settings ) );84 this.players.push( new window.MediaElementPlayer( this.media, this.settings ) ); 87 85 } 88 86 }, … … 112 110 render: function() { 113 111 AttachmentDisplay.prototype.render.apply( this, arguments ); 114 112 115 113 setTimeout( _.bind( function() { 116 114 this.resetFocus(); -
trunk/src/wp-includes/js/media/views/media-frame.js
r31373 r31385 1 /*globals _, wp, jQuery */2 3 1 /** 4 2 * wp.media.view.MediaFrame -
trunk/src/wp-includes/js/media/views/menu-item.js
r31373 r31385 1 /*globals wp, jQuery */2 3 1 /** 4 2 * wp.media.view.MenuItem -
trunk/src/wp-includes/js/media/views/modal.js
r31373 r31385 1 /*globals _, wp, jQuery */2 3 1 /** 4 2 * wp.media.view.Modal -
trunk/src/wp-includes/js/media/views/priority-list.js
r31373 r31385 1 /*globals _, Backbone */2 3 1 /** 4 2 * wp.media.view.PriorityList -
trunk/src/wp-includes/js/media/views/search.js
r31373 r31385 1 /*globals wp */2 3 1 /** 4 2 * wp.media.view.Search -
trunk/src/wp-includes/js/media/views/selection.js
r31373 r31385 1 /*globals _, Backbone, wp */2 3 1 /** 4 2 * wp.media.view.Selection -
trunk/src/wp-includes/js/media/views/settings.js
r31373 r31385 1 /*globals _, Backbone, jQuery */2 3 1 /** 4 2 * wp.media.view.Settings … … 108 106 // update that as well. 109 107 if ( userSetting = $setting.data('userSetting') ) { 110 setUserSetting( userSetting, value );108 window.setUserSetting( userSetting, value ); 111 109 } 112 110 }, -
trunk/src/wp-includes/js/media/views/settings/attachment-display.js
r31373 r31385 1 /*globals _, wp */2 3 1 /** 4 2 * wp.media.view.Settings.AttachmentDisplay -
trunk/src/wp-includes/js/media/views/settings/gallery.js
r31373 r31385 1 /*globals wp */2 3 1 /** 4 2 * wp.media.view.Settings.Gallery -
trunk/src/wp-includes/js/media/views/settings/playlist.js
r31373 r31385 1 /*globals wp */2 3 1 /** 4 2 * wp.media.view.Settings.Playlist -
trunk/src/wp-includes/js/media/views/spinner.js
r31373 r31385 1 /*globals _, wp */2 3 1 /** 4 2 * wp.media.view.Spinner -
trunk/src/wp-includes/js/media/views/toolbar.js
r31373 r31385 1 /*globals Backbone, _ */2 3 1 /** 4 2 * wp.media.view.Toolbar -
trunk/src/wp-includes/js/media/views/toolbar/embed.js
r31373 r31385 1 /*globals _, wp */2 3 1 /** 4 2 * wp.media.view.Toolbar.Embed -
trunk/src/wp-includes/js/media/views/toolbar/select.js
r31373 r31385 1 /*globals _, wp */2 3 1 /** 4 2 * wp.media.view.Toolbar.Select -
trunk/src/wp-includes/js/media/views/uploader/editor.js
r31380 r31385 1 /*globals _, wp, jQuery */2 3 1 /** 4 2 * Creates a dropzone on WP editor instances (elements with .wp-editor-wrap -
trunk/src/wp-includes/js/media/views/uploader/inline.js
r31373 r31385 1 /*globals _, wp */2 3 1 /** 4 2 * wp.media.view.UploaderInline -
trunk/src/wp-includes/js/media/views/uploader/status-error.js
r31373 r31385 1 /*globals wp */2 3 1 /** 4 2 * wp.media.view.UploaderStatusError -
trunk/src/wp-includes/js/media/views/uploader/status.js
r31373 r31385 1 /*globals _, wp */2 3 1 /** 4 2 * wp.media.view.UploaderStatus -
trunk/src/wp-includes/js/media/views/uploader/window.js
r31373 r31385 1 /*globals _, wp, jQuery */2 3 1 /** 4 2 * wp.media.view.UploaderWindow -
trunk/src/wp-includes/js/media/views/video-details.js
r31373 r31385 1 /*globals wp */2 3 1 /** 4 2 * wp.media.view.VideoDetails -
trunk/src/wp-includes/js/media/views/view.js
r31373 r31385 1 /*globals wp */2 3 1 /** 4 2 * wp.media.View
Note: See TracChangeset
for help on using the changeset viewer.