Changeset 31380
- Timestamp:
- 02/09/2015 04:44:39 AM (8 years ago)
- Location:
- trunk/src/wp-includes/js/media
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/js/media/audio-video.js
r31379 r31380 131 131 132 132 shortcode : function( model ) { 133 var self = this,content;133 var content; 134 134 135 135 _.each( this.defaults, function( value, key ) { … … 139 139 delete model[ key ]; 140 140 } 141 } );141 }, this ); 142 142 143 143 content = model.content; … … 192 192 193 193 shortcode : function( model ) { 194 var self = this,content;194 var content; 195 195 196 196 _.each( this.defaults, function( value, key ) { 197 model[ key ] = self.coerce( model, key );197 model[ key ] = this.coerce( model, key ); 198 198 199 199 if ( value === model[ key ] ) { 200 200 delete model[ key ]; 201 201 } 202 } );202 }, this ); 203 203 204 204 content = model.content; … … 1190 1190 1191 1191 changeAttachment: function( attachment ) { 1192 var self = this;1193 1194 1192 this.setSource( attachment ); 1195 1193 1196 1194 this.unset( 'src' ); 1197 1195 _.each( _.without( wp.media.view.settings.embedExts, this.extension ), function( ext ) { 1198 self.unset( ext );1199 } );1196 this.unset( ext ); 1197 }, this ); 1200 1198 } 1201 1199 }); … … 2832 2830 priority: -60, 2833 2831 click: function() { 2834 var changed = [], removed = [], self = this,2832 var changed = [], removed = [], 2835 2833 selection = this.controller.state().get( 'selection' ), 2836 2834 library = this.controller.state().get( 'library' ); … … 2873 2871 selection.remove( removed ); 2874 2872 2875 $.when.apply( null, changed ).then( function() {2873 $.when.apply( null, changed ).then( _.bind( function() { 2876 2874 library._requery( true ); 2877 self.controller.trigger( 'selection:action:done' );2878 } );2875 this.controller.trigger( 'selection:action:done' ); 2876 }, this ) ); 2879 2877 } else { 2880 2878 this.controller.trigger( 'selection:action:done' ); … … 4146 4144 */ 4147 4145 render: function() { 4148 var self = this;4149 4150 4146 AttachmentDisplay.prototype.render.apply( this, arguments ); 4151 setTimeout( function() { self.resetFocus(); }, 10 ); 4147 4148 setTimeout( _.bind( function() { 4149 this.resetFocus(); 4150 }, this ), 10 ); 4152 4151 4153 4152 this.settings = _.defaults( { -
trunk/src/wp-includes/js/media/audio-video.manifest.js
r31373 r31380 130 130 131 131 shortcode : function( model ) { 132 var self = this,content;132 var content; 133 133 134 134 _.each( this.defaults, function( value, key ) { … … 138 138 delete model[ key ]; 139 139 } 140 } );140 }, this ); 141 141 142 142 content = model.content; … … 191 191 192 192 shortcode : function( model ) { 193 var self = this,content;193 var content; 194 194 195 195 _.each( this.defaults, function( value, key ) { 196 model[ key ] = self.coerce( model, key );196 model[ key ] = this.coerce( model, key ); 197 197 198 198 if ( value === model[ key ] ) { 199 199 delete model[ key ]; 200 200 } 201 } );201 }, this ); 202 202 203 203 content = model.content; -
trunk/src/wp-includes/js/media/controllers/cropper.js
r31373 r31380 68 68 69 69 click: function() { 70 var self = this,71 selection = this.controller.state().get('selection').first();70 var controller = this.controller, 71 selection; 72 72 73 selection.set({cropDetails: this.controller.state().imgSelect.getSelection()}); 73 selection = controller.state().get('selection').first(); 74 selection.set({cropDetails: controller.state().imgSelect.getSelection()}); 74 75 75 76 this.$el.text(l10n.cropping); 76 77 this.$el.attr('disabled', true); 77 this.controller.state().doCrop( selection ).done( function( croppedImage ) { 78 self.controller.trigger('cropped', croppedImage ); 79 self.controller.close(); 78 79 controller.state().doCrop( selection ).done( function( croppedImage ) { 80 controller.trigger('cropped', croppedImage ); 81 controller.close(); 80 82 }).fail( function() { 81 self.controller.trigger('content:error:crop');83 controller.trigger('content:error:crop'); 82 84 }); 83 85 } -
trunk/src/wp-includes/js/media/grid.js
r31379 r31380 2664 2664 priority: -60, 2665 2665 click: function() { 2666 var changed = [], removed = [], self = this,2666 var changed = [], removed = [], 2667 2667 selection = this.controller.state().get( 'selection' ), 2668 2668 library = this.controller.state().get( 'library' ); … … 2705 2705 selection.remove( removed ); 2706 2706 2707 $.when.apply( null, changed ).then( function() {2707 $.when.apply( null, changed ).then( _.bind( function() { 2708 2708 library._requery( true ); 2709 self.controller.trigger( 'selection:action:done' );2710 } );2709 this.controller.trigger( 'selection:action:done' ); 2710 }, this ) ); 2711 2711 } else { 2712 2712 this.controller.trigger( 'selection:action:done' ); … … 3199 3199 3200 3200 save: function() { 3201 var self = this; 3202 3203 this.model.fetch().done( function() { 3204 self.frame.content.mode( 'edit-metadata' ); 3205 }); 3201 this.model.fetch().done( _.bind( function() { 3202 this.frame.content.mode( 'edit-metadata' ); 3203 }, this ) ); 3206 3204 } 3207 3205 }); … … 3252 3250 3253 3251 save: function() { 3254 var self = this, 3255 lastState = this.controller.lastState(); 3256 3257 this.model.fetch().done( function() { 3258 self.controller.setState( lastState ); 3259 }); 3252 var lastState = this.controller.lastState(); 3253 3254 this.model.fetch().done( _.bind( function() { 3255 this.controller.setState( lastState ); 3256 }, this ) ); 3260 3257 } 3261 3258 … … 3561 3558 3562 3559 createModal: function() { 3563 var self = this;3564 3565 3560 // Initialize modal container view. 3566 3561 if ( this.options.modal ) { … … 3570 3565 }); 3571 3566 3572 this.modal.on( 'open', function () {3573 $( 'body' ).on( 'keydown.media-modal', _.bind( self.keyEvent, self) );3574 } );3567 this.modal.on( 'open', _.bind( function () { 3568 $( 'body' ).on( 'keydown.media-modal', _.bind( this.keyEvent, this ) ); 3569 }, this ) ); 3575 3570 3576 3571 // Completely destroy the modal DOM element when closing it. 3577 this.modal.on( 'close', function() {3578 self.modal.remove();3572 this.modal.on( 'close', _.bind( function() { 3573 this.modal.remove(); 3579 3574 $( 'body' ).off( 'keydown.media-modal' ); /* remove the keydown event */ 3580 3575 // Restore the original focus item if possible 3581 $( 'li.attachment[data-id="' + self.model.get( 'id' ) +'"]' ).focus();3582 self.resetRoute();3583 } );3576 $( 'li.attachment[data-id="' + this.model.get( 'id' ) +'"]' ).focus(); 3577 this.resetRoute(); 3578 }, this ) ); 3584 3579 3585 3580 // Set this frame as the modal's content. … … 4146 4141 */ 4147 4142 render: function() { 4148 var self = this;4149 4150 4143 AttachmentDisplay.prototype.render.apply( this, arguments ); 4151 setTimeout( function() { self.resetFocus(); }, 10 ); 4144 4145 setTimeout( _.bind( function() { 4146 this.resetFocus(); 4147 }, this ), 10 ); 4152 4148 4153 4149 this.settings = _.defaults( { -
trunk/src/wp-includes/js/media/models/post-media.js
r31373 r31380 29 29 30 30 changeAttachment: function( attachment ) { 31 var self = this;32 33 31 this.setSource( attachment ); 34 32 35 33 this.unset( 'src' ); 36 34 _.each( _.without( wp.media.view.settings.embedExts, this.extension ), function( ext ) { 37 self.unset( ext );38 } );35 this.unset( ext ); 36 }, this ); 39 37 } 40 38 }); -
trunk/src/wp-includes/js/media/views.js
r31379 r31380 334 334 335 335 click: function() { 336 var self = this, 337 selection = this.controller.state().get('selection').first(); 338 339 selection.set({cropDetails: this.controller.state().imgSelect.getSelection()}); 336 var controller = this.controller, 337 selection; 338 339 selection = controller.state().get('selection').first(); 340 selection.set({cropDetails: controller.state().imgSelect.getSelection()}); 340 341 341 342 this.$el.text(l10n.cropping); 342 343 this.$el.attr('disabled', true); 343 this.controller.state().doCrop( selection ).done( function( croppedImage ) { 344 self.controller.trigger('cropped', croppedImage ); 345 self.controller.close(); 344 345 controller.state().doCrop( selection ).done( function( croppedImage ) { 346 controller.trigger('cropped', croppedImage ); 347 controller.close(); 346 348 }).fail( function() { 347 self.controller.trigger('content:error:crop');349 controller.trigger('content:error:crop'); 348 350 }); 349 351 } … … 3837 3839 priority: -60, 3838 3840 click: function() { 3839 var changed = [], removed = [], self = this,3841 var changed = [], removed = [], 3840 3842 selection = this.controller.state().get( 'selection' ), 3841 3843 library = this.controller.state().get( 'library' ); … … 3878 3880 selection.remove( removed ); 3879 3881 3880 $.when.apply( null, changed ).then( function() {3882 $.when.apply( null, changed ).then( _.bind( function() { 3881 3883 library._requery( true ); 3882 self.controller.trigger( 'selection:action:done' );3883 } );3884 this.controller.trigger( 'selection:action:done' ); 3885 }, this ) ); 3884 3886 } else { 3885 3887 this.controller.trigger( 'selection:action:done' ); … … 4396 4398 4397 4399 save: function() { 4398 var self = this, 4399 lastState = this.controller.lastState(); 4400 4401 this.model.fetch().done( function() { 4402 self.controller.setState( lastState ); 4403 }); 4400 var lastState = this.controller.lastState(); 4401 4402 this.model.fetch().done( _.bind( function() { 4403 this.controller.setState( lastState ); 4404 }, this ) ); 4404 4405 } 4405 4406 … … 4604 4605 4605 4606 initialize: function() { 4606 var self = this;4607 4608 4607 this.$input = $('<input id="embed-url-field" type="url" />').val( this.model.get('url') ); 4609 4608 this.input = this.$input[0]; … … 4615 4614 4616 4615 if ( this.model.get( 'url' ) ) { 4617 _.delay( function () {4618 self.model.trigger( 'change:url' );4619 }, 500 );4616 _.delay( _.bind( function () { 4617 this.model.trigger( 'change:url' ); 4618 }, this ), 500 ); 4620 4619 } 4621 4620 }, … … 6070 6069 6071 6070 render: function() { 6072 var self = this, 6073 args = arguments; 6071 var args = arguments; 6074 6072 6075 6073 if ( this.model.attachment && 'pending' === this.model.dfd.state() ) { 6076 this.model.dfd.done( function() { 6077 AttachmentDisplay.prototype.render.apply( self, args ); 6078 self.postRender(); 6079 } ).fail( function() { 6080 self.model.attachment = false; 6081 AttachmentDisplay.prototype.render.apply( self, args ); 6082 self.postRender(); 6083 } ); 6074 this.model.dfd 6075 .done( _.bind( function() { 6076 AttachmentDisplay.prototype.render.apply( this, args ); 6077 this.postRender(); 6078 }, this ) ) 6079 .fail( _.bind( function() { 6080 this.model.attachment = false; 6081 AttachmentDisplay.prototype.render.apply( this, args ); 6082 this.postRender(); 6083 }, this ) ); 6084 6084 } else { 6085 6085 AttachmentDisplay.prototype.render.apply( this, arguments ); … … 7794 7794 */ 7795 7795 initialize: function() { 7796 var self = this;7797 7798 7796 this.initialized = false; 7799 7797 … … 7815 7813 this.$document.on( 'dragleave', _.bind( this.containerDragleave, this ) ); 7816 7814 7817 this.$document.on( 'dragstart dragend drop', function( event ) {7818 self.localDrag = event.type === 'dragstart';7819 } );7815 this.$document.on( 'dragstart dragend drop', _.bind( function( event ) { 7816 this.localDrag = event.type === 'dragstart'; 7817 }, this ) ); 7820 7818 7821 7819 this.initialized = true; -
trunk/src/wp-includes/js/media/views/attachments/browser.js
r31373 r31380 183 183 priority: -60, 184 184 click: function() { 185 var changed = [], removed = [], self = this,185 var changed = [], removed = [], 186 186 selection = this.controller.state().get( 'selection' ), 187 187 library = this.controller.state().get( 'library' ); … … 224 224 selection.remove( removed ); 225 225 226 $.when.apply( null, changed ).then( function() {226 $.when.apply( null, changed ).then( _.bind( function() { 227 227 library._requery( true ); 228 self.controller.trigger( 'selection:action:done' );229 } );228 this.controller.trigger( 'selection:action:done' ); 229 }, this ) ); 230 230 } else { 231 231 this.controller.trigger( 'selection:action:done' ); -
trunk/src/wp-includes/js/media/views/edit-image-details.js
r31373 r31380 16 16 17 17 save: function() { 18 var self = this; 19 20 this.model.fetch().done( function() { 21 self.frame.content.mode( 'edit-metadata' ); 22 }); 18 this.model.fetch().done( _.bind( function() { 19 this.frame.content.mode( 'edit-metadata' ); 20 }, this ) ); 23 21 } 24 22 }); -
trunk/src/wp-includes/js/media/views/edit-image.js
r31373 r31380 42 42 43 43 save: function() { 44 var self = this, 45 lastState = this.controller.lastState(); 44 var lastState = this.controller.lastState(); 46 45 47 this.model.fetch().done( function() {48 self.controller.setState( lastState );49 } );46 this.model.fetch().done( _.bind( function() { 47 this.controller.setState( lastState ); 48 }, this ) ); 50 49 } 51 50 -
trunk/src/wp-includes/js/media/views/embed/url.js
r31373 r31380 24 24 25 25 initialize: function() { 26 var self = this;27 28 26 this.$input = $('<input id="embed-url-field" type="url" />').val( this.model.get('url') ); 29 27 this.input = this.$input[0]; … … 35 33 36 34 if ( this.model.get( 'url' ) ) { 37 _.delay( function () {38 self.model.trigger( 'change:url' );39 }, 500 );35 _.delay( _.bind( function () { 36 this.model.trigger( 'change:url' ); 37 }, this ), 500 ); 40 38 } 41 39 }, -
trunk/src/wp-includes/js/media/views/frame/edit-attachments.js
r31373 r31380 75 75 76 76 createModal: function() { 77 var self = this;78 79 77 // Initialize modal container view. 80 78 if ( this.options.modal ) { … … 84 82 }); 85 83 86 this.modal.on( 'open', function () {87 $( 'body' ).on( 'keydown.media-modal', _.bind( self.keyEvent, self) );88 } );84 this.modal.on( 'open', _.bind( function () { 85 $( 'body' ).on( 'keydown.media-modal', _.bind( this.keyEvent, this ) ); 86 }, this ) ); 89 87 90 88 // Completely destroy the modal DOM element when closing it. 91 this.modal.on( 'close', function() {92 self.modal.remove();89 this.modal.on( 'close', _.bind( function() { 90 this.modal.remove(); 93 91 $( 'body' ).off( 'keydown.media-modal' ); /* remove the keydown event */ 94 92 // Restore the original focus item if possible 95 $( 'li.attachment[data-id="' + self.model.get( 'id' ) +'"]' ).focus();96 self.resetRoute();97 } );93 $( 'li.attachment[data-id="' + this.model.get( 'id' ) +'"]' ).focus(); 94 this.resetRoute(); 95 }, this ) ); 98 96 99 97 // Set this frame as the modal's content. -
trunk/src/wp-includes/js/media/views/image-details.js
r31373 r31380 50 50 51 51 render: function() { 52 var self = this, 53 args = arguments; 52 var args = arguments; 54 53 55 54 if ( this.model.attachment && 'pending' === this.model.dfd.state() ) { 56 this.model.dfd.done( function() { 57 AttachmentDisplay.prototype.render.apply( self, args ); 58 self.postRender(); 59 } ).fail( function() { 60 self.model.attachment = false; 61 AttachmentDisplay.prototype.render.apply( self, args ); 62 self.postRender(); 63 } ); 55 this.model.dfd 56 .done( _.bind( function() { 57 AttachmentDisplay.prototype.render.apply( this, args ); 58 this.postRender(); 59 }, this ) ) 60 .fail( _.bind( function() { 61 this.model.attachment = false; 62 AttachmentDisplay.prototype.render.apply( this, args ); 63 this.postRender(); 64 }, this ) ); 64 65 } else { 65 66 AttachmentDisplay.prototype.render.apply( this, arguments ); -
trunk/src/wp-includes/js/media/views/media-details.js
r31373 r31380 111 111 */ 112 112 render: function() { 113 var self = this;114 115 113 AttachmentDisplay.prototype.render.apply( this, arguments ); 116 setTimeout( function() { self.resetFocus(); }, 10 ); 114 115 setTimeout( _.bind( function() { 116 this.resetFocus(); 117 }, this ), 10 ); 117 118 118 119 this.settings = _.defaults( { -
trunk/src/wp-includes/js/media/views/uploader/editor.js
r31373 r31380 31 31 */ 32 32 initialize: function() { 33 var self = this;34 35 33 this.initialized = false; 36 34 … … 52 50 this.$document.on( 'dragleave', _.bind( this.containerDragleave, this ) ); 53 51 54 this.$document.on( 'dragstart dragend drop', function( event ) {55 self.localDrag = event.type === 'dragstart';56 } );52 this.$document.on( 'dragstart dragend drop', _.bind( function( event ) { 53 this.localDrag = event.type === 'dragstart'; 54 }, this ) ); 57 55 58 56 this.initialized = true;
Note: See TracChangeset
for help on using the changeset viewer.