Ticket #22656: 22656.diff
File 22656.diff, 2.9 KB (added by , 12 years ago) |
---|
-
wp-includes/js/media-models.js
490 490 }, 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(); 496 510 }, 497 511 512 hasMore: function() { 513 return this.mirroring ? this.mirroring.hasMore() : false; 514 }, 515 498 516 parse: function( resp, xhr ) { 499 517 return _.map( resp, function( attrs ) { 500 518 var attachment = Attachment.get( attrs.id ); … … 583 601 options = options || {}; 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 ) { 591 609 var orderby = this.props.get('orderby'), … … 627 645 this.observe( wp.Uploader.queue ); 628 646 }, 629 647 648 hasMore: function() { 649 return this._hasMore; 650 }, 651 630 652 more: function( options ) { 631 653 var query = this; 632 654 633 655 if ( this._more && 'pending' === this._more.state() ) 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 || {}; 640 662 options.add = true; 641 663 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 }, 647 669 -
wp-includes/js/media-views.js
2821 2821 if ( ! this.$el.is(':visible') ) 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 } 2827 2827 }