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..7893b5e 100644
|
|
|
5248 | 5248 | }); |
5249 | 5249 | |
5250 | 5250 | this.createToolbar(); |
| 5251 | this.toggleSpinner( false ); |
5251 | 5252 | this.updateContent(); |
5252 | 5253 | this.createSidebar(); |
5253 | 5254 | |
5254 | 5255 | this.collection.on( 'add remove reset', this.updateContent, this ); |
5255 | 5256 | }, |
| 5257 | toggleSpinner: function( state ) { |
| 5258 | if ( state ) { |
| 5259 | this.spinnerTimeout = _.delay(function( view ) { |
| 5260 | view.toolbar.get( 'spinner' ).show(); |
| 5261 | }, 600, this ); |
| 5262 | } else { |
| 5263 | this.toolbar.get( 'spinner' ).hide(); |
| 5264 | clearTimeout( this.spinnerTimeout ); |
| 5265 | } |
| 5266 | }, |
5256 | 5267 | /** |
5257 | 5268 | * @returns {wp.media.view.AttachmentsBrowser} Returns itself to allow chaining |
5258 | 5269 | */ |
… |
… |
|
5289 | 5300 | }).render() ); |
5290 | 5301 | } |
5291 | 5302 | |
| 5303 | this.toolbar.set( 'spinner', new media.view.Spinner({ |
| 5304 | priority: -70 |
| 5305 | }) ); |
| 5306 | |
5292 | 5307 | if ( this.options.search ) { |
5293 | 5308 | this.toolbar.set( 'search', new media.view.Search({ |
5294 | 5309 | controller: this.controller, |
… |
… |
|
5313 | 5328 | } |
5314 | 5329 | |
5315 | 5330 | if ( ! this.collection.length ) { |
5316 | | this.collection.more().done( function() { |
| 5331 | this.toggleSpinner( true ); |
| 5332 | this.collection.more().done(function() { |
5317 | 5333 | if ( ! view.collection.length ) { |
5318 | 5334 | view.createUploader(); |
5319 | 5335 | } |
| 5336 | view.toggleSpinner( false ); |
5320 | 5337 | }); |
5321 | 5338 | } |
5322 | 5339 | }, |
… |
… |
|
6312 | 6329 | this.$( '.embed-media-settings' ).scrollTop( 0 ); |
6313 | 6330 | } |
6314 | 6331 | }); |
| 6332 | |
| 6333 | /** |
| 6334 | * wp.media.view.Spinner |
| 6335 | * |
| 6336 | * |
| 6337 | * @constructor |
| 6338 | * @augments wp.media.View |
| 6339 | * @augments wp.Backbone.View |
| 6340 | * @augments Backbone.View |
| 6341 | */ |
| 6342 | media.view.Spinner = media.View.extend({ |
| 6343 | tagName: 'span', |
| 6344 | className: 'spinner', |
| 6345 | |
| 6346 | show: function() { |
| 6347 | this.$el.show(); |
| 6348 | return this; |
| 6349 | }, |
| 6350 | |
| 6351 | hide: function() { |
| 6352 | this.$el.hide(); |
| 6353 | return this; |
| 6354 | } |
| 6355 | }); |
6315 | 6356 | }(jQuery, _)); |