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

24 lines
6.3 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.6.1 (Custom Build) | MIT & BSD
* Build: http://modernizr.com/download/#-csstransforms-csstransforms3d-csstransitions-prefixed-teststyles-testprop-testallprops-prefixes-domprefixes
*/
;window.Modernizr=function(a,b,c){function y(a){i.cssText=a}function z(a,b){return y(l.join(a+";")+(b||""))}function A(a,b){return typeof a===b}function B(a,b){return!!~(""+a).indexOf(b)}function C(a,b){for(var d in a){var e=a[d];if(!B(e,"-")&&i[e]!==c)return b=="pfx"?e:!0}return!1}function D(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?a[e]:A(f,"function")?f.bind(d||b):f}return!1}function E(a,b,c){var d=a.charAt(0).toUpperCase()+a.slice(1),e=(a+" "+n.join(d+" ")+d).split(" ");return A(b,"string")||A(b,"undefined")?C(e,b):(e=(a+" "+o.join(d+" ")+d).split(" "),D(e,b,c))}var d="2.6.1",e={},f=b.documentElement,g="modernizr",h=b.createElement(g),i=h.style,j,k={}.toString,l=" -webkit- -moz- -o- -ms- ".split(" "),m="Webkit Moz O ms",n=m.split(" "),o=m.toLowerCase().split(" "),p={},q={},r={},s=[],t=s.slice,u,v=function(a,c,d,e){var h,i,j,k=b.createElement("div"),l=b.body,m=l?l:b.createElement("body");if(parseInt(d,10))while(d--)j=b.createElement("div"),j.id=e?e[d]:g+(d+1),k.appendChild(j);return h=["&#173;",'<style id="s',g,'">',a,"</style>"].join(""),k.id=g,(l?k:m).innerHTML+=h,m.appendChild(k),l||(m.style.background="",f.appendChild(m)),i=c(k,a),l?k.parentNode.removeChild(k):m.parentNode.removeChild(m),!!i},w={}.hasOwnProperty,x;!A(w,"undefined")&&!A(w.call,"undefined")?x=function(a,b){return w.call(a,b)}:x=function(a,b){return b in a&&A(a.constructor.prototype[b],"undefined")},Function.prototype.bind||(Function.prototype.bind=function(b){var c=this;if(typeof c!="function")throw new TypeError;var d=t.call(arguments,1),e=function(){if(this instanceof e){var a=function(){};a.prototype=c.prototype;var f=new a,g=c.apply(f,d.concat(t.call(arguments)));return Object(g)===g?g:f}return c.apply(b,d.concat(t.call(arguments)))};return e}),p.csstransforms=function(){return!!E("transform")},p.csstransforms3d=function(){var a=!!E("perspective");return a&&"webkitPerspective"in f.style&&v("@media (transform-3d),(-webkit-transform-3d){#modernizr{left:9px;position:absolute;height:3px;}}",function(b,c){a=b.offsetLeft===9&&b.offsetHeight===3}),a},p.csstransitions=function(){return E("transition")};for(var F in p)x(p,F)&&(u=F.toLowerCase(),e[u]=p[F](),s.push((e[u]?"":"no-")+u));return e.addTest=function(a,b){if(typeof a=="object")for(var d in a)x(a,d)&&e.addTest(d,a[d]);else{a=a.toLowerCase();if(e[a]!==c)return e;b=typeof b=="function"?b():b,enableClasses&&(f.className+=" "+(b?"":"no-")+a),e[a]=b}return e},y(""),h=j=null,e._version=d,e._prefixes=l,e._domPrefixes=o,e._cssomPrefixes=n,e.testProp=function(a){return C([a])},e.testAllProps=E,e.testStyles=v,e.prefixed=function(a,b,c){return b?E(a,b,c):E(a,"pfx")},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/
* Use it for whatever you want!
* @author Glen Cheney (http://glencheney.com)
* @version 1.4
* @date 7/21/12
*/
;(function(e,d){var g=function(a,c){var b=this;e(this);e.extend(b,{itemWidth:230,marginTop:20,marginRight:20,key:"all",speed:800,easing:"ease-out"},c,{$container:a,supported:d.csstransforms&&d.csstransitions});b.itemCss={position:"absolute",opacity:1,top:0,left:0,marginTop:b.marginTop,marginRight:b.marginRight,"float":"left"};b.$items=b.$container.children();b.itemsPerRow=Math.floor(b.$container.width()/b.itemWidth);b.itemHeight=b.$items.first().outerHeight();b.transitionName=b.prefixed("transition");
b.transform=b.getPrefixed("transform");b.$container.css("position","relative").get(0).style[b.transitionName]="height "+b.speed+"ms "+b.easing;b.$items.each(function(a){var c=b.itemCss;b.supported&&(this.style[b.transitionName]=b.transform+" "+b.speed+"ms "+b.easing+", opacity "+b.speed+"ms "+b.easing);0===(a+1)%b.itemsPerRow&&(c.marginRight=0);e(this).css(b.itemCss)});b.shuffle("all")};g.prototype={constructor:g,shuffle:function(a){var c=this,b;a||(a="all");"all"===a?c.$items.removeClass("concealed"):
c.$items.removeClass("concealed filtered").each(function(){var b=e(this).attr("data-key"),b=e.parseJSON(b);-1===e.inArray(a,b)&&e(this).addClass("concealed")});b=c.$items.not(".concealed").addClass("filtered").length;c.$container.trigger("shrink.shuffle",c);c.shrink();setTimeout(function(){c.$container.trigger("shrunk.shuffle",c)},c.speed);c.$container.trigger("filter.shuffle",c);c.filter();setTimeout(function(){c.$container.trigger("filtered.shuffle",c)},c.speed);b=Math.ceil(b/c.itemsPerRow)*(c.itemHeight+
c.marginTop)-c.marginTop;c.$container.css("height",b+"px")},shrink:function(){var a=this,c=a.$container.find(".concealed");0!==c.length&&c.each(function(){var b=e(this),c=parseInt(b.attr("data-x"),10),f=parseInt(b.attr("data-y"),10);c||(c=0);f||(f=0);a.transition({$this:b,x:c,y:f,left:c+a.itemWidth/2+"px",top:f+a.itemHeight/2+"px",scale:0.001,opacity:0,height:"0px",width:"0px"})})},filter:function(){var a=this,c=0;a.$container.find(".filtered").each(function(b){var h=e(this),f=b%a.itemsPerRow*(a.itemWidth+
a.marginRight),d=Math.floor(b/a.itemsPerRow);0===b%a.itemsPerRow&&(c=d*(a.itemHeight+a.marginTop));h.attr({"data-x":f,"data-y":c});a.transition({$this:h,x:f,y:c,left:f+"px",top:c+"px",scale:1,opacity:1,height:a.itemHeight+"px",width:a.itemWidth+"px"})})},setPrefixedCss:function(a,c,b){a.css(d.prefixed(c),b)},prefixed:function(a){return d.prefixed(a)},getPrefixed:function(a){return d.prefixed(a).replace(/([A-Z])/g,function(a,b){return"-"+b.toLowerCase()}).replace(/^ms-/,"-ms-")},transition:function(a){var c;
this.supported?(c=d.csstransforms3d?"translate3d("+a.x+"px, "+a.y+"px, 0px) scale3d("+a.scale+", "+a.scale+", "+a.scale+")":"translate("+a.x+"px, "+a.y+"px) scale("+a.scale+", "+a.scale+")",a.$this.css("opacity",a.opacity),this.setPrefixedCss(a.$this,"transform",c)):a.$this.animate({left:a.left,top:a.top,opacity:a.opacity,height:a.height,width:a.width},this.speed)}};e.fn.shuffle=function(a,c){return this.each(function(){var b=e(this),d=b.data("shuffle");d||(d=new g(b,a),b.data("shuffle",d));"string"===
typeof a&&("shuffle"!==a&&(c=a),d.shuffle(c))})}})(jQuery,Modernizr);