From ab20d547d09e81dc5fa9609fa977124ce3086755 Mon Sep 17 00:00:00 2001 From: Faison Zutavern Date: Thu, 22 Mar 2018 18:13:50 -0500 Subject: [PATCH] Dispatch an event with all the filtered Items --- dist/isotope.pkgd.js | 11 ++++++++--- js/isotope.js | 10 ++++++++-- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/dist/isotope.pkgd.js b/dist/isotope.pkgd.js index f409085..399217f 100644 --- a/dist/isotope.pkgd.js +++ b/dist/isotope.pkgd.js @@ -3177,6 +3177,7 @@ var trim = String.prototype.trim ? var matches = []; var hiddenMatched = []; var visibleUnmatched = []; + var results; var test = this._getFilterTest( filter ); @@ -3201,12 +3202,17 @@ var trim = String.prototype.trim ? } } - // return collections of items to be manipulated - return { + results = { matches: matches, needReveal: hiddenMatched, needHide: visibleUnmatched }; + + // allow the filtered items to be modified + this.dispatchEvent( 'itemsFiltered', null, [ results ] ); + + // return collections of items to be manipulated + return results; }; // get a jQuery, function, or a matchesSelector test given the filter @@ -3558,4 +3564,3 @@ var trim = String.prototype.trim ? return Isotope; })); - diff --git a/js/isotope.js b/js/isotope.js index 90f23f3..0947cff 100644 --- a/js/isotope.js +++ b/js/isotope.js @@ -238,6 +238,7 @@ var trim = String.prototype.trim ? var matches = []; var hiddenMatched = []; var visibleUnmatched = []; + var results; var test = this._getFilterTest( filter ); @@ -262,12 +263,17 @@ var trim = String.prototype.trim ? } } - // return collections of items to be manipulated - return { + results = { matches: matches, needReveal: hiddenMatched, needHide: visibleUnmatched }; + + // allow the filtered items to be modified + this.dispatchEvent( 'itemsFiltered', null, [ results ] ); + + // return collections of items to be manipulated + return results; }; // get a jQuery, function, or a matchesSelector test given the filter