From 09bddb7b29e80b007ffded7fc1e8dd6caef0637d Mon Sep 17 00:00:00 2001 From: David DeSandro Date: Mon, 7 Feb 2011 22:08:45 -0500 Subject: [PATCH 01/15] docs : use `parseFloat` for weight sorting data. Resolves #5 --- _layouts/elements.html | 2 +- _posts/demos/2010-12-30-sorting.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/_layouts/elements.html b/_layouts/elements.html index f49d670..0e7d3fe 100644 --- a/_layouts/elements.html +++ b/_layouts/elements.html @@ -97,7 +97,7 @@ return parseInt( $elem.find('.number').text(), 10 ); }, weight : function( $elem ) { - return parseInt( $elem.find('.weight').text().replace( /[\(\)]/g, ''), 10 ); + return parseFloat( $elem.find('.weight').text().replace( /[\(\)]/g, '') ); }, name : function ( $elem ) { return $elem.find('.name').text(); diff --git a/_posts/demos/2010-12-30-sorting.html b/_posts/demos/2010-12-30-sorting.html index 16926bc..3e14a3e 100644 --- a/_posts/demos/2010-12-30-sorting.html +++ b/_posts/demos/2010-12-30-sorting.html @@ -44,7 +44,7 @@ related: sorting return parseInt( $elem.find('.number').text(), 10 ); }, weight : function( $elem ) { - return parseInt( $elem.find('.weight').text().replace( /[\(\)]/g, ''), 10 ); + return parseFloat( $elem.find('.weight').text().replace( /[\(\)]/g, '') ); }, name : function ( $elem ) { return $elem.find('.name').text(); From 74f9af980c72e5f7b3e65568de5306bedf7b07c8 Mon Sep 17 00:00:00 2001 From: David DeSandro Date: Mon, 7 Feb 2011 22:13:27 -0500 Subject: [PATCH 02/15] docs : `parseFloat` to sorting docs --- _posts/docs/2010-12-07-sorting.mdown | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/_posts/docs/2010-12-07-sorting.mdown b/_posts/docs/2010-12-07-sorting.mdown index 32e4ba1..3160505 100644 --- a/_posts/docs/2010-12-07-sorting.mdown +++ b/_posts/docs/2010-12-07-sorting.mdown @@ -66,7 +66,7 @@ $('#container').isotope({ {% endhighlight %} -For numerical data, we can convert a text value into a number via `parseInt()` function. +For numerical data, we can convert a text value into a number with `parseInt()` or `parseFloat()`. {% highlight javascript %} @@ -76,7 +76,7 @@ getSortData : { return parseInt( $elem.find('.name').text(), 10 ); }, weight : function ( $elem ) { - return parseInt( $elem.find('.weight').text(), 10 ); + return parseFloat( $elem.find('.weight').text() ); } } From 6e69d78822670375dde924dd58232a4ad0eea132 Mon Sep 17 00:00:00 2001 From: David DeSandro Date: Tue, 8 Feb 2011 07:34:01 -0500 Subject: [PATCH 03/15] src : add updateItemsSortData method --- jquery.isotope.js | 35 ++++++++++++++----------- jquery.isotope.min.js | 60 +++++++++++++++++++++---------------------- 2 files changed, 50 insertions(+), 45 deletions(-) diff --git a/jquery.isotope.js b/jquery.isotope.js index 7005bdd..2e8c3f0 100644 --- a/jquery.isotope.js +++ b/jquery.isotope.js @@ -488,21 +488,7 @@ window.Modernizr = window.Modernizr || (function(window,doc,undefined){ $atoms.css( atomStyle ).addClass( this.options.itemClass ); - var instance = this; - $atoms.each(function(){ - var $this = $(this), - sortData = {}, - getSortData = instance.options.getSortData, - key; - // get value for sort data based on fn( $elem ) passed in - for ( key in getSortData ) { - sortData[ key ] = getSortData[ key ]( $this, instance ); - } - // apply sort data to $element - $this.data( 'isotope-sort-data', sortData ); - // increment element count - instance.elemCount ++; - }); + this.updateItemsSortData( $atoms, true ); }, @@ -540,6 +526,25 @@ window.Modernizr = window.Modernizr || (function(window,doc,undefined){ // ====================== Sorting ====================== + updateItemsSortData : function( $atoms, isIncrementingElemCount ) { + var instance = this, + getSortData = this.options.getSortData, + key, $this, sortData; + $atoms.each(function(){ + $this = $(this); + sortData = {}; + // get value for sort data based on fn( $elem ) passed in + for ( key in getSortData ) { + sortData[ key ] = getSortData[ key ]( $this, instance ); + } + // apply sort data to $element + $this.data( 'isotope-sort-data', sortData ); + if ( isIncrementingElemCount ) { + instance.elemCount ++; + } + }); + }, + // used on all the filtered atoms _sort : function() { diff --git a/jquery.isotope.min.js b/jquery.isotope.min.js index eff58a9..ef86620 100644 --- a/jquery.isotope.min.js +++ b/jquery.isotope.min.js @@ -8,33 +8,33 @@ * * Copyright 2011 David DeSandro / Metafizzy */ -var getStyleProperty=function(){var e=["Moz","Webkit","Khtml","O","Ms"],k={};return function(j,l){l=l||document.documentElement;var a=l.style,b,c,d,f;if(arguments.length===1&&typeof k[j]==="string")return k[j];if(typeof a[j]==="string")return k[j]=j;c=j.charAt(0).toUpperCase()+j.slice(1);d=0;for(f=e.length;dh?1:gb.width){b.fitRows.x=0;b.fitRows.y=b.fitRows.height}b._pushPosition(c,b.fitRows.x+b.posLeft,b.fitRows.y+b.posTop);b.fitRows.height=Math.max(b.fitRows.y+f,b.fitRows.height);b.fitRows.x+= -d})},_fitRowsReset:function(){this.fitRows={x:0,y:0,height:0};return this},_fitRowsGetContainerSize:function(){return{height:this.fitRows.height}},_fitRowsResize:function(){return this.reLayout()},_cellsByRowReset:function(){this.cellsByRow={};this._getSegments("cellsByRow");this.cellsByRow.rowHeight=this.options.cellsByRow.rowHeight||this.$allAtoms.outerHeight(true);return this},_cellsByRowLayout:function(a){var b=this,c=this.cellsByRow.cols;this.cellsByRow.atomsLen=a.length;a.each(function(d){var f= -e(this),g=(d%c+0.5)*b.cellsByRow.columnWidth-f.outerWidth(true)/2+b.posLeft;d=(~~(d/c)+0.5)*b.cellsByRow.rowHeight-f.outerHeight(true)/2+b.posTop;b._pushPosition(f,g,d)});return this},_cellsByRowGetContainerSize:function(){return{height:Math.ceil(this.cellsByRow.atomsLen/this.cellsByRow.cols)*this.cellsByRow.rowHeight+this.posTop}},_cellsByRowResize:function(){var a=this.cellsByRow.cols;this._getSegments("cellsByRow");this.cellsByRow.cols!==a&&this.reLayout();return this},_straightDownReset:function(){this.straightDown= -{y:0};return this},_straightDownLayout:function(a){var b=this;a.each(function(){var c=e(this);b._pushPosition(c,b.posLeft,b.straightDown.y+b.posTop);b.straightDown.y+=c.outerHeight(true)});return this},_straightDownGetContainerSize:function(){return{height:this.straightDown.y+this.posTop}},_straightDownResize:function(){this.reLayout();return this},_masonryHorizontalPlaceBrick:function(a,b,c){b=Math.min.apply(Math,c);for(var d=b+a.outerWidth(true),f=c.length,g=f,h=this.masonryHorizontal.rows+1-f;f--;)if(c[f]=== -b)g=f;this._pushPosition(a,b,this.masonryHorizontal.rowHeight*g+this.posTop);for(f=0;fb.height){b.fitColumns.x=b.fitColumns.width;b.fitColumns.y=0}b._pushPosition(c,b.fitColumns.x+b.posLeft,b.fitColumns.y+b.posTop);b.fitColumns.width=Math.max(b.fitColumns.x+d,b.fitColumns.width); -b.fitColumns.y+=f})},_fitColumnsGetContainerSize:function(){return{width:this.fitColumns.width}},_fitColumnsResize:function(){return this.reLayout()},_cellsByColumnReset:function(){this.cellsByColumn={};this._getSegments("cellsByColumn",true);this.cellsByColumn.columnWidth=this.options.cellsByColumn.columnWidth||this.$allAtoms.outerHeight(true);return this},_cellsByColumnLayout:function(a){var b=this,c=this.cellsByColumn.rows;this.cellsByColumn.atomsLen=a.length;a.each(function(d){var f=e(this),g= -(~~(d/c)+0.5)*b.cellsByColumn.columnWidth-f.outerWidth(true)/2+b.posLeft;d=(d%c+0.5)*b.cellsByColumn.rowHeight-f.outerHeight(true)/2+b.posTop;b._pushPosition(f,g,d)});return this},_cellsByColumnGetContainerSize:function(){return{width:Math.ceil(this.cellsByColumn.atomsLen/this.cellsByColumn.rows)*this.cellsByColumn.columnWidth+this.posLeft}},_cellsByColumnResize:function(){var a=this.cellsByColumn.rows;this._getSegments("cellsByColumn",true);this.cellsByColumn.rows!==a&&this.reLayout();return this}}; -e.fn.imagesLoaded=function(a){var b=this.find("img"),c=b.length,d=this;b.bind("load",function(){--c<=0&&a.call(d)}).each(function(){if(this.complete||this.complete===k){var f=this.src;this.src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==";this.src=f}});return this};e.widget=e.widget||{};e.widget.bridge=e.widget.bridge||function(a,b){e.fn[a]=function(c){var d=typeof c==="string",f=Array.prototype.slice.call(arguments,1),g=this;c=!d&&f.length?e.extend.apply(null,[true,c].concat(f)): -c;if(d&&c.charAt(0)==="_")return g;d?this.each(function(){var h=e.data(this,a);if(!h)return e.error("cannot call methods on "+a+" prior to initialization; attempted to call method '"+c+"'");if(!e.isFunction(h[c]))return e.error("no such method '"+c+"' for "+a+" widget instance");var i=h[c].apply(h,f);if(i!==h&&i!==k){g=i;return false}}):this.each(function(){var h=e.data(this,a);h?h.option(c||{})._init():e.data(this,a,new b(c,this))});return g}};e.widget.bridge("isotope",e.Isotope)})(jQuery); +var getStyleProperty=function(){var f=["Moz","Webkit","Khtml","O","Ms"],k={};return function(j,l){l=l||document.documentElement;var a=l.style,b,c,d,e;if(arguments.length===1&&typeof k[j]==="string")return k[j];if(typeof a[j]==="string")return k[j]=j;c=j.charAt(0).toUpperCase()+j.slice(1);d=0;for(e=f.length;dh?1:gb.width){b.fitRows.x=0;b.fitRows.y=b.fitRows.height}b._pushPosition(c,b.fitRows.x+b.posLeft,b.fitRows.y+b.posTop);b.fitRows.height=Math.max(b.fitRows.y+e,b.fitRows.height);b.fitRows.x+= +d})},_fitRowsReset:function(){this.fitRows={x:0,y:0,height:0};return this},_fitRowsGetContainerSize:function(){return{height:this.fitRows.height}},_fitRowsResize:function(){return this.reLayout()},_cellsByRowReset:function(){this.cellsByRow={};this._getSegments("cellsByRow");this.cellsByRow.rowHeight=this.options.cellsByRow.rowHeight||this.$allAtoms.outerHeight(true);return this},_cellsByRowLayout:function(a){var b=this,c=this.cellsByRow.cols;this.cellsByRow.atomsLen=a.length;a.each(function(d){var e= +f(this),g=(d%c+0.5)*b.cellsByRow.columnWidth-e.outerWidth(true)/2+b.posLeft;d=(~~(d/c)+0.5)*b.cellsByRow.rowHeight-e.outerHeight(true)/2+b.posTop;b._pushPosition(e,g,d)});return this},_cellsByRowGetContainerSize:function(){return{height:Math.ceil(this.cellsByRow.atomsLen/this.cellsByRow.cols)*this.cellsByRow.rowHeight+this.posTop}},_cellsByRowResize:function(){var a=this.cellsByRow.cols;this._getSegments("cellsByRow");this.cellsByRow.cols!==a&&this.reLayout();return this},_straightDownReset:function(){this.straightDown= +{y:0};return this},_straightDownLayout:function(a){var b=this;a.each(function(){var c=f(this);b._pushPosition(c,b.posLeft,b.straightDown.y+b.posTop);b.straightDown.y+=c.outerHeight(true)});return this},_straightDownGetContainerSize:function(){return{height:this.straightDown.y+this.posTop}},_straightDownResize:function(){this.reLayout();return this},_masonryHorizontalPlaceBrick:function(a,b,c){b=Math.min.apply(Math,c);for(var d=b+a.outerWidth(true),e=c.length,g=e,h=this.masonryHorizontal.rows+1-e;e--;)if(c[e]=== +b)g=e;this._pushPosition(a,b,this.masonryHorizontal.rowHeight*g+this.posTop);for(e=0;eb.height){b.fitColumns.x=b.fitColumns.width;b.fitColumns.y=0}b._pushPosition(c,b.fitColumns.x+b.posLeft,b.fitColumns.y+b.posTop);b.fitColumns.width=Math.max(b.fitColumns.x+d,b.fitColumns.width); +b.fitColumns.y+=e})},_fitColumnsGetContainerSize:function(){return{width:this.fitColumns.width}},_fitColumnsResize:function(){return this.reLayout()},_cellsByColumnReset:function(){this.cellsByColumn={};this._getSegments("cellsByColumn",true);this.cellsByColumn.columnWidth=this.options.cellsByColumn.columnWidth||this.$allAtoms.outerHeight(true);return this},_cellsByColumnLayout:function(a){var b=this,c=this.cellsByColumn.rows;this.cellsByColumn.atomsLen=a.length;a.each(function(d){var e=f(this),g= +(~~(d/c)+0.5)*b.cellsByColumn.columnWidth-e.outerWidth(true)/2+b.posLeft;d=(d%c+0.5)*b.cellsByColumn.rowHeight-e.outerHeight(true)/2+b.posTop;b._pushPosition(e,g,d)});return this},_cellsByColumnGetContainerSize:function(){return{width:Math.ceil(this.cellsByColumn.atomsLen/this.cellsByColumn.rows)*this.cellsByColumn.columnWidth+this.posLeft}},_cellsByColumnResize:function(){var a=this.cellsByColumn.rows;this._getSegments("cellsByColumn",true);this.cellsByColumn.rows!==a&&this.reLayout();return this}}; +f.fn.imagesLoaded=function(a){var b=this.find("img"),c=b.length,d=this;b.bind("load",function(){--c<=0&&a.call(d)}).each(function(){if(this.complete||this.complete===k){var e=this.src;this.src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==";this.src=e}});return this};f.widget=f.widget||{};f.widget.bridge=f.widget.bridge||function(a,b){f.fn[a]=function(c){var d=typeof c==="string",e=Array.prototype.slice.call(arguments,1),g=this;c=!d&&e.length?f.extend.apply(null,[true,c].concat(e)): +c;if(d&&c.charAt(0)==="_")return g;d?this.each(function(){var h=f.data(this,a);if(!h)return f.error("cannot call methods on "+a+" prior to initialization; attempted to call method '"+c+"'");if(!f.isFunction(h[c]))return f.error("no such method '"+c+"' for "+a+" widget instance");var i=h[c].apply(h,e);if(i!==h&&i!==k){g=i;return false}}):this.each(function(){var h=f.data(this,a);h?h.option(c||{})._init():f.data(this,a,new b(c,this))});return g}};f.widget.bridge("isotope",f.Isotope)})(jQuery); From 0d023f4e7c101efabee92af5f3d2d29008620da8 Mon Sep 17 00:00:00 2001 From: David DeSandro Date: Tue, 8 Feb 2011 07:43:51 -0500 Subject: [PATCH 04/15] docs : bind click events before page loads. Thx http://news.ycombinator.com/item?id=2192083 --- _layouts/elements.html | 74 +++++++++++------------ _posts/demos/2010-12-29-layout-modes.html | 13 ++-- _posts/demos/2010-12-30-filtering.html | 23 +++---- _posts/demos/2010-12-30-sorting.html | 14 ++--- _posts/demos/2010-12-31-relayout.html | 35 +++++------ _posts/demos/2011-01-02-adding-items.html | 10 +-- 6 files changed, 86 insertions(+), 83 deletions(-) diff --git a/_layouts/elements.html b/_layouts/elements.html index 0e7d3fe..d885f93 100644 --- a/_layouts/elements.html +++ b/_layouts/elements.html @@ -51,10 +51,45 @@ diff --git a/_posts/demos/2010-12-29-layout-modes.html b/_posts/demos/2010-12-29-layout-modes.html index 18d6e75..244c9b9 100644 --- a/_posts/demos/2010-12-29-layout-modes.html +++ b/_posts/demos/2010-12-29-layout-modes.html @@ -25,9 +25,14 @@ related: layouts diff --git a/_posts/demos/2010-12-30-filtering.html b/_posts/demos/2010-12-30-filtering.html index 891d204..5936d3f 100644 --- a/_posts/demos/2010-12-30-filtering.html +++ b/_posts/demos/2010-12-30-filtering.html @@ -39,23 +39,24 @@ related: filtering diff --git a/_posts/demos/2010-12-30-sorting.html b/_posts/demos/2010-12-30-sorting.html index 3e14a3e..b079983 100644 --- a/_posts/demos/2010-12-30-sorting.html +++ b/_posts/demos/2010-12-30-sorting.html @@ -26,10 +26,14 @@ related: sorting diff --git a/_posts/demos/2010-12-31-relayout.html b/_posts/demos/2010-12-31-relayout.html index 60cb370..2de6c3b 100644 --- a/_posts/demos/2010-12-31-relayout.html +++ b/_posts/demos/2010-12-31-relayout.html @@ -25,10 +25,26 @@ related: methods diff --git a/_posts/demos/2011-01-02-adding-items.html b/_posts/demos/2011-01-02-adding-items.html index 8de6656..69a4426 100644 --- a/_posts/demos/2011-01-02-adding-items.html +++ b/_posts/demos/2011-01-02-adding-items.html @@ -29,10 +29,13 @@ related: methods \ No newline at end of file From cfc1c3d3041236abba3c078742b03e3d5bf8ad8c Mon Sep 17 00:00:00 2001 From: David DeSandro Date: Tue, 8 Feb 2011 07:48:57 -0500 Subject: [PATCH 05/15] src : updateItemsSortDate -> updateSortData --- jquery.isotope.js | 4 ++-- jquery.isotope.min.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/jquery.isotope.js b/jquery.isotope.js index 2e8c3f0..02cfe2b 100644 --- a/jquery.isotope.js +++ b/jquery.isotope.js @@ -488,7 +488,7 @@ window.Modernizr = window.Modernizr || (function(window,doc,undefined){ $atoms.css( atomStyle ).addClass( this.options.itemClass ); - this.updateItemsSortData( $atoms, true ); + this.updateSortData( $atoms, true ); }, @@ -526,7 +526,7 @@ window.Modernizr = window.Modernizr || (function(window,doc,undefined){ // ====================== Sorting ====================== - updateItemsSortData : function( $atoms, isIncrementingElemCount ) { + updateSortData : function( $atoms, isIncrementingElemCount ) { var instance = this, getSortData = this.options.getSortData, key, $this, sortData; diff --git a/jquery.isotope.min.js b/jquery.isotope.min.js index ef86620..098be0d 100644 --- a/jquery.isotope.min.js +++ b/jquery.isotope.min.js @@ -18,8 +18,8 @@ b){this.element=f(b);this._create(a);this._init()};f.Isotope.prototype={options: resizesContainer:true},_filterFind:function(a,b){return b?a.filter(b).add(a.find(b)):a},_create:function(a){this.options=f.extend(true,{},this.options,a);this.isNew={};this.styleQueue=[];this.elemCount=0;this.$allAtoms=this._filterFind(this.element.children(),this.options.itemSelector);this.element.css({overflow:"hidden",position:"relative"});a=false;switch(this.options.animationEngine.toLowerCase().replace(/[ _\-]/g,"")){case "none":this.applyStyleFnName="css";break;case "jquery":this.applyStyleFnName= "animate";a=true;break;default:this.applyStyleFnName=Modernizr.csstransitions?"css":"animate"}this.positionFn=(this.usingTransforms=Modernizr.csstransforms&&Modernizr.csstransitions&&!a)?this._translate:this._positionAbs;this.options.getSortData=f.extend(this.options.getSortData,{"original-order":function(c,d){return d.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 b=this;setTimeout(function(){b.element.addClass(b.options.containerClass)},0);this.options.resizable&&f(window).bind("smartresize.isotope",function(){b.element.isotope("resize")})},_isNewProp:function(a){return this.prevOpts?this.options[a]!==this.prevOpts[a]:true},_init:function(a){var b=this;f.each(["filter","sortBy","sortAscending"],function(c,d){b.isNew[d]=b._isNewProp(d)});this.$filteredAtoms=this.isNew.filter?this._filter(this.$allAtoms):this.$allAtoms;if(this.isNew.filter||this.isNew.sortBy|| -this.isNew.sortAscending)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.updateItemsSortData(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},updateItemsSortData:function(a,b){var c=this,d=this.options.getSortData,e,g,h;a.each(function(){g=f(this);h={};for(e in d)h[e]=d[e](g,c);g.data("isotope-sort-data",h);b&&c.elemCount++})},_sort:function(){var a=this,b=function(d){return f(d).data("isotope-sort-data")[a.options.sortBy]}, +this.isNew.sortAscending)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,h;a.each(function(){g=f(this);h={};for(e in d)h[e]=d[e](g,c);g.data("isotope-sort-data",h);b&&c.elemCount++})},_sort:function(){var a=this,b=function(d){return f(d).data("isotope-sort-data")[a.options.sortBy]}, c=this.options.sortAscending?1:-1;sortFn=function(d,e){var g=b(d),h=b(e);return(g>h?1:g Date: Tue, 8 Feb 2011 07:52:13 -0500 Subject: [PATCH 06/15] docs : Methods - $content -> $items. use 'item elements' in copy --- _posts/docs/2010-12-04-methods.mdown | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/_posts/docs/2010-12-04-methods.mdown b/_posts/docs/2010-12-04-methods.mdown index 32d9d63..dc58433 100644 --- a/_posts/docs/2010-12-04-methods.mdown +++ b/_posts/docs/2010-12-04-methods.mdown @@ -28,11 +28,11 @@ $('#container').isotope( 'methodName', [optionalParameters] ) {% highlight javascript %} -.isotope( 'addItems', $content, callback ) +.isotope( 'addItems', $items, callback ) {% endhighlight %} -Adds elements to the pool of item elements of the container, but does sort, filter or layout. See [Adding items](adding-items.html) for more details. The argument within the callback is the group of elements that were added. +Adds item elements to the pool of item elements of the container, but does sort, filter or layout. See [Adding items](adding-items.html) for more details. The argument within the callback is the group of elements that were added. [**See Demo: Adding items**](../demos/adding-items.html) @@ -40,11 +40,11 @@ Adds elements to the pool of item elements of the container, but does sort, filt {% highlight javascript %} -.isotope( 'appended', $content, callback ) +.isotope( 'appended', $items, callback ) {% endhighlight %} -Adds elements via `addItems` method, then triggers `layout` just for those new elements. Useful for Infinite Scroll. See [Adding items](adding-items.html) for more details. +Adds item elements via `addItems` method, then triggers `layout` just for those new elements. Useful for Infinite Scroll. See [Adding items](adding-items.html) for more details. [**See Demo: Adding items**](../demos/adding-items.html) @@ -62,11 +62,11 @@ Removes Isotope functionality completely. Returns element back to pre-init state {% highlight javascript %} -.isotope( 'insert', $content, callback ) +.isotope( 'insert', $items, callback ) {% endhighlight %} -Appends elements to container, adds items to via `addItems` method, and then triggers `reLayout` method so new elements are properly filtered, sorted and laid-out. See [Adding items](adding-items.html) for more details. +Appends items elements to container, adds items to via `addItems` method, and then triggers `reLayout` method so new elements are properly filtered, sorted and laid-out. See [Adding items](adding-items.html) for more details. [**See Demo: Adding items**](../demos/adding-items.html). @@ -74,11 +74,11 @@ Appends elements to container, adds items to via `addItems` method, and then tri {% highlight javascript %} -.isotope( 'layout', $content, callback ) +.isotope( 'layout', $items, callback ) {% endhighlight %} -Positions specified elements in layout. +Positions specified item elements in layout. `layout` will only position specified elements, and those elements will be positioned at the end of layout. Whereas `reLayout` will position all elements in the Isotope widget. @@ -108,8 +108,8 @@ Resets layout properties and lays-out every item element. {% highlight javascript %} -.isotope( 'remove', $content ) +.isotope( 'remove', $items ) {% endhighlight %} -Removes specified elements from Isotope widget and the DOM. \ No newline at end of file +Removes specified item elements from Isotope widget and the DOM. \ No newline at end of file From e012c102f39ba506e4285e80b7a8e1f0c6879e41 Mon Sep 17 00:00:00 2001 From: David DeSandro Date: Tue, 8 Feb 2011 07:54:42 -0500 Subject: [PATCH 07/15] docs : add updateSortData method to Methods --- _posts/docs/2010-12-04-methods.mdown | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/_posts/docs/2010-12-04-methods.mdown b/_posts/docs/2010-12-04-methods.mdown index dc58433..1243251 100644 --- a/_posts/docs/2010-12-04-methods.mdown +++ b/_posts/docs/2010-12-04-methods.mdown @@ -112,4 +112,14 @@ Resets layout properties and lays-out every item element. {% endhighlight %} -Removes specified item elements from Isotope widget and the DOM. \ No newline at end of file +Removes specified item elements from Isotope widget and the DOM. + +## updateSortData + +{% highlight javascript %} + +.isotope( 'updateSortData', $items ) + +{% endhighlight %} + +Updates the sorting data on specified item elements. This method is useful if the data within an item is changed dynamically after Isotope has been initialized. From 871ad082617734881f1f4059df5c86e18231d6b9 Mon Sep 17 00:00:00 2001 From: David DeSandro Date: Tue, 8 Feb 2011 08:00:20 -0500 Subject: [PATCH 08/15] docs : index.html - bind click before page load --- index.html | 54 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 28 insertions(+), 26 deletions(-) diff --git a/index.html b/index.html index ed8f304..ea7a4a6 100644 --- a/index.html +++ b/index.html @@ -97,10 +97,36 @@ layout: nil From 754c647e40d0ee9057729490dc0da8a696b32c03 Mon Sep 17 00:00:00 2001 From: David DeSandro Date: Tue, 8 Feb 2011 08:03:56 -0500 Subject: [PATCH 09/15] docs : Methods - add updateSortData to page nav --- _posts/docs/2010-12-04-methods.mdown | 1 + 1 file changed, 1 insertion(+) diff --git a/_posts/docs/2010-12-04-methods.mdown b/_posts/docs/2010-12-04-methods.mdown index 1243251..62d6d38 100644 --- a/_posts/docs/2010-12-04-methods.mdown +++ b/_posts/docs/2010-12-04-methods.mdown @@ -13,6 +13,7 @@ toc: - { title: option, anchor: option } - { title: reLayout, anchor: relayout } - { title: remove, anchor: remove } + - { title: updateSortData, anchor: updatesortdata } --- From 4e9cdf283057a8acbe1932b447b0571aa1caab62 Mon Sep 17 00:00:00 2001 From: David DeSandro Date: Wed, 9 Feb 2011 17:40:25 -0500 Subject: [PATCH 10/15] src : remove isoTransform from jQuery object. Resolves Issue #11. --- jquery.isotope.js | 14 +++++----- jquery.isotope.min.js | 62 +++++++++++++++++++++---------------------- 2 files changed, 38 insertions(+), 38 deletions(-) diff --git a/jquery.isotope.js b/jquery.isotope.js index 02cfe2b..c153df9 100644 --- a/jquery.isotope.js +++ b/jquery.isotope.js @@ -1,5 +1,5 @@ /** - * Isotope v1.0.110207 + * Isotope v1.0.110211 * An exquisite jQuery plugin for magical layouts * http://isotope.metafizzy.co * @@ -150,7 +150,7 @@ window.Modernizr = window.Modernizr || (function(window,doc,undefined){ * Uses hardware accelerated 3D transforms for Safari * or falls back to 2D transforms. */ - $.isoTransform = { + var isoTransform = { transformProp : getStyleProperty('transform'), @@ -187,7 +187,7 @@ window.Modernizr = window.Modernizr || (function(window,doc,undefined){ for ( fnName in data ) { var transformValue = data[ fnName ], - getFn = $.isoTransform.fnUtils[ fnName ]; + getFn = isoTransform.fnUtils[ fnName ]; transformObj[ fnName ] = getFn( transformValue ); } @@ -205,7 +205,7 @@ window.Modernizr = window.Modernizr || (function(window,doc,undefined){ value = valueFns; // set name to vendor specific property - elem.style[ $.isoTransform.transformProp ] = valueFns; + elem.style[ isoTransform.transformProp ] = valueFns; } }; @@ -221,7 +221,7 @@ window.Modernizr = window.Modernizr || (function(window,doc,undefined){ value = parseFloat( value ); } - $.isoTransform.set( elem, 'scale', value ); + isoTransform.set( elem, 'scale', value ); }, get: function( elem, computed ) { @@ -258,7 +258,7 @@ window.Modernizr = window.Modernizr || (function(window,doc,undefined){ // } // } - $.isoTransform.set( elem, 'translate', value ); + isoTransform.set( elem, 'translate', value ); }, @@ -721,7 +721,7 @@ window.Modernizr = window.Modernizr || (function(window,doc,undefined){ }); if ( this.usingTransforms ) { - atomUnstyle[ $.isoTransform.transformProp ] = 'none'; + atomUnstyle[ isoTransform.transformProp ] = 'none'; } this.$allAtoms diff --git a/jquery.isotope.min.js b/jquery.isotope.min.js index 098be0d..b7c92d7 100644 --- a/jquery.isotope.min.js +++ b/jquery.isotope.min.js @@ -1,5 +1,5 @@ /** - * Isotope v1.0.110207 + * Isotope v1.0.110211 * An exquisite jQuery plugin for magical layouts * http://isotope.metafizzy.co * @@ -8,33 +8,33 @@ * * Copyright 2011 David DeSandro / Metafizzy */ -var getStyleProperty=function(){var f=["Moz","Webkit","Khtml","O","Ms"],k={};return function(j,l){l=l||document.documentElement;var a=l.style,b,c,d,e;if(arguments.length===1&&typeof k[j]==="string")return k[j];if(typeof a[j]==="string")return k[j]=j;c=j.charAt(0).toUpperCase()+j.slice(1);d=0;for(e=f.length;dh?1:gb.width){b.fitRows.x=0;b.fitRows.y=b.fitRows.height}b._pushPosition(c,b.fitRows.x+b.posLeft,b.fitRows.y+b.posTop);b.fitRows.height=Math.max(b.fitRows.y+e,b.fitRows.height);b.fitRows.x+= -d})},_fitRowsReset:function(){this.fitRows={x:0,y:0,height:0};return this},_fitRowsGetContainerSize:function(){return{height:this.fitRows.height}},_fitRowsResize:function(){return this.reLayout()},_cellsByRowReset:function(){this.cellsByRow={};this._getSegments("cellsByRow");this.cellsByRow.rowHeight=this.options.cellsByRow.rowHeight||this.$allAtoms.outerHeight(true);return this},_cellsByRowLayout:function(a){var b=this,c=this.cellsByRow.cols;this.cellsByRow.atomsLen=a.length;a.each(function(d){var e= -f(this),g=(d%c+0.5)*b.cellsByRow.columnWidth-e.outerWidth(true)/2+b.posLeft;d=(~~(d/c)+0.5)*b.cellsByRow.rowHeight-e.outerHeight(true)/2+b.posTop;b._pushPosition(e,g,d)});return this},_cellsByRowGetContainerSize:function(){return{height:Math.ceil(this.cellsByRow.atomsLen/this.cellsByRow.cols)*this.cellsByRow.rowHeight+this.posTop}},_cellsByRowResize:function(){var a=this.cellsByRow.cols;this._getSegments("cellsByRow");this.cellsByRow.cols!==a&&this.reLayout();return this},_straightDownReset:function(){this.straightDown= -{y:0};return this},_straightDownLayout:function(a){var b=this;a.each(function(){var c=f(this);b._pushPosition(c,b.posLeft,b.straightDown.y+b.posTop);b.straightDown.y+=c.outerHeight(true)});return this},_straightDownGetContainerSize:function(){return{height:this.straightDown.y+this.posTop}},_straightDownResize:function(){this.reLayout();return this},_masonryHorizontalPlaceBrick:function(a,b,c){b=Math.min.apply(Math,c);for(var d=b+a.outerWidth(true),e=c.length,g=e,h=this.masonryHorizontal.rows+1-e;e--;)if(c[e]=== -b)g=e;this._pushPosition(a,b,this.masonryHorizontal.rowHeight*g+this.posTop);for(e=0;eb.height){b.fitColumns.x=b.fitColumns.width;b.fitColumns.y=0}b._pushPosition(c,b.fitColumns.x+b.posLeft,b.fitColumns.y+b.posTop);b.fitColumns.width=Math.max(b.fitColumns.x+d,b.fitColumns.width); -b.fitColumns.y+=e})},_fitColumnsGetContainerSize:function(){return{width:this.fitColumns.width}},_fitColumnsResize:function(){return this.reLayout()},_cellsByColumnReset:function(){this.cellsByColumn={};this._getSegments("cellsByColumn",true);this.cellsByColumn.columnWidth=this.options.cellsByColumn.columnWidth||this.$allAtoms.outerHeight(true);return this},_cellsByColumnLayout:function(a){var b=this,c=this.cellsByColumn.rows;this.cellsByColumn.atomsLen=a.length;a.each(function(d){var e=f(this),g= -(~~(d/c)+0.5)*b.cellsByColumn.columnWidth-e.outerWidth(true)/2+b.posLeft;d=(d%c+0.5)*b.cellsByColumn.rowHeight-e.outerHeight(true)/2+b.posTop;b._pushPosition(e,g,d)});return this},_cellsByColumnGetContainerSize:function(){return{width:Math.ceil(this.cellsByColumn.atomsLen/this.cellsByColumn.rows)*this.cellsByColumn.columnWidth+this.posLeft}},_cellsByColumnResize:function(){var a=this.cellsByColumn.rows;this._getSegments("cellsByColumn",true);this.cellsByColumn.rows!==a&&this.reLayout();return this}}; -f.fn.imagesLoaded=function(a){var b=this.find("img"),c=b.length,d=this;b.bind("load",function(){--c<=0&&a.call(d)}).each(function(){if(this.complete||this.complete===k){var e=this.src;this.src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==";this.src=e}});return this};f.widget=f.widget||{};f.widget.bridge=f.widget.bridge||function(a,b){f.fn[a]=function(c){var d=typeof c==="string",e=Array.prototype.slice.call(arguments,1),g=this;c=!d&&e.length?f.extend.apply(null,[true,c].concat(e)): -c;if(d&&c.charAt(0)==="_")return g;d?this.each(function(){var h=f.data(this,a);if(!h)return f.error("cannot call methods on "+a+" prior to initialization; attempted to call method '"+c+"'");if(!f.isFunction(h[c]))return f.error("no such method '"+c+"' for "+a+" widget instance");var i=h[c].apply(h,e);if(i!==h&&i!==k){g=i;return false}}):this.each(function(){var h=f.data(this,a);h?h.option(c||{})._init():f.data(this,a,new b(c,this))});return g}};f.widget.bridge("isotope",f.Isotope)})(jQuery); +var getStyleProperty=function(){var f=["Moz","Webkit","Khtml","O","Ms"],k={};return function(j,l){l=l||document.documentElement;var m=l.style,a,b,c,d;if(arguments.length===1&&typeof k[j]==="string")return k[j];if(typeof m[j]==="string")return k[j]=j;b=j.charAt(0).toUpperCase()+j.slice(1);c=0;for(d=f.length;ch?1:gb.width){b.fitRows.x=0;b.fitRows.y=b.fitRows.height}b._pushPosition(c,b.fitRows.x+b.posLeft,b.fitRows.y+b.posTop);b.fitRows.height=Math.max(b.fitRows.y+e,b.fitRows.height);b.fitRows.x+=d})},_fitRowsReset:function(){this.fitRows={x:0,y:0,height:0};return this},_fitRowsGetContainerSize:function(){return{height:this.fitRows.height}}, +_fitRowsResize:function(){return this.reLayout()},_cellsByRowReset:function(){this.cellsByRow={};this._getSegments("cellsByRow");this.cellsByRow.rowHeight=this.options.cellsByRow.rowHeight||this.$allAtoms.outerHeight(true);return this},_cellsByRowLayout:function(a){var b=this,c=this.cellsByRow.cols;this.cellsByRow.atomsLen=a.length;a.each(function(d){var e=f(this),g=(d%c+0.5)*b.cellsByRow.columnWidth-e.outerWidth(true)/2+b.posLeft;d=(~~(d/c)+0.5)*b.cellsByRow.rowHeight-e.outerHeight(true)/2+b.posTop; +b._pushPosition(e,g,d)});return this},_cellsByRowGetContainerSize:function(){return{height:Math.ceil(this.cellsByRow.atomsLen/this.cellsByRow.cols)*this.cellsByRow.rowHeight+this.posTop}},_cellsByRowResize:function(){var a=this.cellsByRow.cols;this._getSegments("cellsByRow");this.cellsByRow.cols!==a&&this.reLayout();return this},_straightDownReset:function(){this.straightDown={y:0};return this},_straightDownLayout:function(a){var b=this;a.each(function(){var c=f(this);b._pushPosition(c,b.posLeft, +b.straightDown.y+b.posTop);b.straightDown.y+=c.outerHeight(true)});return this},_straightDownGetContainerSize:function(){return{height:this.straightDown.y+this.posTop}},_straightDownResize:function(){this.reLayout();return this},_masonryHorizontalPlaceBrick:function(a,b,c){b=Math.min.apply(Math,c);for(var d=b+a.outerWidth(true),e=c.length,g=e,h=this.masonryHorizontal.rows+1-e;e--;)if(c[e]===b)g=e;this._pushPosition(a,b,this.masonryHorizontal.rowHeight*g+this.posTop);for(e=0;eb.height){b.fitColumns.x=b.fitColumns.width;b.fitColumns.y=0}b._pushPosition(c,b.fitColumns.x+b.posLeft,b.fitColumns.y+b.posTop);b.fitColumns.width=Math.max(b.fitColumns.x+d,b.fitColumns.width);b.fitColumns.y+=e})},_fitColumnsGetContainerSize:function(){return{width:this.fitColumns.width}}, +_fitColumnsResize:function(){return this.reLayout()},_cellsByColumnReset:function(){this.cellsByColumn={};this._getSegments("cellsByColumn",true);this.cellsByColumn.columnWidth=this.options.cellsByColumn.columnWidth||this.$allAtoms.outerHeight(true);return this},_cellsByColumnLayout:function(a){var b=this,c=this.cellsByColumn.rows;this.cellsByColumn.atomsLen=a.length;a.each(function(d){var e=f(this),g=(~~(d/c)+0.5)*b.cellsByColumn.columnWidth-e.outerWidth(true)/2+b.posLeft;d=(d%c+0.5)*b.cellsByColumn.rowHeight- +e.outerHeight(true)/2+b.posTop;b._pushPosition(e,g,d)});return this},_cellsByColumnGetContainerSize:function(){return{width:Math.ceil(this.cellsByColumn.atomsLen/this.cellsByColumn.rows)*this.cellsByColumn.columnWidth+this.posLeft}},_cellsByColumnResize:function(){var a=this.cellsByColumn.rows;this._getSegments("cellsByColumn",true);this.cellsByColumn.rows!==a&&this.reLayout();return this}};f.fn.imagesLoaded=function(a){var b=this.find("img"),c=b.length,d=this;b.bind("load",function(){--c<=0&&a.call(d)}).each(function(){if(this.complete|| +this.complete===k){var e=this.src;this.src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==";this.src=e}});return this};f.widget=f.widget||{};f.widget.bridge=f.widget.bridge||function(a,b){f.fn[a]=function(c){var d=typeof c==="string",e=Array.prototype.slice.call(arguments,1),g=this;c=!d&&e.length?f.extend.apply(null,[true,c].concat(e)):c;if(d&&c.charAt(0)==="_")return g;d?this.each(function(){var h=f.data(this,a);if(!h)return f.error("cannot call methods on "+a+" prior to initialization; attempted to call method '"+ +c+"'");if(!f.isFunction(h[c]))return f.error("no such method '"+c+"' for "+a+" widget instance");var i=h[c].apply(h,e);if(i!==h&&i!==k){g=i;return false}}):this.each(function(){var h=f.data(this,a);h?h.option(c||{})._init():f.data(this,a,new b(c,this))});return g}};f.widget.bridge("isotope",f.Isotope)})(jQuery); From d041cbbef59ba82c6417a4a5723685fad814a175 Mon Sep 17 00:00:00 2001 From: David DeSandro Date: Wed, 9 Feb 2011 17:53:16 -0500 Subject: [PATCH 11/15] docs : add copy for elements demos --- _layouts/elements.html | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/_layouts/elements.html b/_layouts/elements.html index d885f93..759f7a5 100644 --- a/_layouts/elements.html +++ b/_layouts/elements.html @@ -3,6 +3,10 @@

