diff --git src/wp-includes/css/media-views.css src/wp-includes/css/media-views.css
index 9a4478a..d40587b 100644
|
|
|
1290 | 1290 | margin: 0; |
1291 | 1291 | } |
1292 | 1292 | |
| 1293 | .media-toolbar .spinner { |
| 1294 | display: inline-block; |
| 1295 | margin-top: 14px; |
| 1296 | } |
| 1297 | |
1293 | 1298 | .media-sidebar .settings-save-status { |
1294 | 1299 | background: #f5f5f5; |
1295 | 1300 | float: right; |
diff --git src/wp-includes/js/media-views.js src/wp-includes/js/media-views.js
index c3f15f9..5306468 100644
|
|
|
5253 | 5253 | |
5254 | 5254 | this.collection.on( 'add remove reset', this.updateContent, this ); |
5255 | 5255 | }, |
| 5256 | toggleSpinner: function( state ) { |
| 5257 | if ( state ) { |
| 5258 | this.spinnerTimeout = _.delay(function( view ) { |
| 5259 | view.toolbar.get( 'spinner' ).show(); |
| 5260 | }, 600, this ); |
| 5261 | } else { |
| 5262 | this.toolbar.get( 'spinner' ).hide(); |
| 5263 | clearTimeout( this.spinnerTimeout ); |
| 5264 | } |
| 5265 | }, |
5256 | 5266 | /** |
5257 | 5267 | * @returns {wp.media.view.AttachmentsBrowser} Returns itself to allow chaining |
5258 | 5268 | */ |
… |
… |
|
5289 | 5299 | }).render() ); |
5290 | 5300 | } |
5291 | 5301 | |
| 5302 | this.toolbar.set( 'spinner', new media.view.Spinner({ |
| 5303 | priority: -70 |
| 5304 | }) ); |
| 5305 | |
5292 | 5306 | if ( this.options.search ) { |
5293 | 5307 | this.toolbar.set( 'search', new media.view.Search({ |
5294 | 5308 | controller: this.controller, |
… |
… |
|
5308 | 5322 | updateContent: function() { |
5309 | 5323 | var view = this; |
5310 | 5324 | |
| 5325 | view.toggleSpinner( false ); |
| 5326 | |
5311 | 5327 | if( ! this.attachments ) { |
5312 | 5328 | this.createAttachments(); |
5313 | 5329 | } |
5314 | 5330 | |
5315 | 5331 | if ( ! this.collection.length ) { |
5316 | | this.collection.more().done( function() { |
| 5332 | this.toggleSpinner( true ); |
| 5333 | this.collection.more().done(function() { |
5317 | 5334 | if ( ! view.collection.length ) { |
5318 | 5335 | view.createUploader(); |
5319 | 5336 | } |
| 5337 | view.toggleSpinner( false ); |
5320 | 5338 | }); |
5321 | 5339 | } |
5322 | 5340 | }, |
… |
… |
|
6312 | 6330 | this.$( '.embed-media-settings' ).scrollTop( 0 ); |
6313 | 6331 | } |
6314 | 6332 | }); |
| 6333 | |
| 6334 | /** |
| 6335 | * wp.media.view.Spinner |
| 6336 | * |
| 6337 | * |
| 6338 | * @constructor |
| 6339 | * @augments wp.media.View |
| 6340 | * @augments wp.Backbone.View |
| 6341 | * @augments Backbone.View |
| 6342 | */ |
| 6343 | media.view.Spinner = media.View.extend({ |
| 6344 | tagName: 'span', |
| 6345 | className: 'spinner', |
| 6346 | |
| 6347 | show: function() { |
| 6348 | this.$el.show(); |
| 6349 | return this; |
| 6350 | }, |
| 6351 | |
| 6352 | hide: function() { |
| 6353 | this.$el.hide(); |
| 6354 | return this; |
| 6355 | } |
| 6356 | }); |
6315 | 6357 | }(jQuery, _)); |