From 052c2c8c08f9bb531754b126282250338713a82b Mon Sep 17 00:00:00 2001 From: David DeSandro Date: Sat, 12 Feb 2011 11:34:05 -0500 Subject: [PATCH 1/3] src : Don't overwrite previous Modernizr. use Modernizr.addTest if available --- jquery.isotope.js | 151 +++++++++++++++++++++++++++------------------- 1 file changed, 88 insertions(+), 63 deletions(-) diff --git a/jquery.isotope.js b/jquery.isotope.js index 4d16a56..15e3a1e 100644 --- a/jquery.isotope.js +++ b/jquery.isotope.js @@ -70,72 +70,97 @@ /* * 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(' '), - classes = [], - docElement = document.documentElement, - i, len, - - tests = [ - { - name : 'csstransforms', - result : function() { - return !!getStyleProperty('transform'); - } - }, - { - name : 'csstransforms3d', - result : function() { - var test = !!getStyleProperty('perspective'); - // double check for Chrome's false positive - if ( test ){ - var st = document.createElement('style'), - div = document.createElement('div'), - mq = '@media (' + vendorCSSPrefixes.join('transform-3d),(') + 'modernizr)'; - - st.textContent = mq + '{#modernizr{height:3px}}'; - (doc.head || doc.getElementsByTagName('head')[0]).appendChild(st); - div.id = 'modernizr'; - docElement.appendChild(div); - - test = div.offsetHeight === 3; - - st.parentNode.removeChild(st); - div.parentNode.removeChild(div); - } - return !!test; - } - }, - { - name : 'csstransitions', - result : function() { - return !!getStyleProperty('transitionProperty'); + var tests = [ + { + name : 'csstransforms', + getResult : function() { + return !!getStyleProperty('transform'); + } + }, + { + name : 'csstransforms3d', + getResult : function() { + var test = !!getStyleProperty('perspective'); + // double check for Chrome's false positive + if ( test ){ + var st = document.createElement('style'), + div = document.createElement('div'), + mq = '@media (' + vendorCSSPrefixes.join('transform-3d),(') + 'modernizr)'; + + st.textContent = mq + '{#modernizr{height:3px}}'; + (doc.head || doc.getElementsByTagName('head')[0]).appendChild(st); + div.id = 'modernizr'; + docElement.appendChild(div); + + test = div.offsetHeight === 3; + + st.parentNode.removeChild(st); + div.parentNode.removeChild(div); } + return !!test; } - ] - ; - - - // 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 ); - } - - // Add the new classes to the element. - docElement.className += ' ' + classes.join( ' ' ); - - return miniModernizr; - - })(this,this.document); + }, + { + name : 'csstransitions', + getResult : function() { + return !!getStyleProperty('transitionProperty'); + } + } + ], + + i, len = tests.length + + ; + + if ( window.Modernizr ) { + // hasOwnProperty shim by kangax needed for Safari 2.0 support + // var _hasOwnProperty = ({}).hasOwnProperty, hasOwnProperty; + // if (!is(_hasOwnProperty, undefined) && !is(_hasOwnProperty.call, undefined)) { + // hasOwnProperty = function (object, property) { + // return _hasOwnProperty.call(object, property); + // }; + // } + // else { + // hasOwnProperty = function (object, property) { + // return ((property in object) && is(object.constructor.prototype[property], undefined)); + // }; + // } + + for ( i=0; i < len; i++ ) { + var test = test[i]; + + if ( !Modernizr.hasOwnProperty( test.name ) ) { + Modernizr.addTest( test.name, test.getResult ); + } + + } + } else { + window.Modernizr = (function(){ + + var version = '1.6ish: miniModernizr for Isotope', + miniModernizr = {}, + vendorCSSPrefixes = ' -o- -moz- -ms- -webkit- -khtml- '.split(' '), + classes = [], + test, result, className; + + // Run through all tests and detect their support in the current UA. + for ( i=0; i < len; i++ ) { + test = tests[i]; + result = test.getResult(); + miniModernizr[ test.name ] = result; + className = ( result ? '' : 'no-' ) + test.name; + classes.push( className ); + } + + // Add the new classes to the element. + document.documentElement.className += ' ' + classes.join( ' ' ); + + return miniModernizr; + + })(); + } From d14a8814021bb34865b7287e640360bd95f4d4da Mon Sep 17 00:00:00 2001 From: David DeSandro Date: Sat, 12 Feb 2011 22:46:27 -0500 Subject: [PATCH 2/3] src : Modernizr - missing vars and white space fixes --- jquery.isotope.js | 88 ++++++++++++++++++++--------------------------- 1 file changed, 38 insertions(+), 50 deletions(-) diff --git a/jquery.isotope.js b/jquery.isotope.js index 15e3a1e..5ef4d47 100644 --- a/jquery.isotope.js +++ b/jquery.isotope.js @@ -72,7 +72,9 @@ * CSS transitions, transforms, and 3D transforms. */ - var tests = [ + var docElement = document.documentElement, + vendorCSSPrefixes = ' -o- -moz- -ms- -webkit- -khtml- '.split(' '), + tests = [ { name : 'csstransforms', getResult : function() { @@ -90,7 +92,7 @@ mq = '@media (' + vendorCSSPrefixes.join('transform-3d),(') + 'modernizr)'; st.textContent = mq + '{#modernizr{height:3px}}'; - (doc.head || doc.getElementsByTagName('head')[0]).appendChild(st); + (document.head || document.getElementsByTagName('head')[0]).appendChild(st); div.id = 'modernizr'; docElement.appendChild(div); @@ -111,56 +113,42 @@ ], i, len = tests.length - ; - if ( window.Modernizr ) { - // hasOwnProperty shim by kangax needed for Safari 2.0 support - // var _hasOwnProperty = ({}).hasOwnProperty, hasOwnProperty; - // if (!is(_hasOwnProperty, undefined) && !is(_hasOwnProperty.call, undefined)) { - // hasOwnProperty = function (object, property) { - // return _hasOwnProperty.call(object, property); - // }; - // } - // else { - // hasOwnProperty = function (object, property) { - // return ((property in object) && is(object.constructor.prototype[property], undefined)); - // }; - // } - - for ( i=0; i < len; i++ ) { - var test = test[i]; - - if ( !Modernizr.hasOwnProperty( test.name ) ) { - Modernizr.addTest( test.name, test.getResult ); - } - - } - } else { - window.Modernizr = (function(){ - - var version = '1.6ish: miniModernizr for Isotope', - miniModernizr = {}, - vendorCSSPrefixes = ' -o- -moz- -ms- -webkit- -khtml- '.split(' '), - classes = [], - test, result, className; - - // Run through all tests and detect their support in the current UA. - for ( i=0; i < len; i++ ) { - test = tests[i]; - result = test.getResult(); - miniModernizr[ test.name ] = result; - className = ( result ? '' : 'no-' ) + test.name; - classes.push( className ); - } - - // Add the new classes to the element. - document.documentElement.className += ' ' + classes.join( ' ' ); - - return miniModernizr; - - })(); - } + if ( window.Modernizr ) { + // if there's a previous Modernzir, check if there are necessary tests + for ( i=0; i < len; i++ ) { + var test = tests[i]; + if ( !Modernizr.hasOwnProperty( test.name ) ) { + // if test hasn't been run, use addTest to run it + Modernizr.addTest( test.name, test.getResult ); + } + } + } else { + // or create new mini Modernizr that just has the 3 tests + window.Modernizr = (function(){ + + var miniModernizr = { + _version : '1.6ish: miniModernizr for Isotope' + }, + classes = [], + test, result, className; + + // Run through tests + for ( i=0; i < len; i++ ) { + test = tests[i]; + result = test.getResult(); + miniModernizr[ test.name ] = result; + className = ( result ? '' : 'no-' ) + test.name; + classes.push( className ); + } + + // Add the new classes to the element. + docElement.className += ' ' + classes.join( ' ' ); + + return miniModernizr; + })(); + } From 96ecc0b59e4fe35eb71203e56832bf4546aa4615 Mon Sep 17 00:00:00 2001 From: David DeSandro Date: Sat, 12 Feb 2011 22:50:43 -0500 Subject: [PATCH 3/3] src : update version and min version --- jquery.isotope.js | 2 +- jquery.isotope.min.js | 61 ++++++++++++++++++++++--------------------- 2 files changed, 32 insertions(+), 31 deletions(-) diff --git a/jquery.isotope.js b/jquery.isotope.js index 5ef4d47..463e0d0 100644 --- a/jquery.isotope.js +++ b/jquery.isotope.js @@ -1,5 +1,5 @@ /** - * Isotope v1.0.110211 + * Isotope v1.0.110212 * An exquisite jQuery plugin for magical layouts * http://isotope.metafizzy.co * diff --git a/jquery.isotope.min.js b/jquery.isotope.min.js index 16ba2ef..738dc90 100644 --- a/jquery.isotope.min.js +++ b/jquery.isotope.min.js @@ -1,5 +1,5 @@ /** - * Isotope v1.0.110211 + * Isotope v1.0.110212 * An exquisite jQuery plugin for magical layouts * http://isotope.metafizzy.co * @@ -8,32 +8,33 @@ * * Copyright 2011 David DeSandro / Metafizzy */ -(function(n,f,t){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===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); +(function(l,f,r){var m=function(){var a=["Moz","Webkit","Khtml","O","Ms"],b={};return function(c,d){d=d||document.documentElement;var e=d.style,g,h,i,s;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(s=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===r){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!==r){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);