Filter & sort magical layouts http://isotope.metafizzy.co
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

13 lines
15 KiB

/**
* Isotope v1.4.110629
* An exquisite jQuery plugin for magical layouts
* http://isotope.metafizzy.co
*
* Commercial use requires one-time license fee
* http://metafizzy.co/#licenses
*
* Copyright 2011 David DeSandro / Metafizzy
*/
/*global Modernizr: true */
(function(a,b,c){function f(a,b){b=b||document.documentElement;var c=b.style,f;if(typeof c[a]=="string")return a;a=d(a);for(var g=0,h=e.length;g<h;g++){f=e[g]+a;if(typeof c[f]=="string")return f}}function d(a){return a.charAt(0).toUpperCase()+a.slice(1)}var e="Moz Webkit Khtml O Ms".split(" "),g=f("transform"),h=document.documentElement,i=[{name:"csstransforms",getResult:function(){return!!g}},{name:"csstransforms3d",getResult:function(){var a=!!f("perspective");if(a){var b=document.createElement("style"),c=document.createElement("div"),d=" -o- -moz- -ms- -webkit- -khtml- ".split(" "),e="@media ("+d.join("transform-3d),(")+"modernizr)";b.textContent=e+"{#modernizr{height:3px}}",(document.head||document.getElementsByTagName("head")[0]).appendChild(b),c.id="modernizr",h.appendChild(c),a=c.offsetHeight===3,b.parentNode.removeChild(b),c.parentNode.removeChild(c)}return!!a}},{name:"csstransitions",getResult:function(){return!!f("transitionProperty")}}],j,k=i.length;if(a.Modernizr)for(j=0;j<k;j++){var l=i[j];Modernizr.hasOwnProperty(l.name)||Modernizr.addTest(l.name,l.getResult)}else a.Modernizr=function(){var a={_version:"1.6ish: miniModernizr for Isotope"},b=[],c,d,e;for(j=0;j<k;j++)c=i[j],d=c.getResult(),a[c.name]=d,e=(d?"":"no-")+c.name,b.push(e);h.className+=" "+b.join(" ");return a}();if(Modernizr.csstransforms){var m=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+") "}},n=function(a,c,d){var e=b.data(a,"isoTransform")||{},f={},h,i={},j;f[c]=d,b.extend(e,f);for(h in e)j=e[h],i[h]=m[h](j);var k=i.translate||"",l=i.scale||"",n=k+l;b.data(a,"isoTransform",e),a.style[g]=n};b.cssNumber.scale=!0,b.cssHooks.scale={set:function(a,b){n(a,"scale",b)},get:function(a,c){var d=b.data(a,"isoTransform");return d&&d.scale?d.scale:1}},b.fx.step.scale=function(a){b.cssHooks.scale.set(a.elem,a.now+a.unit)},b.cssNumber.translate=!0,b.cssHooks.translate={set:function(a,b){n(a,"translate",b)},get:function(a,c){var d=b.data(a,"isoTransform");return d&&d.translate?d.translate:[0,0]}}}var o=b.event,p;o.special.smartresize={setup:function(){b(this).bind("resize",o.special.smartresize.handler)},teardown:function(){b(this).unbind("resize",o.special.smartresize.handler)},handler:function(a,b){var c=this,d=arguments;a.type="smartresize",p&&clearTimeout(p),p=setTimeout(function(){jQuery.event.handle.apply(c,d)},b==="execAsap"?0:100)}},b.fn.smartresize=function(a){return a?this.bind("smartresize",a):this.trigger("smartresize",["execAsap"])},b.Isotope=function(a,c){this.element=b(c),this._create(a),this._init()};var q=["overflow","position","width","height"];b.Isotope.settings={resizable:!0,layoutMode:"masonry",containerClass:"isotope",itemClass:"isotope-item",hiddenClass:"isotope-hidden",hiddenStyle:Modernizr.csstransforms&&!b.browser.opera?{opacity:0,scale:.001}:{opacity:0},visibleStyle:Modernizr.csstransforms&&!b.browser.opera?{opacity:1,scale:1}:{opacity:1},animationEngine:b.browser.opera?"jquery":"best-available",animationOptions:{queue:!1,duration:800},sortBy:"original-order",sortAscending:!0,resizesContainer:!0,transformsEnabled:!0,itemPositionDataEnabled:!1},b.Isotope.prototype={_create:function(c){this.options=b.extend(!0,{},b.Isotope.settings,c),this.styleQueue=[],this.elemCount=0;var d=this.element[0].style;this.originalStyle={};for(var e=0,f=q.length;e<f;e++){var g=q[e];this.originalStyle[g]=d[g]||null}this.element.css({overflow:"hidden",position:"relative"}),this._updateAnimationEngine(),this._updateUsingTransforms();var h={"original-order":function(a,b){return b.elemCount},random:function(){return Math.random()}};this.options.getSortData=b.extend(this.options.getSortData,h),this.reloadItems();var i=b(document.createElement("div")).prependTo(this.element);this.offset=i.position(),i.remove();var j=this;setTimeout(function(){j.element.addClass(j.options.containerClass)},0),this.options.resizable&&b(a).bind("smartresize.isotope",function()