Browse Source

src : JSHints; add JSHint options

pull/96/head
David DeSandro 14 years ago
parent
commit
8fb844ba82
  1. 12
      jquery.isotope.js
  2. 4
      jquery.isotope.min.js

12
jquery.isotope.js

@ -9,6 +9,9 @@
* Copyright 2011 David DeSandro / Metafizzy
*/
/*jshint forin: false */
/*global jQuery: true, Modernizr: true */
(function( window, $, undefined ){
// ========================= getStyleProperty by kangax ===============================
@ -24,7 +27,9 @@
prefixed;
// test standard property first
if (typeof style[propName] == 'string') return propName;
if (typeof style[propName] === 'string') {
return propName;
}
// capitalize
propName = propName.charAt(0).toUpperCase() + propName.slice(1);
@ -32,7 +37,9 @@
// test vendor specific properties
for (var i=0, l=prefixes.length; i<l; i++) {
prefixed = prefixes[i] + propName;
if (typeof style[prefixed] == 'string') return prefixed;
if (typeof style[prefixed] === 'string') {
return prefixed;
}
}
}
@ -432,6 +439,7 @@
// signature: $('#foo').bar({ cool:false });
if ( $.isPlainObject( key ) ){
this.options = $.extend(true, this.options, key);
var optionName;
for ( optionName in key ) {
this._updateOption( optionName );
}

4
jquery.isotope.min.js vendored

@ -8,7 +8,7 @@
*
* Copyright 2011 David DeSandro / Metafizzy
*/
(function(k,f,v){var m=function(){var a=["Moz","Webkit","Khtml","O","Ms"];return function(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 g=0,h=a.length;g<h;g++){e=a[g]+b;if(typeof d[e]=="string")return e}}}(),n=m("transform"),s=document.documentElement,w=" -o- -moz- -ms- -webkit- -khtml- ".split(" "),o=[{name:"csstransforms",getResult:function(){return!!n}},{name:"csstransforms3d",getResult:function(){var a=!!m("perspective");
(function(k,f,v){var m=function(){var a=["Moz","Webkit","Khtml","O","Ms"];return function(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 g=0,h=a.length;g<h;g++){e=a[g]+b;if(typeof d[e]==="string")return e}}}(),n=m("transform"),s=document.documentElement,w=" -o- -moz- -ms- -webkit- -khtml- ".split(" "),o=[{name:"csstransforms",getResult:function(){return!!n}},{name:"csstransforms3d",getResult:function(){var a=!!m("perspective");
if(a){var b=document.createElement("style"),c=document.createElement("div");a="@media ("+w.join("transform-3d),(")+"modernizr)";b.textContent=a+"{#modernizr{height:3px}}";(document.head||document.getElementsByTagName("head")[0]).appendChild(b);c.id="modernizr";s.appendChild(c);a=c.offsetHeight===3;b.parentNode.removeChild(b);c.parentNode.removeChild(c)}return!!a}},{name:"csstransitions",getResult:function(){return!!m("transitionProperty")}}],j,t=o.length;if(k.Modernizr)for(j=0;j<t;j++){var p=o[j];
Modernizr.hasOwnProperty(p.name)||Modernizr.addTest(p.name,p.getResult)}else k.Modernizr=function(){var a={_version:"1.6ish: miniModernizr for Isotope"},b=[],c,d;for(j=0;j<t;j++){c=o[j];d=c.getResult();a[c.name]=d;c=(d?"":"no-")+c.name;b.push(c)}s.className+=" "+b.join(" ");return a}();if(Modernizr.csstransforms){var x=Modernizr.csstransforms3d?{translate:function(a){return"translate3d("+a[0]+"px, "+a[1]+"px, 0) "},scale:function(a){return"scale3d("+a+", "+a+", 1) "}}:{translate:function(a){return"translate("+
a[0]+"px, "+a[1]+"px) "},scale:function(a){return"scale("+a+") "}},u=function(a,b,c){var d=f(a),e=d.data("isoTransform")||{},g={},h,i={};g[b]=c;f.extend(e,g);for(h in e){b=e[h];i[h]=x[h](b)}h=(i.translate||"")+(i.scale||"");d.data("isoTransform",e);a.style[n]=h};f.cssNumber.scale=true;f.cssHooks.scale={set:function(a,b){if(typeof b==="string")b=parseFloat(b);u(a,"scale",b)},get:function(a){return(a=f.data(a,"isoTransform"))&&a.scale?a.scale:1}};f.fx.step.scale=function(a){f.cssHooks.scale.set(a.elem,
@ -16,7 +16,7 @@ a.now+a.unit)};f.cssNumber.translate=true;f.cssHooks.translate={set:function(a,b
d)},b==="execAsap"?0:100)}};f.fn.smartresize=function(a){return a?this.bind("smartresize",a):this.trigger("smartresize",["execAsap"])};f.Isotope=function(a,b){this.element=f(b);this._create(a);this._init()};var l=["overflow","position","width","height"];f.Isotope.settings={resizable:true,layoutMode:"masonry",containerClass:"isotope",itemClass:"isotope-item",hiddenClass:"isotope-hidden",hiddenStyle:Modernizr.csstransforms&&!f.browser.opera?{opacity:0,scale:0.0010}:{opacity:0},visibleStyle:Modernizr.csstransforms&&
!f.browser.opera?{opacity:1,scale:1}:{opacity:1},animationEngine:f.browser.opera?"jquery":"best-available",animationOptions:{queue:false,duration:800},sortBy:"original-order",sortAscending:true,resizesContainer:true,transformsEnabled:true,itemPositionDataEnabled:false};f.Isotope.prototype={_filterFind:function(a,b){return b?a.filter(b).add(a.find(b)):a},_create:function(a){this.options=f.extend(true,{},f.Isotope.settings,a);this.styleQueue=[];this.elemCount=0;this.$allAtoms=this._filterFind(this.element.children(),
this.options.itemSelector);a=this.element[0].style;this.originalStyle={};for(var b=0,c=l.length;b<c;b++){var d=l[b];this.originalStyle[d]=a[d]||null}this.element.css({overflow:"hidden",position:"relative"});this._updateAnimationEngine();this._updateUsingTransforms();this.options.getSortData=f.extend(this.options.getSortData,{"original-order":function(g,h){return h.elemCount}});this._setupAtoms(this.$allAtoms);a=f(document.createElement("div"));this.element.prepend(a);this.posTop=Math.round(a.position().top);
this.posLeft=Math.round(a.position().left);a.remove();var e=this;setTimeout(function(){e.element.addClass(e.options.containerClass)},0);this.options.resizable&&f(k).bind("smartresize.isotope",function(){e.element.isotope("resize")})},_init:function(a){this.$filteredAtoms=this._filter(this.$allAtoms);this._sort();this.reLayout(a)},option:function(a,b){if(f.isPlainObject(a)){this.options=f.extend(true,this.options,a);for(optionName in a)this._updateOption(optionName)}else if(a&&typeof b==="undefined")return this.options[a];
this.posLeft=Math.round(a.position().left);a.remove();var e=this;setTimeout(function(){e.element.addClass(e.options.containerClass)},0);this.options.resizable&&f(k).bind("smartresize.isotope",function(){e.element.isotope("resize")})},_init:function(a){this.$filteredAtoms=this._filter(this.$allAtoms);this._sort();this.reLayout(a)},option:function(a,b){if(f.isPlainObject(a)){this.options=f.extend(true,this.options,a);for(var c in a)this._updateOption(c)}else if(a&&typeof b==="undefined")return this.options[a];
else{this.options[a]=b;this._updateOption(a)}return this},_updateOption:function(a){a="_update"+a.charAt(0).toUpperCase()+a.slice(1);if(this[a])this[a]()},_updateAnimationEngine:function(){switch(this.options.animationEngine.toLowerCase().replace(/[ _\-]/g,"")){case "css":case "none":this.isUsingJQueryAnimation=false;break;case "jquery":this.isUsingJQueryAnimation=true;break;default:this.isUsingJQueryAnimation=!Modernizr.csstransitions}this._updateUsingTransforms()},_updateTransformsEnabled:function(){this._updateUsingTransforms()},
_updateUsingTransforms:function(){this.getPositionStyles=(this.usingTransforms=this.options.transformsEnabled&&Modernizr.csstransforms&&Modernizr.csstransitions&&!this.isUsingJQueryAnimation)?this._translate:this._positionAbs},_setupAtoms:function(a){var b={position:"absolute"};if(this.usingTransforms){b.left=0;b.top=0}a.css(b).addClass(this.options.itemClass);this.updateSortData(a,true)},_filter:function(a){var b=this.options.filter===""?"*":this.options.filter;if(b){var c=this.options.hiddenClass,
d="."+c,e=a.not(d),g=a.filter(d);d=g;a=a.filter(b);if(b!=="*"){d=g.filter(b);b=e.not(b).toggleClass(c);b.addClass(c);this.styleQueue.push({$el:b,style:this.options.hiddenStyle})}this.styleQueue.push({$el:d,style:this.options.visibleStyle});d.removeClass(c)}return a},updateSortData:function(a,b){var c=this,d=this.options.getSortData,e,g;a.each(function(){e=f(this);g={};for(var h in d)g[h]=d[h](e,c);e.data("isotope-sort-data",g);b&&c.elemCount++})},_sort:function(){var a=this.options.sortBy,b=this._getSorter,

Loading…
Cancel
Save