Make WordPress Core

Changeset 28019


Ignore:
Timestamp:
04/07/2014 10:14:01 PM (10 years ago)
Author:
helen
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/js/media-views.js

    r27946 r28019  
    48894889        scroll: function() {
    48904890            var view = this,
    4891                 toolbar;
    4892 
    4893             // @todo: is this still necessary?
    4894             if ( ! this.$el.is(':visible') ) {
     4891                toolbar = this.views.parent.toolbar;
     4892
     4893            // @todo: is :visible still necessary?
     4894            if ( ! this.$el.is(':visible') || ! this.collection.hasMore() ) {
    48954895                return;
    48964896            }
    48974897
    4898             if ( this.collection.hasMore() && this.el.scrollHeight < this.el.scrollTop + ( this.el.clientHeight * this.options.refreshThreshold ) ) {
    4899                 toolbar = this.views.parent.toolbar;
     4898            // Show the spinner only if we are close to the bottom.
     4899            if ( this.el.scrollHeight - ( this.el.scrollTop + this.el.clientHeight ) < this.el.clientHeight / 3 ) {
    49004900                toolbar.get('spinner').show();
    4901 
     4901            }
     4902
     4903            if ( this.el.scrollHeight < this.el.scrollTop + ( this.el.clientHeight * this.options.refreshThreshold ) ) {
    49024904                this.collection.more().done(function() {
    49034905                    view.scroll();
Note: See TracChangeset for help on using the changeset viewer.