Only show the media library loading spinner if we're scrolled toward the bottom. Prevents the spinner from flashing a second time when first loading the library due to a second query firing after initial load.
props kovshenin. fixes #24859. Built from https://develop.svn.wordpress.org/trunk@28019 git-svn-id: http://core.svn.wordpress.org/trunk@27849 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
960a45a9cb
commit
df49618d0e
|
@ -4888,17 +4888,19 @@
|
|||
|
||||
scroll: function() {
|
||||
var view = this,
|
||||
toolbar;
|
||||
toolbar = this.views.parent.toolbar;
|
||||
|
||||
// @todo: is this still necessary?
|
||||
if ( ! this.$el.is(':visible') ) {
|
||||
// @todo: is :visible still necessary?
|
||||
if ( ! this.$el.is(':visible') || ! this.collection.hasMore() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( this.collection.hasMore() && this.el.scrollHeight < this.el.scrollTop + ( this.el.clientHeight * this.options.refreshThreshold ) ) {
|
||||
toolbar = this.views.parent.toolbar;
|
||||
// Show the spinner only if we are close to the bottom.
|
||||
if ( this.el.scrollHeight - ( this.el.scrollTop + this.el.clientHeight ) < this.el.clientHeight / 3 ) {
|
||||
toolbar.get('spinner').show();
|
||||
}
|
||||
|
||||
if ( this.el.scrollHeight < this.el.scrollTop + ( this.el.clientHeight * this.options.refreshThreshold ) ) {
|
||||
this.collection.more().done(function() {
|
||||
view.scroll();
|
||||
toolbar.get('spinner').hide();
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue