From f8df61619f386739d24695c3e01a3315f6bec6d5 Mon Sep 17 00:00:00 2001 From: David DeSandro Date: Fri, 20 May 2011 18:17:56 -0400 Subject: [PATCH 01/17] docs : add `.width2 .height2` classes via Liquid; added modulus plugin; --- _includes/element-partial.html | 6 ++++-- _layouts/elements.html | 11 ----------- _plugins/modulus.rb | 7 +++++++ _posts/demos/2010-12-29-layout-modes.html | 10 ---------- _posts/demos/2010-12-31-relayout.html | 10 ---------- _posts/tests/2011-04-26-item-position-data01.html | 10 ---------- _posts/tests/2011-05-13-jquery-animation01.html | 10 ---------- _posts/tests/2011-05-18-centered-masonry.html | 11 ----------- 8 files changed, 11 insertions(+), 64 deletions(-) create mode 100644 _plugins/modulus.rb diff --git a/_includes/element-partial.html b/_includes/element-partial.html index 2d1d733..561a302 100644 --- a/_includes/element-partial.html +++ b/_includes/element-partial.html @@ -1,5 +1,7 @@ - -
+ {% capture a %}{{ element.number | modulus:7 | modulus:2 }}{% endcapture %} + {% capture b %}{{ element.number | modulus:3 }}{% endcapture %} + {% capture classnames %}{% for cat in element.categories %}{{ cat }} {% endfor %} {% if page.infinite_scroll %} width2 height2 {% else %} {% if a == '1' %} width2 {% endif %} {% if b == '0' %} height2 {% endif %} {% endif %} {% endcapture %} +

{{ element.number }}

{{ element.symbol }}

{{ element.name }}

