Browse Source

`cards` to `atoms`

pull/14/head
David DeSandro 14 years ago
parent
commit
fb7d7836b4
  1. 33
      src/jquery.molequul.js

33
src/jquery.molequul.js

@ -93,32 +93,31 @@
// ====================== Filtering ====================== // ====================== Filtering ======================
filter : function( $cards ) { filter : function( $atoms ) {
var props = this.data('molequul'), var props = this.data('molequul'),
filter = props.opts.filter === '' ? '*' : props.opts.filter; filter = props.opts.filter === '' ? '*' : props.opts.filter;
if ( !filter ) { if ( !filter ) {
props.atoms.$filtered = $cards; props.atoms.$filtered = $atoms;
} else { } else {
var hiddenClass = props.opts.hiddenClass, var hiddenClass = props.opts.hiddenClass,
hiddenSelector = '.' + hiddenClass, hiddenSelector = '.' + hiddenClass,
$visibleCards = $cards.not( hiddenSelector ), $visibleAtoms = $atoms.not( hiddenSelector ),
$hiddenCards = $cards.filter( hiddenSelector ), $hiddenAtoms = $atoms.filter( hiddenSelector ),
$cardsToShow = $hiddenCards; $atomsToShow = $hiddenAtoms;
props.atoms.$filtered = $cards.filter( filter ); props.atoms.$filtered = $atoms.filter( filter );
if ( filter !== '*' ) { if ( filter !== '*' ) {
$cardsToShow = $hiddenCards.filter( filter ); $atomsToShow = $hiddenAtoms.filter( filter );
var $cardsToHide = $visibleCards.not( filter ).toggleClass( hiddenClass ); var $atomsToHide = $visibleAtoms.not( filter ).toggleClass( hiddenClass );
$cardsToHide.addClass( hiddenClass ); $atomsToHide.addClass( hiddenClass );
props.styleQueue.push({ $el: $cardsToHide, style: props.opts.hiddenStyle }); props.styleQueue.push({ $el: $atomsToHide, style: props.opts.hiddenStyle });
} }
props.styleQueue.push({ $el: $cardsToShow, style: props.opts.visibleStyle }); props.styleQueue.push({ $el: $atomsToShow, style: props.opts.visibleStyle });
$cardsToShow.removeClass( hiddenClass ); $atomsToShow.removeClass( hiddenClass );
// console.log( $cardsToShow.length, $cardsToHide.length )
} }
return this; return this;
@ -142,7 +141,7 @@
return Math.random() > 5 ? 1 : -1; return Math.random() > 5 ? 1 : -1;
}, },
// used on all the filtered cards, $cards.filtered // used on all the filtered atoms, $atoms.filtered
sort : function( props ) { sort : function( props ) {
var sortFn = props.opts.sortBy === 'random' ? $.molequul.randomSortFn : var sortFn = props.opts.sortBy === 'random' ? $.molequul.randomSortFn :
@ -335,8 +334,8 @@
// used on collection of cards (should be filtered, and sorted before ) // used on collection of atoms (should be filtered, and sorted before )
// accepts cards-to-be-laid-out and colYs to start with // accepts atoms-to-be-laid-out and colYs to start with
layout : function( $elems, callback ) { layout : function( $elems, callback ) {
var props = this.data('molequul'), var props = this.data('molequul'),
@ -408,7 +407,7 @@
props.isNew = {}; props.isNew = {};
props.styleQueue = []; props.styleQueue = [];
props.elemCount = 0; props.elemCount = 0;
// need to get cards // need to get atoms
props.atoms.$all = props.opts.selector ? props.atoms.$all = props.opts.selector ?
this.find( props.opts.selector ) : this.find( props.opts.selector ) :
this.children(); this.children();

Loading…
Cancel
Save