Browse Source

src : refactor _filter

pull/96/head
David DeSandro 14 years ago
parent
commit
1ad9cce8e1
  1. 18
      jquery.isotope.js
  2. 2
      jquery.isotope.min.js

18
jquery.isotope.js

@ -493,33 +493,27 @@
// ====================== Filtering ====================== // ====================== Filtering ======================
_filter : function( $atoms ) { _filter : function( $atoms ) {
var $filteredAtoms, var filter = this.options.filter === '' ? '*' : this.options.filter;
filter = this.options.filter === '' ? '*' : this.options.filter;
if ( !filter ) { if ( !filter ) {
$filteredAtoms = $atoms; return $atoms;
} else { }
var hiddenClass = this.options.hiddenClass, var hiddenClass = this.options.hiddenClass,
hiddenSelector = '.' + hiddenClass, hiddenSelector = '.' + hiddenClass,
$visibleAtoms = $atoms.not( hiddenSelector ),
$hiddenAtoms = $atoms.filter( hiddenSelector ), $hiddenAtoms = $atoms.filter( hiddenSelector ),
$atomsToShow = $hiddenAtoms; $atomsToShow = $hiddenAtoms;
$filteredAtoms = $atoms.filter( filter );
if ( filter !== '*' ) { if ( filter !== '*' ) {
$atomsToShow = $hiddenAtoms.filter( filter ); $atomsToShow = $hiddenAtoms.filter( filter );
var $atomsToHide = $atoms.not( hiddenSelector ).not( filter ).addClass( hiddenClass );
var $atomsToHide = $visibleAtoms.not( filter ).toggleClass( hiddenClass );
$atomsToHide.addClass( hiddenClass );
this.styleQueue.push({ $el: $atomsToHide, style: this.options.hiddenStyle }); this.styleQueue.push({ $el: $atomsToHide, style: this.options.hiddenStyle });
} }
this.styleQueue.push({ $el: $atomsToShow, style: this.options.visibleStyle }); this.styleQueue.push({ $el: $atomsToShow, style: this.options.visibleStyle });
$atomsToShow.removeClass( hiddenClass ); $atomsToShow.removeClass( hiddenClass );
}
return $filteredAtoms; return $atoms.filter( filter );
}, },
// ====================== Sorting ====================== // ====================== Sorting ======================

2
jquery.isotope.min.js vendored

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save