diff --git a/src/wp-includes/js/media-views.js b/src/wp-includes/js/media-views.js
index 76f689b..8b41933 100644
a
|
b
|
|
5115 | 5115 | }, |
5116 | 5116 | |
5117 | 5117 | scroll: function() { |
| 5118 | var view = this, |
| 5119 | toolbar; |
| 5120 | |
5118 | 5121 | // @todo: is this still necessary? |
5119 | 5122 | if ( ! this.$el.is(':visible') ) { |
5120 | 5123 | return; |
5121 | 5124 | } |
5122 | 5125 | |
5123 | 5126 | if ( this.collection.hasMore() && this.el.scrollHeight < this.el.scrollTop + ( this.el.clientHeight * this.options.refreshThreshold ) ) { |
5124 | | this.collection.more().done( this.scroll ); |
| 5127 | toolbar = this.views.parent.toolbar; |
| 5128 | toolbar.get('spinner').show(); |
| 5129 | |
| 5130 | this.collection.more().done(function() { |
| 5131 | view.scroll(); |
| 5132 | toolbar.get('spinner').hide(); |
| 5133 | }); |
5125 | 5134 | } |
5126 | 5135 | } |
5127 | 5136 | }, { |
… |
… |
|
5361 | 5370 | |
5362 | 5371 | this.collection.on( 'add remove reset', this.updateContent, this ); |
5363 | 5372 | }, |
5364 | | toggleSpinner: function( state ) { |
5365 | | if ( state ) { |
5366 | | this.spinnerTimeout = _.delay(function( view ) { |
5367 | | view.toolbar.get( 'spinner' ).show(); |
5368 | | }, 600, this ); |
5369 | | } else { |
5370 | | this.toolbar.get( 'spinner' ).hide(); |
5371 | | clearTimeout( this.spinnerTimeout ); |
5372 | | } |
5373 | | }, |
5374 | 5373 | /** |
5375 | 5374 | * @returns {wp.media.view.AttachmentsBrowser} Returns itself to allow chaining |
5376 | 5375 | */ |
… |
… |
|
5435 | 5434 | } |
5436 | 5435 | |
5437 | 5436 | if ( ! this.collection.length ) { |
5438 | | this.toggleSpinner( true ); |
| 5437 | this.toolbar.get( 'spinner' ).show(); |
5439 | 5438 | this.collection.more().done(function() { |
5440 | 5439 | if ( ! view.collection.length ) { |
5441 | 5440 | view.createUploader(); |
5442 | 5441 | } |
5443 | | view.toggleSpinner( false ); |
| 5442 | view.toolbar.get( 'spinner' ).hide(); |
5444 | 5443 | }); |
5445 | 5444 | } |
5446 | 5445 | }, |
… |
… |
|
6579 | 6578 | className: 'spinner', |
6580 | 6579 | |
6581 | 6580 | show: function() { |
6582 | | this.$el.show(); |
| 6581 | this.spinnerTimeout = _.delay(function( $el ) { |
| 6582 | $el.show(); |
| 6583 | }, 300, this.$el ); |
| 6584 | |
6583 | 6585 | return this; |
6584 | 6586 | }, |
6585 | 6587 | |
6586 | 6588 | hide: function() { |
6587 | 6589 | this.$el.hide(); |
| 6590 | clearTimeout( this.spinnerTimeout ); |
| 6591 | |
6588 | 6592 | return this; |
6589 | 6593 | } |
6590 | 6594 | }); |