|
|
@ -40,62 +40,11 @@ category: tests |
|
|
|
<script src="../{{ site.isotope_js }}"></script> |
|
|
|
<script src="../{{ site.isotope_js }}"></script> |
|
|
|
<script src="../js/fake-element.js"></script> |
|
|
|
<script src="../js/fake-element.js"></script> |
|
|
|
<script> |
|
|
|
<script> |
|
|
|
|
|
|
|
$(function(){ |
|
|
|
|
|
|
|
|
|
|
|
var $container = $('#container'); |
|
|
|
var $container = $('#container'); |
|
|
|
|
|
|
|
|
|
|
|
$('#filters').find('a').click(function(){ |
|
|
|
{% include random-sizes.js %} |
|
|
|
console.time('filter'); |
|
|
|
|
|
|
|
// get href attribute, minus the #, plus a . to make it a class |
|
|
|
|
|
|
|
var filterName = '.' + $(this).attr('href').slice(1); |
|
|
|
|
|
|
|
filterName = filterName === '.show-all' ? '*' : filterName; |
|
|
|
|
|
|
|
$container.isotope({ filter: filterName }) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
console.timeEnd('filter'); |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// sorting |
|
|
|
|
|
|
|
$('#sort a').click(function(){ |
|
|
|
|
|
|
|
console.time('sort'); |
|
|
|
|
|
|
|
// get href attribute, minus the # |
|
|
|
|
|
|
|
var $this = $(this), |
|
|
|
|
|
|
|
sortName = $this.attr('href').slice(1), |
|
|
|
|
|
|
|
asc = $this.parents('.sort').hasClass('asc'); |
|
|
|
|
|
|
|
$container.isotope({ |
|
|
|
|
|
|
|
sortBy : sortName, |
|
|
|
|
|
|
|
sortAscending : asc |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
console.timeEnd('sort'); |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// change size of clicked element |
|
|
|
|
|
|
|
$container.find('.element').live('click', function(){ |
|
|
|
|
|
|
|
$(this).toggleClass('large'); |
|
|
|
|
|
|
|
$container.isotope('reLayout'); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// toggle variable sizes of all elements |
|
|
|
|
|
|
|
$('#toggle-sizes').find('a').click(function(){ |
|
|
|
|
|
|
|
$container |
|
|
|
|
|
|
|
.toggleClass('variable-sizes') |
|
|
|
|
|
|
|
.isotope('reLayout'); |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{% include layout-change.js %} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{% include add-buttons.js %} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$('#shuffle a').click(function(){ |
|
|
|
|
|
|
|
$container.isotope('shuffle'); |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{% include option-buttons.js %} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$(function(){ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
console.time('init'); |
|
|
|
console.time('init'); |
|
|
|
$container.isotope({ |
|
|
|
$container.isotope({ |
|
|
@ -138,6 +87,67 @@ category: tests |
|
|
|
|
|
|
|
|
|
|
|
console.timeEnd('init'); |
|
|
|
console.timeEnd('init'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var $optionSets = $('#options .option-set'), |
|
|
|
|
|
|
|
$optionLinks = $optionSets.find('a'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$optionLinks.click(function(){ |
|
|
|
|
|
|
|
var $this = $(this); |
|
|
|
|
|
|
|
// don't proceed if already selected |
|
|
|
|
|
|
|
if ( $this.hasClass('selected') ) { |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
var $optionSet = $this.parents('.option-set'); |
|
|
|
|
|
|
|
$optionSet.find('.selected').removeClass('selected'); |
|
|
|
|
|
|
|
$this.addClass('selected'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// make option object dynamically, i.e. { filter: '.my-filter-class' } |
|
|
|
|
|
|
|
var options = {}, |
|
|
|
|
|
|
|
key = $optionSet.attr('data-option-key'), |
|
|
|
|
|
|
|
value = $this.attr('data-option-value'); |
|
|
|
|
|
|
|
// parse 'false' as false boolean |
|
|
|
|
|
|
|
value = value === 'false' ? false : value; |
|
|
|
|
|
|
|
options[ key ] = value; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
console.time( key ); |
|
|
|
|
|
|
|
if ( key === 'layoutMode' && changeLayoutMode ) { |
|
|
|
|
|
|
|
// changes in layout modes need extra logic |
|
|
|
|
|
|
|
changeLayoutMode( $this, options ) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
// otherwise, apply new options |
|
|
|
|
|
|
|
$container.isotope( options ); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
console.timeEnd( key ); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{% include layout-change.js %} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// change size of clicked element |
|
|
|
|
|
|
|
$container.find('.element').live('click', function(){ |
|
|
|
|
|
|
|
$(this).toggleClass('large'); |
|
|
|
|
|
|
|
$container.isotope('reLayout'); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// toggle variable sizes of all elements |
|
|
|
|
|
|
|
$('#toggle-sizes').find('a').click(function(){ |
|
|
|
|
|
|
|
$container |
|
|
|
|
|
|
|
.toggleClass('variable-sizes') |
|
|
|
|
|
|
|
.isotope('reLayout'); |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{% include add-buttons.js %} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$('#shuffle a').click(function(){ |
|
|
|
|
|
|
|
$container.isotope('shuffle'); |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{% include option-buttons.js %} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
</script> |
|
|
|
</script> |
|
|
|