You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Vestride_Shuffle/js/jquery.shuffle.min.js

18 lines
5.2 KiB
JavaScript

// IMPORTANT!
// If you're already using Modernizr, delete it from this file. If you don't know what Modernizr is, leave it :)
/* Modernizr 2.0.6 (Custom Build) | MIT & BSD
* Build: http://www.modernizr.com/download/#-csstransforms-csstransforms3d-csstransitions-cssclasses-teststyles-testprop-testallprops-prefixes-domprefixes
*/
;window.Modernizr=function(a,b,c){function C(a,b){var c=a.charAt(0).toUpperCase()+a.substr(1),d=(a+" "+o.join(c+" ")+c).split(" ");return B(d,b)}function B(a,b){for(var d in a)if(k[a[d]]!==c)return b=="pfx"?a[d]:!0;return!1}function A(a,b){return!!~(""+a).indexOf(b)}function z(a,b){return typeof a===b}function y(a,b){return x(n.join(a+";")+(b||""))}function x(a){k.cssText=a}var d="2.0.6",e={},f=!0,g=b.documentElement,h=b.head||b.getElementsByTagName("head")[0],i="modernizr",j=b.createElement(i),k=j.style,l,m=Object.prototype.toString,n=" -webkit- -moz- -o- -ms- -khtml- ".split(" "),o="Webkit Moz O ms Khtml".split(" "),p={},q={},r={},s=[],t=function(a,c,d,e){var f,h,j,k=b.createElement("div");if(parseInt(d,10))while(d--)j=b.createElement("div"),j.id=e?e[d]:i+(d+1),k.appendChild(j);f=["&shy;","<style>",a,"</style>"].join(""),k.id=i,k.innerHTML+=f,g.appendChild(k),h=c(k,a),k.parentNode.removeChild(k);return!!h},u,v={}.hasOwnProperty,w;!z(v,c)&&!z(v.call,c)?w=function(a,b){return v.call(a,b)}:w=function(a,b){return b in a&&z(a.constructor.prototype[b],c)};var D=function(a,c){var d=a.join(""),f=c.length;t(d,function(a,c){var d=b.styleSheets[b.styleSheets.length-1],g=d.cssRules&&d.cssRules[0]?d.cssRules[0].cssText:d.cssText||"",h=a.childNodes,i={};while(f--)i[h[f].id]=h[f];e.csstransforms3d=i.csstransforms3d.offsetLeft===9},f,c)}([,["@media (",n.join("transform-3d),("),i,")","{#csstransforms3d{left:9px;position:absolute}}"].join("")],[,"csstransforms3d"]);p.csstransforms=function(){return!!B(["transformProperty","WebkitTransform","MozTransform","OTransform","msTransform"])},p.csstransforms3d=function(){var a=!!B(["perspectiveProperty","WebkitPerspective","MozPerspective","OPerspective","msPerspective"]);a&&"webkitPerspective"in g.style&&(a=e.csstransforms3d);return a},p.csstransitions=function(){return C("transitionProperty")};for(var E in p)w(p,E)&&(u=E.toLowerCase(),e[u]=p[E](),s.push((e[u]?"":"no-")+u));x(""),j=l=null,e._version=d,e._prefixes=n,e._domPrefixes=o,e.testProp=function(a){return B([a])},e.testAllProps=C,e.testStyles=t,g.className=g.className.replace(/\bno-js\b/,"")+(f?" js "+s.join(" "):"");return e}(this,this.document);
/**
* jQuery Shuffle Plugin
* Uses CSS Transforms to filter down a grid of items (degrades to jQuery's animate).
* Inspired by Isotope http://isotope.metafizzy.co/
* Copyright (c) 2011 Glen Cheney cheney [dot] glen [at] gmail [dot] com http://glencheney.com
* @author Glen Cheney
* @version 1.2
* @date 12.15.11
*/
(function(a){var b={init:function(c){var d={itemWidth:230,margins:20,key:"all"};if(c){a.extend(d,c)}return this.each(function(){var c=a(this),e=c.children(),f=Math.floor(c.width()/d.itemWidth),g=2,h=e.first().outerHeight(),i;i={$items:e,itemsPerRow:f,numRows:g,itemHeight:h,itemWidth:d.itemWidth,margins:d.margins};c.data("shuffle",i);if(!Modernizr.csstransforms||!Modernizr.csstransitions){b.setPrefixedCss(e,"transition","none")}b.shuffle.call(this,"all")})},shuffle:function(c){var d=a(this),e=d.data("shuffle"),f,g;if(!e){b.init.call(this);e=a(this).data("shuffle")}if(!c)c="all";if(c=="all"){e.$items.removeClass("concealed")}else{e.$items.removeClass("concealed filtered").each(function(){var b=a(this).attr("data-key"),d=a.parseJSON(b);if(a.inArray(c,d)===-1){a(this).addClass("concealed");return}})}f=e.$items.not(".concealed").addClass("filtered").length;b.shrink.call(this);b.filter.call(this);g=Math.ceil(f/e.itemsPerRow)*(e.itemHeight+e.margins)-e.margins;d.css("height",g+"px")},shrink:function(){var c=a(this).find(".concealed");if(c.length===0){return}c.each(function(){var c=a(this),d=parseInt(c.attr("data-x")),e=parseInt(c.attr("data-y")),f=c.parent().data("shuffle");if(!d)d=0;if(!e)e=0;b.transition({$this:c,x:d,y:e,left:d+f.itemWidth/2+"px",top:e+f.itemHeight/2+"px",scale:.001,opacity:0,height:"0px",width:"0px"})})},filter:function(){var c=0,d=a(this).find(".filtered");d.each(function(d){var e=a(this),f=e.parent().data("shuffle"),g=d%f.itemsPerRow*(f.itemWidth+f.margins),h=Math.floor(d/f.itemsPerRow);if(d%f.itemsPerRow==0){c=h*(f.itemHeight+f.margins)}e.attr({"data-x":g,"data-y":c});b.transition({$this:e,x:g,y:c,left:g+"px",top:c+"px",scale:1,opacity:1,height:f.itemHeight+"px",width:f.itemWidth+"px"})})},setPrefixedCss:function(a,b,c){a.css(Modernizr.testAllProps(b,"pfx"),c)},transition:function(a){var c;if(Modernizr.csstransforms&&Modernizr.csstransitions){if(Modernizr.csstransforms3d){c="translate3d("+a.x+"px, "+a.y+"px, 0px) scale3d("+a.scale+", "+a.scale+", "+a.scale+")"}else{c="translate("+a.x+"px, "+a.y+"px) scale("+a.scale+", "+a.scale+")"}b.setPrefixedCss(a.$this,"transform",c)}else{a.$this.animate({left:a.left,top:a.top,opacity:a.opacity,height:a.height,width:a.width},800)}}};a.fn.shuffle=function(c){if(b[c]){return b[c].apply(this,Array.prototype.slice.call(arguments,1))}else if(typeof c==="object"||!c){return b.init.apply(this,arguments)}else{a.error("Method "+c+" does not exist on jQuery.shuffle");return false}}})(jQuery)