Browse Source

src : remove instance in _sort. Thx @sroucheray

pull/51/merge
David DeSandro 14 years ago
parent
commit
280fe96995
  1. 2
      jquery.isotope.js
  2. 2
      jquery.isotope.min.js

2
jquery.isotope.js

@ -543,7 +543,7 @@
var a = getSorter( alpha, sortBy ),
b = getSorter( beta, sortBy );
// fall back to original order if data matches
if ( a === b && instance.options.sortBy !== 'original-order') {
if ( a === b && sortBy !== 'original-order') {
a = getSorter( alpha, 'original-order' );
b = getSorter( beta, 'original-order' );
}

2
jquery.isotope.min.js vendored

@ -19,7 +19,7 @@ this.options.itemSelector);a=this.element[0].style;this.originalStyle={};for(var
this.options.transformsEnabled&&Modernizr.csstransforms&&Modernizr.csstransitions&&!a)?this._translate:this._positionAbs;this.options.getSortData=f.extend(this.options.getSortData,{"original-order":function(g,h){return h.elemCount}});this._setupAtoms(this.$allAtoms);a=f(document.createElement("div"));this.element.prepend(a);this.posTop=Math.round(a.position().top);this.posLeft=Math.round(a.position().left);a.remove();var e=this;setTimeout(function(){e.element.addClass(e.options.containerClass)},0);
this.options.resizable&&f(k).bind("smartresize.isotope",function(){e.element.isotope("resize")})},_init:function(a){this.$filteredAtoms=this._filter(this.$allAtoms);this._sort();this.reLayout(a)},option:function(a,b){if(f.isPlainObject(a))this.options=f.extend(true,this.options,a);else if(a&&typeof b==="undefined")return this.options[a];else this.options[a]=b;return this},_setupAtoms:function(a){var b={position:"absolute"};if(this.usingTransforms){b.left=0;b.top=0}a.css(b).addClass(this.options.itemClass);
this.updateSortData(a,true)},_filter:function(a){var b=this.options.filter===""?"*":this.options.filter;if(b){var c=this.options.hiddenClass,d="."+c,e=a.not(d),g=a.filter(d);d=g;a=a.filter(b);if(b!=="*"){d=g.filter(b);b=e.not(b).toggleClass(c);b.addClass(c);this.styleQueue.push({$el:b,style:this.options.hiddenStyle})}this.styleQueue.push({$el:d,style:this.options.visibleStyle});d.removeClass(c)}return a},updateSortData:function(a,b){var c=this,d=this.options.getSortData,e,g;a.each(function(){e=f(this);
g={};for(var h in d)g[h]=d[h](e,c);e.data("isotope-sort-data",g);b&&c.elemCount++})},_sort:function(){var a=this.options.sortBy,b=this._getSorter,c=this.options.sortAscending?1:-1;this.$filteredAtoms.sort(function(d,e){var g=b(d,a),h=b(e,a);if(g===h&&instance.options.sortBy!=="original-order"){g=b(d,"original-order");h=b(e,"original-order")}return(g>h?1:g<h?-1:0)*c});return this},_getSorter:function(a,b){return f(a).data("isotope-sort-data")[b]},_translate:function(a,b){return{translate:[a,b]}},_positionAbs:function(a,
g={};for(var h in d)g[h]=d[h](e,c);e.data("isotope-sort-data",g);b&&c.elemCount++})},_sort:function(){var a=this.options.sortBy,b=this._getSorter,c=this.options.sortAscending?1:-1;this.$filteredAtoms.sort(function(d,e){var g=b(d,a),h=b(e,a);if(g===h&&a!=="original-order"){g=b(d,"original-order");h=b(e,"original-order")}return(g>h?1:g<h?-1:0)*c});return this},_getSorter:function(a,b){return f(a).data("isotope-sort-data")[b]},_translate:function(a,b){return{translate:[a,b]}},_positionAbs:function(a,
b){return{left:a,top:b}},_pushPosition:function(a,b,c){var d=this.getPositionStyles(b,c);this.styleQueue.push({$el:a,style:d});this.options.itemPositionDataEnabled&&a.data("isotope-item-position",{x:b,y:c})},layout:function(a,b){var c=this.options.layoutMode;this["_"+c+"Layout"](a);this.options.resizesContainer&&this.styleQueue.push({$el:this.element,style:this["_"+c+"GetContainerSize"]()});var d=this.applyStyleFnName==="animate"&&!this.isLaidOut?"css":this.applyStyleFnName,e=this.options.animationOptions;
f.each(this.styleQueue,function(g,h){h.$el[d](h.style,e)});this.styleQueue=[];b&&b.call(a);this.isLaidOut=true;return this},resize:function(){return this["_"+this.options.layoutMode+"Resize"]()},reLayout:function(a){return this["_"+this.options.layoutMode+"Reset"]().layout(this.$filteredAtoms,a)},addItems:function(a,b){var c=this._filterFind(a,this.options.itemSelector);this._setupAtoms(c);this.$allAtoms=this.$allAtoms.add(c);b&&b(c)},insert:function(a,b){this.element.append(a);var c=this;this.addItems(a,
function(d){d=c._filter(d);c.$filteredAtoms=c.$filteredAtoms.add(d)});this._sort().reLayout(b)},appended:function(a,b){var c=this;this.addItems(a,function(d){c.$filteredAtoms=c.$filteredAtoms.add(d);c.layout(d,b)})},remove:function(a){this.$allAtoms=this.$allAtoms.not(a);this.$filteredAtoms=this.$filteredAtoms.not(a);a.remove()},_shuffleArray:function(a){var b,c,d=a.length;if(d)for(;--d;){c=~~(Math.random()*(d+1));b=a[c];a[c]=a[d];a[d]=b}return a},shuffle:function(a){this.options.sortBy="shuffle";

Loading…
Cancel
Save