Changeset 22956
- Timestamp:
- 11/30/2012 04:41:38 PM (12 years ago)
- Location:
- trunk/wp-includes/js
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/js/media-models.js
r22952 r22956 491 491 492 492 more: function( options ) { 493 if ( this.mirroring && this.mirroring.more ) 494 return this.mirroring.more( options ); 495 return $.Deferred().resolve().promise(); 493 var deferred = $.Deferred(), 494 mirroring = this.mirroring, 495 attachments = this; 496 497 if ( ! mirroring || ! mirroring.more ) 498 return deferred.resolveWith( this ).promise(); 499 500 // If we're mirroring another collection, forward `more` to 501 // the mirrored collection. Account for a race condition by 502 // checking if we're still mirroring that collection when 503 // the request resolves. 504 mirroring.more( options ).done( function() { 505 if ( this === attachments.mirroring ) 506 deferred.resolveWith( this ); 507 }); 508 509 return deferred.promise(); 510 }, 511 512 hasMore: function() { 513 return this.mirroring ? this.mirroring.hasMore() : false; 496 514 }, 497 515 … … 584 602 Attachments.prototype.initialize.apply( this, arguments ); 585 603 586 this.args = options.args;587 this. hasMore = true;588 this.created = new Date();604 this.args = options.args; 605 this._hasMore = true; 606 this.created = new Date(); 589 607 590 608 this.filters.order = function( attachment ) { … … 628 646 }, 629 647 648 hasMore: function() { 649 return this._hasMore; 650 }, 651 630 652 more: function( options ) { 631 653 var query = this; … … 634 656 return this._more; 635 657 636 if ( ! this.hasMore )637 return $.Deferred().resolve ().promise();658 if ( ! this.hasMore() ) 659 return $.Deferred().resolveWith( this ).promise(); 638 660 639 661 options = options || {}; … … 642 664 return this._more = this.fetch( options ).done( function( resp ) { 643 665 if ( _.isEmpty( resp ) || -1 === this.args.posts_per_page || resp.length < this.args.posts_per_page ) 644 query. hasMore = false;666 query._hasMore = false; 645 667 }); 646 668 }, -
trunk/wp-includes/js/media-views.js
r22952 r22956 2822 2822 return; 2823 2823 2824 if ( this. el.scrollHeight < this.el.scrollTop + ( this.el.clientHeight * this.options.refreshThreshold ) ) {2824 if ( this.collection.hasMore() && this.el.scrollHeight < this.el.scrollTop + ( this.el.clientHeight * this.options.refreshThreshold ) ) { 2825 2825 this.collection.more().done( this.scroll ); 2826 2826 }
Note: See TracChangeset
for help on using the changeset viewer.