Ticket #25974: 25974.diff
| File 25974.diff, 4.8 KB (added by , 12 years ago) |
|---|
-
src/wp-includes/js/media-views.js
1 /* Token "_wpMediaViewsL10n" is used for localization */ 2 /* global _wpMediaViewsL10n: false */ 3 /* global confirm: false */ 4 /* global getUserSetting: false */ 5 /* global setUserSetting: false */ 1 6 (function($){ 2 7 var media = wp.media, 3 8 Attachment = media.model.Attachment, 4 9 Attachments = media.model.Attachments, 5 Query = media.model.Query,6 10 l10n; 7 11 8 12 // Link any localized strings. … … 118 122 }, 119 123 120 124 trigger: function( event ) { 121 var base; 125 var base, args; 126 122 127 if ( ! this._mode ) 123 128 return; 124 129 125 varargs = _.toArray( arguments );130 args = _.toArray( arguments ); 126 131 base = this.id + ':' + event; 127 132 128 133 // Trigger `region:action:mode` event. … … 455 460 }, 456 461 457 462 defaultDisplaySettings: function( attachment ) { 458 settings = this._defaultDisplaySettings;463 var settings = this._defaultDisplaySettings; 459 464 if ( settings.canEmbed = this.canEmbed( attachment ) ) 460 465 settings.link = 'embed'; 461 466 return settings; … … 495 500 496 501 recordSelection: function() { 497 502 var selection = this.get('selection'), 498 manager = this.frame._selection, 499 filtered; 503 manager = this.frame._selection; 500 504 501 505 if ( ! this.get('syncSelection') || ! manager || ! selection ) 502 506 return; … … 1059 1063 1060 1064 // Generate the tab states. 1061 1065 _.each( tabs, function( title, id ) { 1062 var frame =this.state( 'iframe:' + id ).set( _.defaults({1066 this.state( 'iframe:' + id ).set( _.defaults({ 1063 1067 tab: id, 1064 1068 src: tabUrl + '&tab=' + id, 1065 1069 title: title, … … 1123 1127 1124 1128 // Map some of the modal's methods to the frame. 1125 1129 _.each(['open','close','attach','detach','escape'], function( method ) { 1126 media.view.MediaFrame.prototype[ method ] = function( view) {1130 media.view.MediaFrame.prototype[ method ] = function() { 1127 1131 if ( this.modal ) 1128 1132 this.modal[ method ].apply( this.modal, arguments ); 1129 1133 return this; … … 1150 1154 }, 1151 1155 1152 1156 createSelection: function() { 1153 var controller = this, 1154 selection = this.options.selection; 1157 var selection = this.options.selection; 1155 1158 1156 1159 if ( ! (selection instanceof media.model.Selection) ) { 1157 1160 this.options.selection = new media.model.Selection( selection, { … … 1931 1934 1932 1935 progress: function() { 1933 1936 var queue = this.queue, 1934 $bar = this.$bar, 1935 memo = 0; 1937 $bar = this.$bar; 1936 1938 1937 1939 if ( ! $bar || ! queue.length ) 1938 1940 return; … … 2111 2113 // ---------------------------- 2112 2114 media.view.Toolbar.Select = media.view.Toolbar.extend({ 2113 2115 initialize: function() { 2114 var options = this.options, 2115 controller = options.controller, 2116 selection = controller.state().get('selection'); 2116 var options = this.options; 2117 2117 2118 2118 _.bindAll( this, 'clickSelect' ); 2119 2119 … … 2618 2618 selection = this.options.selection, 2619 2619 model = this.model, 2620 2620 method = options && options.method, 2621 single, between,models, singleIndex, modelIndex;2621 single, models, singleIndex, modelIndex; 2622 2622 2623 2623 if ( ! selection ) 2624 2624 return; … … 2899 2899 2900 2900 this._viewsByCid = {}; 2901 2901 2902 this.collection.on( 'add', function( attachment , attachments, options) {2902 this.collection.on( 'add', function( attachment ) { 2903 2903 this.views.add( this.createAttachmentView( attachment ), { 2904 2904 at: this.collection.indexOf( attachment ) 2905 2905 }); 2906 2906 }, this ); 2907 2907 2908 this.collection.on( 'remove', function( attachment , attachments, options) {2908 this.collection.on( 'remove', function( attachment ) { 2909 2909 var view = this._viewsByCid[ attachment.cid ]; 2910 2910 delete this._viewsByCid[ attachment.cid ]; 2911 2911 … … 3066 3066 this.scroll(); 3067 3067 }, 3068 3068 3069 scroll: function( event) {3069 scroll: function() { 3070 3070 // @todo: is this still necessary? 3071 3071 if ( ! this.$el.is(':visible') ) 3072 3072 return; … … 3149 3149 this.filters = {}; 3150 3150 }, 3151 3151 3152 change: function( event) {3152 change: function() { 3153 3153 var filter = this.filters[ this.el.value ]; 3154 3154 3155 3155 if ( filter ) … … 3396 3396 3397 3397 createSingle: function() { 3398 3398 var sidebar = this.sidebar, 3399 single = this.options.selection.single(), 3400 views = {}; 3399 single = this.options.selection.single(); 3401 3400 3402 3401 sidebar.set( 'details', new media.view.Attachment.Details({ 3403 3402 controller: this.controller, … … 3630 3629 setUserSetting( userSetting, value ); 3631 3630 }, 3632 3631 3633 updateChanges: function( model , options) {3632 updateChanges: function( model ) { 3634 3633 if ( model.hasChanged() ) 3635 3634 _( model.changed ).chain().keys().each( this.update, this ); 3636 3635 } … … 3756 3755 this.model.destroy(); 3757 3756 }, 3758 3757 3759 editAttachment: function( event) {3758 editAttachment: function() { 3760 3759 this.$el.addClass('needs-refresh'); 3761 3760 }, 3762 3761