{{ site.name }} Demo

{{ page.title }}

+ +
+

Isotope’s capabilities are designed to be used together cohesively. You can do it all — filter, sort, change layout modes, add items — and Isotope will handle it with ease.

+
From 9d7a367b65800edeb21718985126e8e604b26075 Mon Sep 17 00:00:00 2001 From: David DeSandro Date: Thu, 10 Feb 2011 15:55:18 -0500 Subject: [PATCH 12/15] src : Wrap everything in the same self-executing function --- jquery.isotope.js | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/jquery.isotope.js b/jquery.isotope.js index c153df9..4a8e369 100644 --- a/jquery.isotope.js +++ b/jquery.isotope.js @@ -10,6 +10,9 @@ */ + +(function( window, $, undefined ){ + // ========================= getStyleProperty by kangax =============================== // http://perfectionkills.com/feature-testing-css-properties/ @@ -33,7 +36,7 @@ var getStyleProperty = (function(){ if (typeof style[propName] === 'string') { return (_cache[propName] = propName); } - + // capitalize uPropName = propName.charAt(0).toUpperCase() + propName.slice(1); @@ -65,14 +68,14 @@ var getStyleProperty = (function(){ * http://www.modernizr.com/license/ */ - + /* * This version whittles down the script just to check support for * CSS transitions, transforms, and 3D transforms. */ - + window.Modernizr = window.Modernizr || (function(window,doc,undefined){ - + var version = '1.6ish: miniModernizr for Isotope', miniModernizr = {}, vendorCSSPrefixes = ' -o- -moz- -ms- -webkit- -khtml- '.split(' '), @@ -133,13 +136,9 @@ window.Modernizr = window.Modernizr || (function(window,doc,undefined){ docElement.className += ' ' + classes.join( ' ' ); return miniModernizr; - -}(this,this.document)); - +}(this,this.document)); -// jQuery -(function( $, undefined ){ // ========================= isoTransform =============================== @@ -1259,4 +1258,4 @@ window.Modernizr = window.Modernizr || (function(window,doc,undefined){ $.widget.bridge( 'isotope', $.Isotope ); -})( jQuery ); +})( window, jQuery ); From 820216890e9acf6645b49ed0fe6a3af08c7b5893 Mon Sep 17 00:00:00 2001 From: David DeSandro Date: Thu, 10 Feb 2011 15:55:42 -0500 Subject: [PATCH 13/15] src : white space for global closure --- jquery.isotope.js | 222 +++++++++++++++++++++++----------------------- 1 file changed, 111 insertions(+), 111 deletions(-) diff --git a/jquery.isotope.js b/jquery.isotope.js index 4a8e369..c96c3cb 100644 --- a/jquery.isotope.js +++ b/jquery.isotope.js @@ -13,131 +13,131 @@ (function( window, $, undefined ){ -// ========================= getStyleProperty by kangax =============================== -// http://perfectionkills.com/feature-testing-css-properties/ + // ========================= getStyleProperty by kangax =============================== + // http://perfectionkills.com/feature-testing-css-properties/ -var getStyleProperty = (function(){ + var getStyleProperty = (function(){ - var prefixes = ['Moz', 'Webkit', 'Khtml', 'O', 'Ms']; - var _cache = { }; + var prefixes = ['Moz', 'Webkit', 'Khtml', 'O', 'Ms']; + var _cache = { }; - function getStyleProperty(propName, element) { - element = element || document.documentElement; - var style = element.style, - prefixed, - uPropName, - i, l; + function getStyleProperty(propName, element) { + element = element || document.documentElement; + var style = element.style, + prefixed, + uPropName, + i, l; - // check cache only when no element is given - if (arguments.length === 1 && typeof _cache[propName] === 'string') { - return _cache[propName]; - } - // test standard property first - if (typeof style[propName] === 'string') { - return (_cache[propName] = propName); - } - - // capitalize - uPropName = propName.charAt(0).toUpperCase() + propName.slice(1); - - // test vendor specific properties - for (i=0, l=prefixes.length; i element. - docElement.className += ' ' + classes.join( ' ' ); + // Run through all tests and detect their support in the current UA. + for ( i = 0, len = tests.length; i < len; i++ ) { + var test = tests[i], + result = test.result(); + miniModernizr[ test.name ] = result; + var className = ( result ? '' : 'no-' ) + test.name; + classes.push( className ); + } - return miniModernizr; + // Add the new classes to the element. + docElement.className += ' ' + classes.join( ' ' ); -}(this,this.document)); + return miniModernizr; + + }(this,this.document)); From b83adc93726ba40a98c755a06c21387ada986418 Mon Sep 17 00:00:00 2001 From: David DeSandro Date: Thu, 10 Feb 2011 17:00:32 -0500 Subject: [PATCH 14/15] src : Update min --- jquery.isotope.js | 2 -- jquery.isotope.min.js | 59 +++++++++++++++++++++---------------------- 2 files changed, 29 insertions(+), 32 deletions(-) diff --git a/jquery.isotope.js b/jquery.isotope.js index c96c3cb..b1955f8 100644 --- a/jquery.isotope.js +++ b/jquery.isotope.js @@ -9,8 +9,6 @@ * Copyright 2011 David DeSandro / Metafizzy */ - - (function( window, $, undefined ){ // ========================= getStyleProperty by kangax =============================== diff --git a/jquery.isotope.min.js b/jquery.isotope.min.js index b7c92d7..599b54d 100644 --- a/jquery.isotope.min.js +++ b/jquery.isotope.min.js @@ -8,33 +8,32 @@ * * Copyright 2011 David DeSandro / Metafizzy */ -var getStyleProperty=function(){var f=["Moz","Webkit","Khtml","O","Ms"],k={};return function(j,l){l=l||document.documentElement;var m=l.style,a,b,c,d;if(arguments.length===1&&typeof k[j]==="string")return k[j];if(typeof m[j]==="string")return k[j]=j;b=j.charAt(0).toUpperCase()+j.slice(1);c=0;for(d=f.length;ch?1:gb.width){b.fitRows.x=0;b.fitRows.y=b.fitRows.height}b._pushPosition(c,b.fitRows.x+b.posLeft,b.fitRows.y+b.posTop);b.fitRows.height=Math.max(b.fitRows.y+e,b.fitRows.height);b.fitRows.x+=d})},_fitRowsReset:function(){this.fitRows={x:0,y:0,height:0};return this},_fitRowsGetContainerSize:function(){return{height:this.fitRows.height}}, -_fitRowsResize:function(){return this.reLayout()},_cellsByRowReset:function(){this.cellsByRow={};this._getSegments("cellsByRow");this.cellsByRow.rowHeight=this.options.cellsByRow.rowHeight||this.$allAtoms.outerHeight(true);return this},_cellsByRowLayout:function(a){var b=this,c=this.cellsByRow.cols;this.cellsByRow.atomsLen=a.length;a.each(function(d){var e=f(this),g=(d%c+0.5)*b.cellsByRow.columnWidth-e.outerWidth(true)/2+b.posLeft;d=(~~(d/c)+0.5)*b.cellsByRow.rowHeight-e.outerHeight(true)/2+b.posTop; -b._pushPosition(e,g,d)});return this},_cellsByRowGetContainerSize:function(){return{height:Math.ceil(this.cellsByRow.atomsLen/this.cellsByRow.cols)*this.cellsByRow.rowHeight+this.posTop}},_cellsByRowResize:function(){var a=this.cellsByRow.cols;this._getSegments("cellsByRow");this.cellsByRow.cols!==a&&this.reLayout();return this},_straightDownReset:function(){this.straightDown={y:0};return this},_straightDownLayout:function(a){var b=this;a.each(function(){var c=f(this);b._pushPosition(c,b.posLeft, -b.straightDown.y+b.posTop);b.straightDown.y+=c.outerHeight(true)});return this},_straightDownGetContainerSize:function(){return{height:this.straightDown.y+this.posTop}},_straightDownResize:function(){this.reLayout();return this},_masonryHorizontalPlaceBrick:function(a,b,c){b=Math.min.apply(Math,c);for(var d=b+a.outerWidth(true),e=c.length,g=e,h=this.masonryHorizontal.rows+1-e;e--;)if(c[e]===b)g=e;this._pushPosition(a,b,this.masonryHorizontal.rowHeight*g+this.posTop);for(e=0;eb.height){b.fitColumns.x=b.fitColumns.width;b.fitColumns.y=0}b._pushPosition(c,b.fitColumns.x+b.posLeft,b.fitColumns.y+b.posTop);b.fitColumns.width=Math.max(b.fitColumns.x+d,b.fitColumns.width);b.fitColumns.y+=e})},_fitColumnsGetContainerSize:function(){return{width:this.fitColumns.width}}, -_fitColumnsResize:function(){return this.reLayout()},_cellsByColumnReset:function(){this.cellsByColumn={};this._getSegments("cellsByColumn",true);this.cellsByColumn.columnWidth=this.options.cellsByColumn.columnWidth||this.$allAtoms.outerHeight(true);return this},_cellsByColumnLayout:function(a){var b=this,c=this.cellsByColumn.rows;this.cellsByColumn.atomsLen=a.length;a.each(function(d){var e=f(this),g=(~~(d/c)+0.5)*b.cellsByColumn.columnWidth-e.outerWidth(true)/2+b.posLeft;d=(d%c+0.5)*b.cellsByColumn.rowHeight- -e.outerHeight(true)/2+b.posTop;b._pushPosition(e,g,d)});return this},_cellsByColumnGetContainerSize:function(){return{width:Math.ceil(this.cellsByColumn.atomsLen/this.cellsByColumn.rows)*this.cellsByColumn.columnWidth+this.posLeft}},_cellsByColumnResize:function(){var a=this.cellsByColumn.rows;this._getSegments("cellsByColumn",true);this.cellsByColumn.rows!==a&&this.reLayout();return this}};f.fn.imagesLoaded=function(a){var b=this.find("img"),c=b.length,d=this;b.bind("load",function(){--c<=0&&a.call(d)}).each(function(){if(this.complete|| -this.complete===k){var e=this.src;this.src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==";this.src=e}});return this};f.widget=f.widget||{};f.widget.bridge=f.widget.bridge||function(a,b){f.fn[a]=function(c){var d=typeof c==="string",e=Array.prototype.slice.call(arguments,1),g=this;c=!d&&e.length?f.extend.apply(null,[true,c].concat(e)):c;if(d&&c.charAt(0)==="_")return g;d?this.each(function(){var h=f.data(this,a);if(!h)return f.error("cannot call methods on "+a+" prior to initialization; attempted to call method '"+ -c+"'");if(!f.isFunction(h[c]))return f.error("no such method '"+c+"' for "+a+" widget instance");var i=h[c].apply(h,e);if(i!==h&&i!==k){g=i;return false}}):this.each(function(){var h=f.data(this,a);h?h.option(c||{})._init():f.data(this,a,new b(c,this))});return g}};f.widget.bridge("isotope",f.Isotope)})(jQuery); +(function(n,f,s){var o=function(){var a=["Moz","Webkit","Khtml","O","Ms"],b={};return function(c,d){d=d||document.documentElement;var e=d.style,g,h,i,j;if(arguments.length===1&&typeof b[c]==="string")return b[c];if(typeof e[c]==="string")return b[c]=c;h=c.charAt(0).toUpperCase()+c.slice(1);i=0;for(j=a.length;ih?1:gb.width){b.fitRows.x=0;b.fitRows.y=b.fitRows.height}b._pushPosition(c,b.fitRows.x+b.posLeft,b.fitRows.y+b.posTop);b.fitRows.height=Math.max(b.fitRows.y+e,b.fitRows.height);b.fitRows.x+= +d})},_fitRowsReset:function(){this.fitRows={x:0,y:0,height:0};return this},_fitRowsGetContainerSize:function(){return{height:this.fitRows.height}},_fitRowsResize:function(){return this.reLayout()},_cellsByRowReset:function(){this.cellsByRow={};this._getSegments("cellsByRow");this.cellsByRow.rowHeight=this.options.cellsByRow.rowHeight||this.$allAtoms.outerHeight(true);return this},_cellsByRowLayout:function(a){var b=this,c=this.cellsByRow.cols;this.cellsByRow.atomsLen=a.length;a.each(function(d){var e= +f(this),g=(d%c+0.5)*b.cellsByRow.columnWidth-e.outerWidth(true)/2+b.posLeft;d=(~~(d/c)+0.5)*b.cellsByRow.rowHeight-e.outerHeight(true)/2+b.posTop;b._pushPosition(e,g,d)});return this},_cellsByRowGetContainerSize:function(){return{height:Math.ceil(this.cellsByRow.atomsLen/this.cellsByRow.cols)*this.cellsByRow.rowHeight+this.posTop}},_cellsByRowResize:function(){var a=this.cellsByRow.cols;this._getSegments("cellsByRow");this.cellsByRow.cols!==a&&this.reLayout();return this},_straightDownReset:function(){this.straightDown= +{y:0};return this},_straightDownLayout:function(a){var b=this;a.each(function(){var c=f(this);b._pushPosition(c,b.posLeft,b.straightDown.y+b.posTop);b.straightDown.y+=c.outerHeight(true)});return this},_straightDownGetContainerSize:function(){return{height:this.straightDown.y+this.posTop}},_straightDownResize:function(){this.reLayout();return this},_masonryHorizontalPlaceBrick:function(a,b,c){b=Math.min.apply(Math,c);for(var d=b+a.outerWidth(true),e=c.length,g=e,h=this.masonryHorizontal.rows+1-e;e--;)if(c[e]=== +b)g=e;this._pushPosition(a,b,this.masonryHorizontal.rowHeight*g+this.posTop);for(e=0;eb.height){b.fitColumns.x=b.fitColumns.width;b.fitColumns.y=0}b._pushPosition(c,b.fitColumns.x+b.posLeft,b.fitColumns.y+b.posTop);b.fitColumns.width=Math.max(b.fitColumns.x+d,b.fitColumns.width); +b.fitColumns.y+=e})},_fitColumnsGetContainerSize:function(){return{width:this.fitColumns.width}},_fitColumnsResize:function(){return this.reLayout()},_cellsByColumnReset:function(){this.cellsByColumn={};this._getSegments("cellsByColumn",true);this.cellsByColumn.columnWidth=this.options.cellsByColumn.columnWidth||this.$allAtoms.outerHeight(true);return this},_cellsByColumnLayout:function(a){var b=this,c=this.cellsByColumn.rows;this.cellsByColumn.atomsLen=a.length;a.each(function(d){var e=f(this),g= +(~~(d/c)+0.5)*b.cellsByColumn.columnWidth-e.outerWidth(true)/2+b.posLeft;d=(d%c+0.5)*b.cellsByColumn.rowHeight-e.outerHeight(true)/2+b.posTop;b._pushPosition(e,g,d)});return this},_cellsByColumnGetContainerSize:function(){return{width:Math.ceil(this.cellsByColumn.atomsLen/this.cellsByColumn.rows)*this.cellsByColumn.columnWidth+this.posLeft}},_cellsByColumnResize:function(){var a=this.cellsByColumn.rows;this._getSegments("cellsByColumn",true);this.cellsByColumn.rows!==a&&this.reLayout();return this}}; +f.fn.imagesLoaded=function(a){var b=this.find("img"),c=b.length,d=this;b.bind("load",function(){--c<=0&&a.call(d)}).each(function(){if(this.complete||this.complete===s){var e=this.src;this.src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==";this.src=e}});return this};f.widget=f.widget||{};f.widget.bridge=f.widget.bridge||function(a,b){f.fn[a]=function(c){var d=typeof c==="string",e=Array.prototype.slice.call(arguments,1),g=this;c=!d&&e.length?f.extend.apply(null,[true,c].concat(e)): +c;if(d&&c.charAt(0)==="_")return g;d?this.each(function(){var h=f.data(this,a);if(!h)return f.error("cannot call methods on "+a+" prior to initialization; attempted to call method '"+c+"'");if(!f.isFunction(h[c]))return f.error("no such method '"+c+"' for "+a+" widget instance");var i=h[c].apply(h,e);if(i!==h&&i!==s){g=i;return false}}):this.each(function(){var h=f.data(this,a);h?h.option(c||{})._init():f.data(this,a,new b(c,this))});return g}};f.widget.bridge("isotope",f.Isotope)})(window,jQuery); From 01ab079b194212b64f802d6a0f0557f5a04f4b80 Mon Sep 17 00:00:00 2001 From: David DeSandro Date: Thu, 10 Feb 2011 17:15:26 -0500 Subject: [PATCH 15/15] src : JSLint and var edits --- jquery.isotope.js | 12 ++++++------ jquery.isotope.min.js | 20 ++++++++++---------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/jquery.isotope.js b/jquery.isotope.js index b1955f8..4d16a56 100644 --- a/jquery.isotope.js +++ b/jquery.isotope.js @@ -79,7 +79,7 @@ vendorCSSPrefixes = ' -o- -moz- -ms- -webkit- -khtml- '.split(' '), classes = [], docElement = document.documentElement, - i, l, + i, len, tests = [ { @@ -135,7 +135,7 @@ return miniModernizr; - }(this,this.document)); + })(this,this.document); @@ -903,7 +903,7 @@ }, _fitRowsResize : function() { - return this.reLayout() + return this.reLayout(); }, @@ -962,7 +962,7 @@ var $this = $(this), y = instance.straightDown.y + instance.posTop; instance._pushPosition( $this, instance.posLeft, y ); - instance.straightDown.y += $this.outerHeight(true) + instance.straightDown.y += $this.outerHeight(true); }); return this; }, @@ -1023,10 +1023,10 @@ // how many different places could this brick fit horizontally var groupCount = instance.masonryHorizontal.rows + 1 - rowSpan, groupX = [], - groupRowX; + groupRowX, i; // for each group potential horizontal position - for ( var i=0; i < groupCount; i++ ) { + for ( i=0; i < groupCount; i++ ) { // make an array of colY values for that one group groupRowX = instance.masonryHorizontal.rowXs.slice( i, i+rowSpan ); // and get the max value of the array diff --git a/jquery.isotope.min.js b/jquery.isotope.min.js index 599b54d..16ba2ef 100644 --- a/jquery.isotope.min.js +++ b/jquery.isotope.min.js @@ -8,13 +8,13 @@ * * Copyright 2011 David DeSandro / Metafizzy */ -(function(n,f,s){var o=function(){var a=["Moz","Webkit","Khtml","O","Ms"],b={};return function(c,d){d=d||document.documentElement;var e=d.style,g,h,i,j;if(arguments.length===1&&typeof b[c]==="string")return b[c];if(typeof e[c]==="string")return b[c]=c;h=c.charAt(0).toUpperCase()+c.slice(1);i=0;for(j=a.length;ib.height){b.fitColumns.x=b.fitColumns.width;b.fitColumns.y=0}b._pushPosition(c,b.fitColumns.x+b.posLeft,b.fitColumns.y+b.posTop);b.fitColumns.width=Math.max(b.fitColumns.x+d,b.fitColumns.width); b.fitColumns.y+=e})},_fitColumnsGetContainerSize:function(){return{width:this.fitColumns.width}},_fitColumnsResize:function(){return this.reLayout()},_cellsByColumnReset:function(){this.cellsByColumn={};this._getSegments("cellsByColumn",true);this.cellsByColumn.columnWidth=this.options.cellsByColumn.columnWidth||this.$allAtoms.outerHeight(true);return this},_cellsByColumnLayout:function(a){var b=this,c=this.cellsByColumn.rows;this.cellsByColumn.atomsLen=a.length;a.each(function(d){var e=f(this),g= (~~(d/c)+0.5)*b.cellsByColumn.columnWidth-e.outerWidth(true)/2+b.posLeft;d=(d%c+0.5)*b.cellsByColumn.rowHeight-e.outerHeight(true)/2+b.posTop;b._pushPosition(e,g,d)});return this},_cellsByColumnGetContainerSize:function(){return{width:Math.ceil(this.cellsByColumn.atomsLen/this.cellsByColumn.rows)*this.cellsByColumn.columnWidth+this.posLeft}},_cellsByColumnResize:function(){var a=this.cellsByColumn.rows;this._getSegments("cellsByColumn",true);this.cellsByColumn.rows!==a&&this.reLayout();return this}}; -f.fn.imagesLoaded=function(a){var b=this.find("img"),c=b.length,d=this;b.bind("load",function(){--c<=0&&a.call(d)}).each(function(){if(this.complete||this.complete===s){var e=this.src;this.src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==";this.src=e}});return this};f.widget=f.widget||{};f.widget.bridge=f.widget.bridge||function(a,b){f.fn[a]=function(c){var d=typeof c==="string",e=Array.prototype.slice.call(arguments,1),g=this;c=!d&&e.length?f.extend.apply(null,[true,c].concat(e)): -c;if(d&&c.charAt(0)==="_")return g;d?this.each(function(){var h=f.data(this,a);if(!h)return f.error("cannot call methods on "+a+" prior to initialization; attempted to call method '"+c+"'");if(!f.isFunction(h[c]))return f.error("no such method '"+c+"' for "+a+" widget instance");var i=h[c].apply(h,e);if(i!==h&&i!==s){g=i;return false}}):this.each(function(){var h=f.data(this,a);h?h.option(c||{})._init():f.data(this,a,new b(c,this))});return g}};f.widget.bridge("isotope",f.Isotope)})(window,jQuery); +f.fn.imagesLoaded=function(a){var b=this.find("img"),c=b.length,d=this;b.bind("load",function(){--c<=0&&a.call(d)}).each(function(){if(this.complete||this.complete===t){var e=this.src;this.src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==";this.src=e}});return this};f.widget=f.widget||{};f.widget.bridge=f.widget.bridge||function(a,b){f.fn[a]=function(c){var d=typeof c==="string",e=Array.prototype.slice.call(arguments,1),g=this;c=!d&&e.length?f.extend.apply(null,[true,c].concat(e)): +c;if(d&&c.charAt(0)==="_")return g;d?this.each(function(){var h=f.data(this,a);if(!h)return f.error("cannot call methods on "+a+" prior to initialization; attempted to call method '"+c+"'");if(!f.isFunction(h[c]))return f.error("no such method '"+c+"' for "+a+" widget instance");var i=h[c].apply(h,e);if(i!==h&&i!==t){g=i;return false}}):this.each(function(){var h=f.data(this,a);h?h.option(c||{})._init():f.data(this,a,new b(c,this))});return g}};f.widget.bridge("isotope",f.Isotope)})(window,jQuery);