Browse Source

use only `add` method

pull/14/head
David DeSandro 15 years ago
parent
commit
e31c0b7c0f
  1. 31
      src/jquery.molequul.js

31
src/jquery.molequul.js

@ -67,35 +67,28 @@
return this.molequul( 'addSortData', props ).css( atomStyle ); return this.molequul( 'addSortData', props ).css( atomStyle );
}, },
getAtoms : function( props ) { // ====================== Convenience methods ======================
return props.opts.selector ? this.filter( props.opts.selector ) : this;
},
// adds a jQuery object of items to a molequul container // adds a jQuery object of items to a molequul container
addTo : function( $molecule ) { add : function( $content ) {
var props = $molecule.data('molequul'), var props = this.data('molequul'),
$newAtoms = props.opts.selector ? this.filter( props.opts.selector ) : this; $newAtoms = props.opts.selector ? $content.filter( props.opts.selector ) : $content;
$newAtoms.molequul( 'setupAtoms', props ) $newAtoms.molequul( 'setupAtoms', props )
// console.log( $newAtoms ) // add new atoms to atoms pools
props.atoms.$all = props.atoms.$all.add( $newAtoms ); props.atoms.$all = props.atoms.$all.add( $newAtoms );
props.atoms.$filtered = props.atoms.$filtered.add( $newAtoms ); props.atoms.$filtered = props.atoms.$filtered.add( $newAtoms );
props.appending = true; props.appending = true;
// $molecule.data( 'molequul', props );
// console.log( prevLen, props.atoms.$all.length )
return $newAtoms;
},
add : function( $content ) {
$content.molequul( 'addTo', this );
return this; return this;
}, },
// convienence method for adding elements properly to any layout
insert : function( $content ) { insert : function( $content ) {
// console.log('appedning') return this.append( $content ).molequul( 'add', $content ).molequul('init');
this.append( $content ); },
$content.molequul( 'addTo', this );
// console.log( this ); // convienence method for working with Infinite Scroll
return this.molequul('init'); appended : function( $content ) {
return this.molequul( 'add', $content ).molequul( 'layout', $content );
}, },
// ====================== Filtering ====================== // ====================== Filtering ======================

Loading…
Cancel
Save