11/*!
2- * Isotope PACKAGED v2.1.0
2+ * Isotope PACKAGED v2.1.1
33 * Filter & sort magical layouts
44 * http://isotope.metafizzy.co
55 */
@@ -3399,7 +3399,7 @@ if ( typeof define === 'function' && define.amd ) {
33993399} ) ( window ) ;
34003400
34013401/*!
3402- * Isotope v2.1.0
3402+ * Isotope v2.1.1
34033403 * Filter & sort magical layouts
34043404 * http://isotope.metafizzy.co
34053405 */
@@ -3577,7 +3577,23 @@ function isotopeDefinition( Outlayer, getSize, matchesSelector, Item, LayoutMode
35773577 this . option ( opts ) ;
35783578 this . _getIsInstant ( ) ;
35793579 // filter, sort, and layout
3580- this . filteredItems = this . _filter ( this . items ) ;
3580+
3581+ // filter
3582+ var filtered = this . _filter ( this . items ) ;
3583+ this . filteredItems = filtered . matches ;
3584+
3585+ var _this = this ;
3586+ function hideReveal ( ) {
3587+ _this . reveal ( filtered . needReveal ) ;
3588+ _this . hide ( filtered . needHide ) ;
3589+ }
3590+
3591+ if ( this . _isInstant ) {
3592+ this . _noTransition ( hideReveal ) ;
3593+ } else {
3594+ hideReveal ( ) ;
3595+ }
3596+
35813597 this . _sort ( ) ;
35823598 this . _layout ( ) ;
35833599 } ;
@@ -3626,19 +3642,12 @@ function isotopeDefinition( Outlayer, getSize, matchesSelector, Item, LayoutMode
36263642 }
36273643 }
36283644
3629- var _this = this ;
3630- function hideReveal ( ) {
3631- _this . reveal ( hiddenMatched ) ;
3632- _this . hide ( visibleUnmatched ) ;
3633- }
3634-
3635- if ( this . _isInstant ) {
3636- this . _noTransition ( hideReveal ) ;
3637- } else {
3638- hideReveal ( ) ;
3639- }
3640-
3641- return matches ;
3645+ // return collections of items to be manipulated
3646+ return {
3647+ matches : matches ,
3648+ needReveal : hiddenMatched ,
3649+ needHide : visibleUnmatched
3650+ } ;
36423651 } ;
36433652
36443653 // get a jQuery, function, or a matchesSelector test given the filter
@@ -3856,6 +3865,7 @@ function isotopeDefinition( Outlayer, getSize, matchesSelector, Item, LayoutMode
38563865 if ( ! items . length ) {
38573866 return ;
38583867 }
3868+ // filter, layout, reveal new items
38593869 var filteredItems = this . _filterRevealAdded ( items ) ;
38603870 // add to filteredItems
38613871 this . filteredItems = this . filteredItems . concat ( filteredItems ) ;
@@ -3867,28 +3877,26 @@ function isotopeDefinition( Outlayer, getSize, matchesSelector, Item, LayoutMode
38673877 if ( ! items . length ) {
38683878 return ;
38693879 }
3870- // add items to beginning of collection
3871- var previousItems = this . items . slice ( 0 ) ;
3872- this . items = items . concat ( previousItems ) ;
38733880 // start new layout
38743881 this . _resetLayout ( ) ;
38753882 this . _manageStamps ( ) ;
3876- // layout new stuff without transition
3883+ // filter, layout, reveal new items
38773884 var filteredItems = this . _filterRevealAdded ( items ) ;
38783885 // layout previous items
3879- this . layoutItems ( previousItems ) ;
3880- // add to filteredItems
3886+ this . layoutItems ( this . filteredItems ) ;
3887+ // add to items and filteredItems
38813888 this . filteredItems = filteredItems . concat ( this . filteredItems ) ;
3889+ this . items = items . concat ( this . items ) ;
38823890 } ;
38833891
38843892 Isotope . prototype . _filterRevealAdded = function ( items ) {
3885- var filteredItems = this . _noTransition ( function ( ) {
3886- return this . _filter ( items ) ;
3887- } ) ;
3888- // layout and reveal just the new items
3889- this . layoutItems ( filteredItems , true ) ;
3890- this . reveal ( filteredItems ) ;
3891- return items ;
3893+ var filtered = this . _filter ( items ) ;
3894+ this . hide ( filtered . needHide ) ;
3895+ // reveal all new items
3896+ this . reveal ( filtered . matches ) ;
3897+ // layout new items, no transition
3898+ this . layoutItems ( filtered . matches , true ) ;
3899+ return filtered . matches ;
38923900 } ;
38933901
38943902 /**
@@ -3908,24 +3916,7 @@ function isotopeDefinition( Outlayer, getSize, matchesSelector, Item, LayoutMode
39083916 this . element . appendChild ( item . element ) ;
39093917 }
39103918 // filter new stuff
3911- /*
3912- // this way adds hides new filtered items with NO transition
3913- // so user can't see if new hidden items have been inserted
3914- var filteredInsertItems;
3915- this._noTransition( function() {
3916- filteredInsertItems = this._filter( items );
3917- // hide all new items
3918- this.hide( filteredInsertItems );
3919- });
3920- // */
3921- // this way hides new filtered items with transition
3922- // so user at least sees that something has been added
3923- var filteredInsertItems = this . _filter ( items ) ;
3924- // hide all newitems
3925- this . _noTransition ( function ( ) {
3926- this . hide ( filteredInsertItems ) ;
3927- } ) ;
3928- // */
3919+ var filteredInsertItems = this . _filter ( items ) . matches ;
39293920 // set flag
39303921 for ( i = 0 ; i < len ; i ++ ) {
39313922 items [ i ] . isLayoutInstant = true ;
0 commit comments