diff --git a/_layouts/elements.html b/_layouts/elements.html index c009a63..69aba03 100644 --- a/_layouts/elements.html +++ b/_layouts/elements.html @@ -95,17 +95,6 @@ $(function(){ - // hacky way of adding random size classes - $container.find('.element').each(function(){ - if ( Math.random() > 0.6 ) { - $(this).addClass('width2'); - } - if ( Math.random() > 0.6 ) { - $(this).addClass('height2'); - } - }); - - $container.isotope({ itemSelector : '.element', // layoutMode : 'fitRows', diff --git a/_plugins/modulus.rb b/_plugins/modulus.rb new file mode 100644 index 0000000..0b98c97 --- /dev/null +++ b/_plugins/modulus.rb @@ -0,0 +1,7 @@ +module MathFilter + def modulus(input, operand) + to_number(input) % to_number(operand) + end +end + +Liquid::Template.register_filter(MathFilter) \ No newline at end of file diff --git a/_posts/demos/2010-12-29-layout-modes.html b/_posts/demos/2010-12-29-layout-modes.html index 4cf40b1..e6580f3 100644 --- a/_posts/demos/2010-12-29-layout-modes.html +++ b/_posts/demos/2010-12-29-layout-modes.html @@ -34,16 +34,6 @@ related: layouts $(function(){ - // hacky way of adding random size classes - $container.find('.element').each(function(){ - if ( Math.random() > 0.6 ) { - $(this).addClass('width2'); - } - if ( Math.random() > 0.6 ) { - $(this).addClass('height2'); - } - }); - $container.isotope({ itemSelector : '.element', masonry : { diff --git a/_posts/demos/2010-12-31-relayout.html b/_posts/demos/2010-12-31-relayout.html index 833c120..b903eac 100644 --- a/_posts/demos/2010-12-31-relayout.html +++ b/_posts/demos/2010-12-31-relayout.html @@ -45,16 +45,6 @@ related: methods $(function(){ - // hacky way of adding random size classes - $container.find('.element').each(function(){ - if ( Math.random() > 0.6 ) { - $(this).addClass('width2'); - } - if ( Math.random() > 0.6 ) { - $(this).addClass('height2'); - } - }); - $container.isotope({ itemSelector: '.element', masonry : { diff --git a/_posts/tests/2011-04-26-item-position-data01.html b/_posts/tests/2011-04-26-item-position-data01.html index 5c89636..d9a6a3a 100644 --- a/_posts/tests/2011-04-26-item-position-data01.html +++ b/_posts/tests/2011-04-26-item-position-data01.html @@ -52,16 +52,6 @@ category: tests var $container = $('#container'); - // hacky way of adding random size classes - $container.find('.element').each(function(){ - if ( Math.random() > 0.6 ) { - $(this).addClass('width2'); - } - if ( Math.random() > 0.6 ) { - $(this).addClass('height2'); - } - }); - {% include sort-buttons.js %} // change size of clicked element diff --git a/_posts/tests/2011-05-13-jquery-animation01.html b/_posts/tests/2011-05-13-jquery-animation01.html index cab3fcd..4fb2a66 100644 --- a/_posts/tests/2011-05-13-jquery-animation01.html +++ b/_posts/tests/2011-05-13-jquery-animation01.html @@ -61,16 +61,6 @@ category: tests var $container = $('#container'); - // hacky way of adding random size classes - $container.find('.element').each(function(){ - if ( Math.random() > 0.6 ) { - $(this).addClass('width2'); - } - if ( Math.random() > 0.6 ) { - $(this).addClass('height2'); - } - }); - {% include sort-buttons.js %} $('#filters').find('a').click(function(){ diff --git a/_posts/tests/2011-05-18-centered-masonry.html b/_posts/tests/2011-05-18-centered-masonry.html index ea3054a..931a184 100644 --- a/_posts/tests/2011-05-18-centered-masonry.html +++ b/_posts/tests/2011-05-18-centered-masonry.html @@ -162,17 +162,6 @@ category: tests $(function(){ - // hacky way of adding random size classes - $container.find('.element').each(function(){ - if ( Math.random() > 0.6 ) { - $(this).addClass('width2'); - } - if ( Math.random() > 0.6 ) { - $(this).addClass('height2'); - } - }); - - $container.isotope({ itemSelector : '.element', masonry : { From f0a4c14136da21ac16fb2e2bc8cf17247594dcd5 Mon Sep 17 00:00:00 2001 From: David DeSandro Date: Mon, 23 May 2011 15:20:28 -0400 Subject: [PATCH 02/17] src : internal plugin methods will not `return this`; remove option getter --- jquery.isotope.js | 66 +++++++++++-------------------------------- jquery.isotope.min.js | 4 +-- 2 files changed, 18 insertions(+), 52 deletions(-) diff --git a/jquery.isotope.js b/jquery.isotope.js index 672f37a..c9b2d56 100644 --- a/jquery.isotope.js +++ b/jquery.isotope.js @@ -1,5 +1,5 @@ /** - * Isotope v1.2.110520 + * Isotope v1.2.110523 * An exquisite jQuery plugin for magical layouts * http://isotope.metafizzy.co * @@ -441,10 +441,7 @@ }, option: function( key, value ){ - // get/change options AFTER initialization: - // you don't have to support all these cases, - // but here's how: // signature: $('#foo').bar({ cool:false }); if ( $.isPlainObject( key ) ){ @@ -454,17 +451,11 @@ this._updateOption( optionName ); } - // signature: $('#foo').option('cool'); - getter - } else if ( key && typeof value === "undefined" ){ - return this.options[ key ]; - // signature: $('#foo').bar('option', 'baz', false); } else { this.options[ key ] = value; this._updateOption( key ); } - - return this; // make sure to return the instance! }, // ====================== updaters ====================== // @@ -578,8 +569,6 @@ }; this.$filteredAtoms.sort( sortFn ); - - return this; }, _getSorter : function( elem, sortBy ) { @@ -644,20 +633,18 @@ } this.isLaidOut = true; - - return this; }, resize : function() { - return this[ '_' + this.options.layoutMode + 'Resize' ](); + this[ '_' + this.options.layoutMode + 'Resize' ](); }, reLayout : function( callback ) { - return this[ '_' + this.options.layoutMode + 'Reset' ]() - .layout( this.$filteredAtoms, callback ); + this[ '_' + this.options.layoutMode + 'Reset' ](); + this.layout( this.$filteredAtoms, callback ); }, @@ -685,7 +672,8 @@ instance.$filteredAtoms = instance.$filteredAtoms.add( $filteredAtoms ); }); - this._sort().reLayout( callback ); + this._sort(); + this.reLayout( callback ); }, @@ -734,7 +722,7 @@ this.$allAtoms = this._shuffleArray( this.$allAtoms ); this.$filteredAtoms = this._filter( this.$allAtoms ); - return this.reLayout( callback ); + this.reLayout( callback ); }, // destroys widget, returns elements and container back (close) to original style @@ -798,8 +786,6 @@ // i.e. this.masonry.columnWidth = ... this[ namespace ][ measure ] = segmentSize; - return this; - }, // ====================== LAYOUTS ====================== @@ -866,7 +852,6 @@ instance._masonryPlaceBrick( $this, groupCount, groupY ); } }); - return this; }, // reset @@ -880,7 +865,6 @@ while (i--) { this.masonry.colYs.push( this.posTop ); } - return this; }, _masonryResize : function() { @@ -891,8 +875,6 @@ // if column count has changed, do a new column cound this.reLayout(); } - - return this; }, _masonryGetContainerSize : function() { @@ -928,7 +910,6 @@ instance.fitRows.x += atomW; }); - return this; }, _fitRowsReset : function() { @@ -937,7 +918,6 @@ y : 0, height : 0 }; - return this; }, _fitRowsGetContainerSize : function () { @@ -945,7 +925,7 @@ }, _fitRowsResize : function() { - return this.reLayout(); + this.reLayout(); }, @@ -955,7 +935,6 @@ this.cellsByRow = {}; this._getSegments('cellsByRow'); this.cellsByRow.rowHeight = this.options.cellsByRow.rowHeight || this.$allAtoms.outerHeight(true); - return this; }, _cellsByRowLayout : function( $elems ) { @@ -970,7 +949,6 @@ $this.outerHeight(true) / 2 + instance.posTop; instance._pushPosition( $this, x, y ); }); - return this; }, _cellsByRowGetContainerSize : function() { @@ -985,7 +963,6 @@ if ( this.cellsByRow.cols !== prevCols ) { this.reLayout(); } - return this; }, @@ -995,7 +972,6 @@ this.straightDown = { y : 0 }; - return this; }, _straightDownLayout : function( $elems ) { @@ -1006,7 +982,6 @@ instance._pushPosition( $this, instance.posLeft, y ); instance.straightDown.y += $this.outerHeight(true); }); - return this; }, _straightDownGetContainerSize : function() { @@ -1015,7 +990,6 @@ _straightDownResize : function() { this.reLayout(); - return this; }, @@ -1078,7 +1052,6 @@ instance._masonryHorizontalPlaceBrick( $this, groupCount, groupX ); } }); - return this; }, _masonryHorizontalReset : function() { @@ -1091,7 +1064,6 @@ while (i--) { this.masonryHorizontal.rowXs.push( this.posLeft ); } - return this; }, _masonryHorizontalResize : function() { @@ -1102,8 +1074,6 @@ // if column count has changed, do a new column cound this.reLayout(); } - - return this; }, _masonryHorizontalGetContainerSize : function() { @@ -1120,7 +1090,6 @@ y : 0, width : 0 }; - return this; }, _fitColumnsLayout : function( $elems ) { @@ -1147,7 +1116,6 @@ instance.fitColumns.y += atomH; }); - return this; }, _fitColumnsGetContainerSize : function () { @@ -1155,7 +1123,7 @@ }, _fitColumnsResize : function() { - return this.reLayout(); + this.reLayout(); }, @@ -1166,7 +1134,6 @@ this.cellsByColumn = {}; this._getSegments( 'cellsByColumn', true ); this.cellsByColumn.columnWidth = this.options.cellsByColumn.columnWidth || this.$allAtoms.outerHeight(true); - return this; }, _cellsByColumnLayout : function( $elems ) { @@ -1181,7 +1148,6 @@ $this.outerHeight(true) / 2 + instance.posTop; instance._pushPosition( $this, x, y ); }); - return this; }, _cellsByColumnGetContainerSize : function() { @@ -1196,7 +1162,6 @@ if ( this.cellsByColumn.rows !== prevRows ) { this.reLayout(); } - return this; }, // ====================== straightAcross ====================== @@ -1205,7 +1170,6 @@ this.straightAcross = { x : 0 }; - return this; }, _straightAcrossLayout : function( $elems ) { @@ -1216,7 +1180,6 @@ instance._pushPosition( $this, x, instance.posTop ); instance.straightAcross.x += $this.outerWidth(true); }); - return this; }, _straightAcrossGetContainerSize : function() { @@ -1225,7 +1188,6 @@ _straightAcrossResize : function() { this.reLayout(); - return this; } }; @@ -1278,7 +1240,7 @@ // call method var args = Array.prototype.slice.call( arguments, 1 ); - return this.each(function(){ + this.each(function(){ var instance = $.data( this, 'isotope' ); if ( !instance ) { return $.error( "cannot call methods on isotope prior to initialization; " + @@ -1291,17 +1253,21 @@ instance[ options ].apply( instance, args ); }); } else { - return this.each(function() { + this.each(function() { var instance = $.data( this, 'isotope' ); if ( instance ) { // apply options & init - instance.option( options || {} )._init(); + instance.option( options || {} ); + instance._init(); } else { // initialize new instance $.data( this, 'isotope', new $.Isotope( options, this ) ); } }); } + // return jQuery object + // so plugin methods do not have to + return this; }; })( window, jQuery ); \ No newline at end of file diff --git a/jquery.isotope.min.js b/jquery.isotope.min.js index 3c6b01c..d9d4c0d 100644 --- a/jquery.isotope.min.js +++ b/jquery.isotope.min.js @@ -1,5 +1,5 @@ /** - * Isotope v1.2.110520 + * Isotope v1.2.110523 * An exquisite jQuery plugin for magical layouts * http://isotope.metafizzy.co * @@ -8,4 +8,4 @@ * * Copyright 2011 David DeSandro / Metafizzy */ -(function(a,b,c){var d=function(){function b(b,c){c=c||document.documentElement;var d=c.style,e;if(typeof d[b]=="string")return b;b=b.charAt(0).toUpperCase()+b.slice(1);for(var f=0,g=a.length;fg?1:fc.width&&(c.fitRows.x=0,c.fitRows.y=c.fitRows.height),f=c.fitRows.x+c.posLeft,g=c.fitRows.y+c.posTop,c._pushPosition(a,f,g),c.fitRows.height=Math.max(c.fitRows.y+e,c.fitRows.height),c.fitRows.x+=d});return this},_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(!0);return this},_cellsByRowLayout:function(a){var c=this,d=this.cellsByRow.cols;this.cellsByRow.atomsLen=a.length,a.each(function(a){var e=b(this),f=(a%d+.5)*c.cellsByRow.columnWidth-e.outerWidth(!0)/2+c.posLeft,g=(~~(a/d)+.5)*c.cellsByRow.rowHeight-e.outerHeight(!0)/2+c.posTop;c._pushPosition(e,f,g)});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 c=this;a.each(function(a){var d=b(this),e=c.straightDown.y+c.posTop;c._pushPosition(d,c.posLeft,e),c.straightDown.y+=d.outerHeight(!0)});return this},_straightDownGetContainerSize:function(){return{height:this.straightDown.y+this.posTop}},_straightDownResize:function(){this.reLayout();return this},_masonryHorizontalPlaceBrick:function(a,b,c){var d=Math.min.apply(Math,c),e=d+a.outerWidth(!0),f=c.length,g=f,h=this.masonryHorizontal.rows+1-f,i,j;while(f--)c[f]===d&&(g=f);i=d,j=this.masonryHorizontal.rowHeight*g+this.posTop,this._pushPosition(a,i,j);for(f=0;fc.height&&(c.fitColumns.x=c.fitColumns.width,c.fitColumns.y=0),f=c.fitColumns.x+c.posLeft,g=c.fitColumns.y+c.posTop,c._pushPosition(a,f,g),c.fitColumns.width=Math.max(c.fitColumns.x+d,c.fitColumns.width),c.fitColumns.y+=e});return this},_fitColumnsGetContainerSize:function(){return{width:this.fitColumns.width}},_fitColumnsResize:function(){return this.reLayout()},_cellsByColumnReset:function(){this.cellsByColumn={},this._getSegments("cellsByColumn",!0),this.cellsByColumn.columnWidth=this.options.cellsByColumn.columnWidth||this.$allAtoms.outerHeight(!0);return this},_cellsByColumnLayout:function(a){var c=this,d=this.cellsByColumn.rows;this.cellsByColumn.atomsLen=a.length,a.each(function(a){var e=b(this),f=(~~(a/d)+.5)*c.cellsByColumn.columnWidth-e.outerWidth(!0)/2+c.posLeft,g=(a%d+.5)*c.cellsByColumn.rowHeight-e.outerHeight(!0)/2+c.posTop;c._pushPosition(e,f,g)});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",!0),this.cellsByColumn.rows!==a&&this.reLayout();return this},_straightAcrossReset:function(){this.straightAcross={x:0};return this},_straightAcrossLayout:function(a){var c=this;a.each(function(a){var d=b(this),e=c.straightAcross.x+c.posLeft;c._pushPosition(d,e,c.posTop),c.straightAcross.x+=d.outerWidth(!0)});return this},_straightAcrossGetContainerSize:function(){return{width:this.straightAcross.x+this.posLeft}},_straightAcrossResize:function(){this.reLayout();return this}},b.fn.imagesLoaded=function(a){var b=this.find("img"),d=b.length,e=this;b.length||a.call(this),b.bind("load",function(){--d<=0&&a.call(e)}).each(function(){if(this.complete||this.complete===c){var a=this.src;this.src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==",this.src=a}});return this},b.fn.isotope=function(a){if(typeof a=="string"){var c=Array.prototype.slice.call(arguments,1);return this.each(function(){var d=b.data(this,"isotope");if(!d)return b.error("cannot call methods on isotope prior to initialization; attempted to call method '"+a+"'");if(!b.isFunction(d[a])||a.charAt(0)==="_")return b.error("no such method '"+a+"' for isotope instance");d[a].apply(d,c)})}return this.each(function(){var c=b.data(this,"isotope");c?c.option(a||{})._init():b.data(this,"isotope",new b.Isotope(a,this))})}})(window,jQuery); +(function(a,b,c){var d=function(){function b(b,c){c=c||document.documentElement;var d=c.style,e;if(typeof d[b]=="string")return b;b=b.charAt(0).toUpperCase()+b.slice(1);for(var f=0,g=a.length;fg?1:fc.width&&(c.fitRows.x=0,c.fitRows.y=c.fitRows.height),f=c.fitRows.x+c.posLeft,g=c.fitRows.y+c.posTop,c._pushPosition(a,f,g),c.fitRows.height=Math.max(c.fitRows.y+e,c.fitRows.height),c.fitRows.x+=d})},_fitRowsReset:function(){this.fitRows={x:0,y:0,height:0}},_fitRowsGetContainerSize:function(){return{height:this.fitRows.height}},_fitRowsResize:function(){this.reLayout()},_cellsByRowReset:function(){this.cellsByRow={},this._getSegments("cellsByRow"),this.cellsByRow.rowHeight=this.options.cellsByRow.rowHeight||this.$allAtoms.outerHeight(!0)},_cellsByRowLayout:function(a){var c=this,d=this.cellsByRow.cols;this.cellsByRow.atomsLen=a.length,a.each(function(a){var e=b(this),f=(a%d+.5)*c.cellsByRow.columnWidth-e.outerWidth(!0)/2+c.posLeft,g=(~~(a/d)+.5)*c.cellsByRow.rowHeight-e.outerHeight(!0)/2+c.posTop;c._pushPosition(e,f,g)})},_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()},_straightDownReset:function(){this.straightDown={y:0}},_straightDownLayout:function(a){var c=this;a.each(function(a){var d=b(this),e=c.straightDown.y+c.posTop;c._pushPosition(d,c.posLeft,e),c.straightDown.y+=d.outerHeight(!0)})},_straightDownGetContainerSize:function(){return{height:this.straightDown.y+this.posTop}},_straightDownResize:function(){this.reLayout()},_masonryHorizontalPlaceBrick:function(a,b,c){var d=Math.min.apply(Math,c),e=d+a.outerWidth(!0),f=c.length,g=f,h=this.masonryHorizontal.rows+1-f,i,j;while(f--)c[f]===d&&(g=f);i=d,j=this.masonryHorizontal.rowHeight*g+this.posTop,this._pushPosition(a,i,j);for(f=0;fc.height&&(c.fitColumns.x=c.fitColumns.width,c.fitColumns.y=0),f=c.fitColumns.x+c.posLeft,g=c.fitColumns.y+c.posTop,c._pushPosition(a,f,g),c.fitColumns.width=Math.max(c.fitColumns.x+d,c.fitColumns.width),c.fitColumns.y+=e})},_fitColumnsGetContainerSize:function(){return{width:this.fitColumns.width}},_fitColumnsResize:function(){this.reLayout()},_cellsByColumnReset:function(){this.cellsByColumn={},this._getSegments("cellsByColumn",!0),this.cellsByColumn.columnWidth=this.options.cellsByColumn.columnWidth||this.$allAtoms.outerHeight(!0)},_cellsByColumnLayout:function(a){var c=this,d=this.cellsByColumn.rows;this.cellsByColumn.atomsLen=a.length,a.each(function(a){var e=b(this),f=(~~(a/d)+.5)*c.cellsByColumn.columnWidth-e.outerWidth(!0)/2+c.posLeft,g=(a%d+.5)*c.cellsByColumn.rowHeight-e.outerHeight(!0)/2+c.posTop;c._pushPosition(e,f,g)})},_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",!0),this.cellsByColumn.rows!==a&&this.reLayout()},_straightAcrossReset:function(){this.straightAcross={x:0}},_straightAcrossLayout:function(a){var c=this;a.each(function(a){var d=b(this),e=c.straightAcross.x+c.posLeft;c._pushPosition(d,e,c.posTop),c.straightAcross.x+=d.outerWidth(!0)})},_straightAcrossGetContainerSize:function(){return{width:this.straightAcross.x+this.posLeft}},_straightAcrossResize:function(){this.reLayout()}},b.fn.imagesLoaded=function(a){var b=this.find("img"),d=b.length,e=this;b.length||a.call(this),b.bind("load",function(){--d<=0&&a.call(e)}).each(function(){if(this.complete||this.complete===c){var a=this.src;this.src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==",this.src=a}});return this},b.fn.isotope=function(a){if(typeof a=="string"){var c=Array.prototype.slice.call(arguments,1);this.each(function(){var d=b.data(this,"isotope");if(!d)return b.error("cannot call methods on isotope prior to initialization; attempted to call method '"+a+"'");if(!b.isFunction(d[a])||a.charAt(0)==="_")return b.error("no such method '"+a+"' for isotope instance");d[a].apply(d,c)})}else this.each(function(){var c=b.data(this,"isotope");c?(c.option(a||{}),c._init()):b.data(this,"isotope",new b.Isotope(a,this))});return this}})(window,jQuery); From 03640e524b4b21d58fd08fe48c3f0a42ec643379 Mon Sep 17 00:00:00 2001 From: David DeSandro Date: Mon, 23 May 2011 15:22:21 -0400 Subject: [PATCH 03/17] src : whitespace fixes --- jquery.isotope.js | 59 +++++++++++++++++++++++------------------------ 1 file changed, 29 insertions(+), 30 deletions(-) diff --git a/jquery.isotope.js b/jquery.isotope.js index c9b2d56..07792f5 100644 --- a/jquery.isotope.js +++ b/jquery.isotope.js @@ -575,9 +575,8 @@ return $(elem).data('isotope-sort-data')[ sortBy ]; }, - // ====================== Layout ====================== + // ====================== Layout Helpers ====================== - _translate : function( x, y ) { return { translate : [ x, y ] }; }, @@ -788,10 +787,10 @@ }, - // ====================== LAYOUTS ====================== + // ====================== LAYOUTS ====================== - // ====================== Masonry ====================== + // ====================== Masonry ====================== _masonryPlaceBrick : function( $brick, setCount, setY ) { // here, `this` refers to a child element or "brick" @@ -883,7 +882,7 @@ }, - // ====================== fitRows ====================== + // ====================== fitRows ====================== _fitRowsLayout : function( $elems ) { this.width = this.element.width(); @@ -929,7 +928,7 @@ }, - // ====================== cellsByRow ====================== + // ====================== cellsByRow ====================== _cellsByRowReset : function() { this.cellsByRow = {}; @@ -966,7 +965,7 @@ }, - // ====================== straightDown ====================== + // ====================== straightDown ====================== _straightDownReset : function() { this.straightDown = { @@ -993,7 +992,7 @@ }, - // ====================== masonryHorizontal ====================== + // ====================== masonryHorizontal ====================== _masonryHorizontalPlaceBrick : function( $brick, setCount, setX ) { // here, `this` refers to a child element or "brick" @@ -1082,7 +1081,7 @@ }, - // ====================== fitColumns ====================== + // ====================== fitColumns ====================== _fitColumnsReset : function() { this.fitColumns = { @@ -1128,7 +1127,7 @@ - // ====================== cellsByColumn ====================== + // ====================== cellsByColumn ====================== _cellsByColumnReset : function() { this.cellsByColumn = {}; @@ -1166,29 +1165,29 @@ // ====================== straightAcross ====================== - _straightAcrossReset : function() { - this.straightAcross = { - x : 0 - }; - }, + _straightAcrossReset : function() { + this.straightAcross = { + x : 0 + }; + }, - _straightAcrossLayout : function( $elems ) { - var instance = this; - $elems.each( function( i ){ - var $this = $(this), - x = instance.straightAcross.x + instance.posLeft; - instance._pushPosition( $this, x, instance.posTop ); - instance.straightAcross.x += $this.outerWidth(true); - }); - }, + _straightAcrossLayout : function( $elems ) { + var instance = this; + $elems.each( function( i ){ + var $this = $(this), + x = instance.straightAcross.x + instance.posLeft; + instance._pushPosition( $this, x, instance.posTop ); + instance.straightAcross.x += $this.outerWidth(true); + }); + }, - _straightAcrossGetContainerSize : function() { - return { width : this.straightAcross.x + this.posLeft }; - }, + _straightAcrossGetContainerSize : function() { + return { width : this.straightAcross.x + this.posLeft }; + }, - _straightAcrossResize : function() { - this.reLayout(); - } + _straightAcrossResize : function() { + this.reLayout(); + } }; From 6a4997b017915913e4edd0cc63aff133942fa6d3 Mon Sep 17 00:00:00 2001 From: David DeSandro Date: Mon, 23 May 2011 15:58:01 -0400 Subject: [PATCH 04/17] tests : add notes and buttons --- _posts/tests/2011-03-27-destroy01.html | 19 +++++++-- _posts/tests/2011-03-27-no-items01.html | 4 +- .../2011-04-26-item-position-data01.html | 40 +++++++------------ 3 files changed, 32 insertions(+), 31 deletions(-) diff --git a/_posts/tests/2011-03-27-destroy01.html b/_posts/tests/2011-03-27-destroy01.html index 94f31de..12c22a6 100644 --- a/_posts/tests/2011-03-27-destroy01.html +++ b/_posts/tests/2011-03-27-destroy01.html @@ -12,7 +12,12 @@ category: tests
-

After destroy-ing Isotope, original CSS gets re-applied

+

Click init button the destroy. Original CSS, pre-init, should be re-applied, all items back to visibility.

+
+ +
+ +
@@ -28,9 +33,15 @@ category: tests var $container = $('#container'); - $container.isotope({ - itemSelector: '.element', - filter: '.metal' + $('#init').click(function(){ + $container.isotope({ + itemSelector: '.element', + filter: '.metal' + }); + }); + + $('#destroy').click(function(){ + $container.isotope('destroy'); }); }); diff --git a/_posts/tests/2011-03-27-no-items01.html b/_posts/tests/2011-03-27-no-items01.html index 50c73f1..14cf5d8 100644 --- a/_posts/tests/2011-03-27-no-items01.html +++ b/_posts/tests/2011-03-27-no-items01.html @@ -5,7 +5,7 @@ category: tests ---
-

What happens when there are no items for Isotope/

+

What happens when there are no items for Isotope? If no items match `itemSelector`, container collapses. Plugin still return this.

@@ -23,7 +23,7 @@ category: tests $container.isotope({ itemSelector: '.foo' - }); + }).css('border', '10px solid'); }); \ No newline at end of file diff --git a/_posts/tests/2011-04-26-item-position-data01.html b/_posts/tests/2011-04-26-item-position-data01.html index d9a6a3a..25b2bd7 100644 --- a/_posts/tests/2011-04-26-item-position-data01.html +++ b/_posts/tests/2011-04-26-item-position-data01.html @@ -5,30 +5,11 @@ category: tests ---
-

+

itemPositionDataEnabled option is enabled.

-

Filters

- - - {% include sort-buttons.html %}

Etc

@@ -39,7 +20,7 @@ category: tests
-
+
{% for element in site.elements limit:40 %} {% include element-partial.html %} {% endfor %} @@ -48,16 +29,25 @@ category: tests