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 19b26d1..358d90b 100644
|
|
|
5237 | 5237 | media.view.AttachmentsBrowser = media.View.extend({ |
5238 | 5238 | tagName: 'div', |
5239 | 5239 | className: 'attachments-browser', |
| 5240 | spinnerTimeout: false, |
5240 | 5241 | |
5241 | 5242 | initialize: function() { |
5242 | 5243 | _.defaults( this.options, { |
… |
… |
|
5248 | 5249 | }); |
5249 | 5250 | |
5250 | 5251 | this.createToolbar(); |
| 5252 | this.toggleSpinner( false ); |
5251 | 5253 | this.updateContent(); |
5252 | 5254 | this.createSidebar(); |
5253 | 5255 | |
5254 | 5256 | this.collection.on( 'add remove reset', this.updateContent, this ); |
5255 | 5257 | }, |
| 5258 | toggleSpinner: function( state ) { |
| 5259 | if ( state ) { |
| 5260 | this.spinnerTimeout = _.delay( function( view ) { |
| 5261 | view.toolbar.get('spinner').show(); |
| 5262 | }, 600, this ); |
| 5263 | } else { |
| 5264 | this.toolbar.get('spinner').hide(); |
| 5265 | clearTimeout( this.spinnerTimeout ); |
| 5266 | } |
| 5267 | }, |
5256 | 5268 | /** |
5257 | 5269 | * @returns {wp.media.view.AttachmentsBrowser} Returns itself to allow chaining |
5258 | 5270 | */ |
… |
… |
|
5289 | 5301 | }).render() ); |
5290 | 5302 | } |
5291 | 5303 | |
| 5304 | this.toolbar.set( 'spinner', new media.view.Spinner({ |
| 5305 | priority: -70 |
| 5306 | }) ); |
| 5307 | |
5292 | 5308 | if ( this.options.search ) { |
5293 | 5309 | this.toolbar.set( 'search', new media.view.Search({ |
5294 | 5310 | controller: this.controller, |
… |
… |
|
5313 | 5329 | } |
5314 | 5330 | |
5315 | 5331 | if ( ! this.collection.length ) { |
| 5332 | this.toggleSpinner( true ); |
5316 | 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 | }, |
… |
… |
|
6326 | 6344 | this.$( '.embed-media-settings' ).scrollTop( 0 ); |
6327 | 6345 | } |
6328 | 6346 | }); |
| 6347 | |
| 6348 | /** |
| 6349 | * wp.media.view.Spinner |
| 6350 | * |
| 6351 | * |
| 6352 | * @constructor |
| 6353 | * @augments wp.media.View |
| 6354 | * @augments wp.Backbone.View |
| 6355 | * @augments Backbone.View |
| 6356 | */ |
| 6357 | media.view.Spinner = media.View.extend({ |
| 6358 | tagName: 'span', |
| 6359 | className: 'spinner', |
| 6360 | |
| 6361 | show: function() { |
| 6362 | this.$el.show(); |
| 6363 | return this; |
| 6364 | }, |
| 6365 | |
| 6366 | hide: function() { |
| 6367 | this.$el.hide(); |
| 6368 | return this; |
| 6369 | } |
| 6370 | }); |
6329 | 6371 | }(jQuery, _)); |