Changeset 22993
- Timestamp:
- 12/03/2012 07:04:34 AM (13 years ago)
- File:
-
- 1 edited
-
trunk/wp-includes/js/media-views.js (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/js/media-views.js
r22991 r22993 576 576 577 577 initialize: function() { 578 var library, comparator; 579 578 580 // If we haven't been provided a `library`, create a `Selection`. 579 581 if ( ! this.get('library') ) … … 581 583 582 584 media.controller.Library.prototype.initialize.apply( this, arguments ); 585 586 library = this.get('library'); 587 comparator = library.comparator; 588 589 // Overload the library's comparator to push items that are not in 590 // the mirrored query to the front of the aggregate collection. 591 library.comparator = function( a, b ) { 592 var aInQuery = !! this.mirroring.getByCid( a.cid ), 593 bInQuery = !! this.mirroring.getByCid( b.cid ); 594 595 if ( ! aInQuery && bInQuery ) 596 return -1; 597 else if ( aInQuery && ! bInQuery ) 598 return 1; 599 else 600 return comparator.apply( this, arguments ); 601 }; 602 603 // Add all items in the selection to the library, so any featured 604 // images that are not initially loaded still appear. 605 library.observe( this.get('selection') ); 583 606 }, 584 607
Note: See TracChangeset
for help on using the changeset viewer.