diff --git a/src/wp-includes/js/media-views.js b/src/wp-includes/js/media-views.js
index e0d181c..ad1f5df 100644
a
|
b
|
|
5103 | 5103 | }, |
5104 | 5104 | |
5105 | 5105 | scroll: function() { |
| 5106 | var view = this, |
| 5107 | toolbar; |
| 5108 | |
5106 | 5109 | // @todo: is this still necessary? |
5107 | 5110 | if ( ! this.$el.is(':visible') ) { |
5108 | 5111 | return; |
5109 | 5112 | } |
5110 | 5113 | |
5111 | 5114 | if ( this.collection.hasMore() && this.el.scrollHeight < this.el.scrollTop + ( this.el.clientHeight * this.options.refreshThreshold ) ) { |
5112 | | this.collection.more().done( this.scroll ); |
| 5115 | toolbar = this.views.parent.toolbar; |
| 5116 | toolbar.get('spinner').show(); |
| 5117 | |
| 5118 | this.collection.more().done(function() { |
| 5119 | view.scroll(); |
| 5120 | toolbar.get('spinner').hide(); |
| 5121 | }); |
5113 | 5122 | } |
5114 | 5123 | } |
5115 | 5124 | }, { |
… |
… |
|
5349 | 5358 | |
5350 | 5359 | this.collection.on( 'add remove reset', this.updateContent, this ); |
5351 | 5360 | }, |
5352 | | toggleSpinner: function( state ) { |
5353 | | if ( state ) { |
5354 | | this.spinnerTimeout = _.delay(function( view ) { |
5355 | | view.toolbar.get( 'spinner' ).show(); |
5356 | | }, 600, this ); |
5357 | | } else { |
5358 | | this.toolbar.get( 'spinner' ).hide(); |
5359 | | clearTimeout( this.spinnerTimeout ); |
5360 | | } |
5361 | | }, |
5362 | 5361 | /** |
5363 | 5362 | * @returns {wp.media.view.AttachmentsBrowser} Returns itself to allow chaining |
5364 | 5363 | */ |
… |
… |
|
5423 | 5422 | } |
5424 | 5423 | |
5425 | 5424 | if ( ! this.collection.length ) { |
5426 | | this.toggleSpinner( true ); |
| 5425 | this.toolbar.get( 'spinner' ).show(); |
5427 | 5426 | this.collection.more().done(function() { |
5428 | 5427 | if ( ! view.collection.length ) { |
5429 | 5428 | view.createUploader(); |
5430 | 5429 | } |
5431 | | view.toggleSpinner( false ); |
| 5430 | view.toolbar.get( 'spinner' ).hide(); |
5432 | 5431 | }); |
5433 | 5432 | } |
5434 | 5433 | }, |
… |
… |
|
6615 | 6614 | media.view.Spinner = media.View.extend({ |
6616 | 6615 | tagName: 'span', |
6617 | 6616 | className: 'spinner', |
| 6617 | spinnerTimeout: false, |
| 6618 | delay: 300, |
6618 | 6619 | |
6619 | 6620 | show: function() { |
6620 | | this.$el.show(); |
| 6621 | if ( ! this.spinnerTimeout ) { |
| 6622 | this.spinnerTimeout = _.delay(function( $el ) { |
| 6623 | $el.show(); |
| 6624 | }, this.delay, this.$el ); |
| 6625 | } |
| 6626 | |
6621 | 6627 | return this; |
6622 | 6628 | }, |
6623 | 6629 | |
6624 | 6630 | hide: function() { |
6625 | 6631 | this.$el.hide(); |
| 6632 | this.spinnerTimeout = clearTimeout( this.spinnerTimeout ); |
| 6633 | |
6626 | 6634 | return this; |
6627 | 6635 | } |
6628 | 6636 | }); |