Browse Source

.magic -> .arrange

pull/563/head
David DeSandro 11 years ago
parent
commit
4d10ee57a9
  1. 8
      js/isotope.js
  2. 2
      notes.md
  3. 6
      test/filtering.js
  4. 10
      test/layout-complete.js
  5. 6
      test/sorting.js

8
js/isotope.js

@ -107,7 +107,7 @@ function isotopeDefinition( Outlayer, getSize, matchesSelector, Item, LayoutMode
Isotope.prototype.layout = function() { Isotope.prototype.layout = function() {
// if first time doing layout, do all magic // if first time doing layout, do all magic
if ( !this._isLayoutInited && this.options.isInitLayout ) { if ( !this._isLayoutInited && this.options.isInitLayout ) {
this.magic(); this.arrange();
return; return;
} }
this._layout(); this._layout();
@ -127,7 +127,7 @@ function isotopeDefinition( Outlayer, getSize, matchesSelector, Item, LayoutMode
}; };
// filter + sort + layout // filter + sort + layout
Isotope.prototype.magic = function( opts ) { Isotope.prototype.arrange = function( opts ) {
// set any options pass // set any options pass
this.option( opts ); this.option( opts );
this._getIsInstant(); this._getIsInstant();
@ -136,8 +136,8 @@ function isotopeDefinition( Outlayer, getSize, matchesSelector, Item, LayoutMode
this._sort(); this._sort();
this._layout(); this._layout();
}; };
// alias // alias to _init for main plugin method
Isotope.prototype.filterSortLayout = Isotope.prototype.magic; Isotope.prototype._init = Isotope.prototype.arrange;
// HACK // HACK
// Don't animate/transition first layout // Don't animate/transition first layout

2
notes.md

@ -47,7 +47,7 @@ iso.display({})
Orrrrrr keep .layout() and have reLayout() Orrrrrr keep .layout() and have reLayout()
--- ## Isotope vs Masonry vs Packery
Masonry Isotope Packery Masonry Isotope Packery
Masonry Layouts x x x Masonry Layouts x x x

6
test/filtering.js

@ -35,7 +35,7 @@ test( 'filtering', function() {
equal( ids, '1,2,3,4,5,6,7', 'all items there by default' ); equal( ids, '1,2,3,4,5,6,7', 'all items there by default' );
function checkFilter( filter, expectedIDs, message ) { function checkFilter( filter, expectedIDs, message ) {
iso.magic({ filter: filter }); iso.arrange({ filter: filter });
ids = getFilteredItemIDs( iso ); ids = getFilteredItemIDs( iso );
equal( ids, expectedIDs, message || filter ); equal( ids, expectedIDs, message || filter );
} }
@ -44,7 +44,7 @@ test( 'filtering', function() {
checkFilter( '.tall', '3,4,7' ); checkFilter( '.tall', '3,4,7' );
checkFilter( '.tall.orange', '3,7' ); checkFilter( '.tall.orange', '3,7' );
iso.magic({ iso.arrange({
filter: function( elem ) { filter: function( elem ) {
var num = parseInt( getText( elem ), 10 ); var num = parseInt( getText( elem ), 10 );
return num > 5; return num > 5;
@ -63,7 +63,7 @@ test( 'filtering', function() {
checkFilter( ':not(.orange)', '2,4,5' ); checkFilter( ':not(.orange)', '2,4,5' );
checkFilter( '.orange:not(.tall)', '1,6' ); checkFilter( '.orange:not(.tall)', '1,6' );
iso.magic({ iso.arrange({
filter: function() { filter: function() {
var num = parseInt( $(this).text(), 10 ); var num = parseInt( $(this).text(), 10 );
return num > 5; return num > 5;

10
test/layout-complete.js

@ -14,7 +14,7 @@ test( 'layoutComplete', function() {
next(); next();
}); });
iso.magic({ iso.arrange({
filter: '.a1' filter: '.a1'
}); });
}, },
@ -24,7 +24,7 @@ test( 'layoutComplete', function() {
next(); next();
}); });
iso.magic({ iso.arrange({
filter: '.b2' filter: '.b2'
}); });
}, },
@ -34,7 +34,7 @@ test( 'layoutComplete', function() {
next(); next();
}); });
iso.magic({ iso.arrange({
sortBy: 'random' sortBy: 'random'
}); });
}, },
@ -44,13 +44,13 @@ test( 'layoutComplete', function() {
next(); next();
}); });
iso.magic({ iso.arrange({
filter: '.a2', filter: '.a2',
transitionDuration: '0.6s' transitionDuration: '0.6s'
}); });
setTimeout( function() { setTimeout( function() {
iso.magic({ iso.arrange({
filter: '.b2' filter: '.b2'
}); });
}, 300 ); }, 300 );

6
test/sorting.js

@ -25,7 +25,7 @@ test( 'sorting', function() {
sortBy: 'number' sortBy: 'number'
}); });
iso.magic({ sortBy: 'letter' }); iso.arrange({ sortBy: 'letter' });
var texts = getItemsText( iso ); var texts = getItemsText( iso );
@ -48,12 +48,12 @@ test( 'sorting', function() {
equal( getItemsText( iso ), 'A1,A2,A3,A4,B1,B2,B4', 'sortBy array' ); equal( getItemsText( iso ), 'A1,A2,A3,A4,B1,B2,B4', 'sortBy array' );
iso.magic({ iso.arrange({
sortAscending: false sortAscending: false
}); });
equal( getItemsText( iso ), 'B4,B2,B1,A4,A3,A2,A1', 'sortAscending false' ); equal( getItemsText( iso ), 'B4,B2,B1,A4,A3,A2,A1', 'sortAscending false' );
iso.magic({ iso.arrange({
sortAscending: { sortAscending: {
letter: true, letter: true,
number: false number: false

Loading…
Cancel
Save