/* Modernizr 2.6.1 (Custom Build) | MIT & BSD
* Build: http://modernizr.com/download/#-backgroundsize-csstransforms-csstransforms3d-csstransitions-shiv-cssclasses-teststyles-testprop-testallprops-prefixes-domprefixes-load
*/
;window.Modernizr=function(a,b,c){function z(a){j.cssText=a}function A(a,b){return z(m.join(a+";")+(b||""))}function B(a,b){return typeof a===b}function C(a,b){return!!~(""+a).indexOf(b)}function D(a,b){for(var d in a){var e=a[d];if(!C(e,"-")&&j[e]!==c)return b=="pfx"?e:!0}return!1}function E(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?a[e]:B(f,"function")?f.bind(d||b):f}return!1}function F(a,b,c){var d=a.charAt(0).toUpperCase()+a.slice(1),e=(a+" "+o.join(d+" ")+d).split(" ");return B(b,"string")||B(b,"undefined")?D(e,b):(e=(a+" "+p.join(d+" ")+d).split(" "),E(e,b,c))}var d="2.6.1",e={},f=!0,g=b.documentElement,h="modernizr",i=b.createElement(h),j=i.style,k,l={}.toString,m=" -webkit- -moz- -o- -ms- ".split(" "),n="Webkit Moz O ms",o=n.split(" "),p=n.toLowerCase().split(" "),q={},r={},s={},t=[],u=t.slice,v,w=function(a,c,d,e){var f,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]:h+(d+1),k.appendChild(j);return f=["",'"].join(""),k.id=h,(l?k:m).innerHTML+=f,m.appendChild(k),l||(m.style.background="",g.appendChild(m)),i=c(k,a),l?k.parentNode.removeChild(k):m.parentNode.removeChild(m),!!i},x={}.hasOwnProperty,y;!B(x,"undefined")&&!B(x.call,"undefined")?y=function(a,b){return x.call(a,b)}:y=function(a,b){return b in a&&B(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=u.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(u.call(arguments)));return Object(g)===g?g:f}return c.apply(b,d.concat(u.call(arguments)))};return e}),q.backgroundsize=function(){return F("backgroundSize")},q.csstransforms=function(){return!!F("transform")},q.csstransforms3d=function(){var a=!!F("perspective");return a&&"webkitPerspective"in g.style&&w("@media (transform-3d),(-webkit-transform-3d){#modernizr{left:9px;position:absolute;height:3px;}}",function(b,c){a=b.offsetLeft===9&&b.offsetHeight===3}),a},q.csstransitions=function(){return F("transition")};for(var G in q)y(q,G)&&(v=G.toLowerCase(),e[v]=q[G](),t.push((e[v]?"":"no-")+v));return e.addTest=function(a,b){if(typeof a=="object")for(var d in a)y(a,d)&&e.addTest(d,a[d]);else{a=a.toLowerCase();if(e[a]!==c)return e;b=typeof b=="function"?b():b,f&&(g.className+=" "+(b?"":"no-")+a),e[a]=b}return e},z(""),i=k=null,function(a,b){function k(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x",d.insertBefore(c.lastChild,d.firstChild)}function l(){var a=r.elements;return typeof a=="string"?a.split(" "):a}function m(a){var b=i[a[g]];return b||(b={},h++,a[g]=h,i[h]=b),b}function n(a,c,f){c||(c=b);if(j)return c.createElement(a);f||(f=m(c));var g;return f.cache[a]?g=f.cache[a].cloneNode():e.test(a)?g=(f.cache[a]=f.createElem(a)).cloneNode():g=f.createElem(a),g.canHaveChildren&&!d.test(a)?f.frag.appendChild(g):g}function o(a,c){a||(a=b);if(j)return a.createDocumentFragment();c=c||m(a);var d=c.frag.cloneNode(),e=0,f=l(),g=f.length;for(;e",f="hidden"in a,j=a.childNodes.length==1||function(){b.createElement("a");var a=b.createDocumentFragment();return typeof a.cloneNode=="undefined"||typeof a.createDocumentFragment=="undefined"||typeof a.createElement=="undefined"}()}catch(c){f=!0,j=!0}})();var r={elements:c.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video",shivCSS:c.shivCSS!==!1,supportsUnknownElements:j,shivMethods:c.shivMethods!==!1,type:"default",shivDocument:q,createElement:n,createDocumentFragment:o};a.html5=r,q(b)}(this,b),e._version=d,e._prefixes=m,e._domPrefixes=p,e._cssomPrefixes=o,e.testProp=function(a){return D([a])},e.testAllProps=F,e.testStyles=w,g.className=g.className.replace(/(^|\s)no-js(\s|$)/,"$1$2")+(f?" js "+t.join(" "):""),e}(this,this.document),function(a,b,c){function d(a){return"[object Function]"==o.call(a)}function e(a){return"string"==typeof a}function f(){}function g(a){return!a||"loaded"==a||"complete"==a||"uninitialized"==a}function h(){var a=p.shift();q=1,a?a.t?m(function(){("c"==a.t?B.injectCss:B.injectJs)(a.s,0,a.a,a.x,a.e,1)},0):(a(),h()):q=0}function i(a,c,d,e,f,i,j){function k(b){if(!o&&g(l.readyState)&&(u.r=o=1,!q&&h(),l.onload=l.onreadystatechange=null,b)){"img"!=a&&m(function(){t.removeChild(l)},50);for(var d in y[c])y[c].hasOwnProperty(d)&&y[c][d].onload()}}var j=j||B.errorTimeout,l=b.createElement(a),o=0,r=0,u={t:d,s:c,e:f,a:i,x:j};1===y[c]&&(r=1,y[c]=[]),"object"==a?l.data=c:(l.src=c,l.type=a),l.width=l.height="0",l.onerror=l.onload=l.onreadystatechange=function(){k.call(this,r)},p.splice(e,0,u),"img"!=a&&(r||2===y[c]?(t.insertBefore(l,s?null:n),m(k,j)):y[c].push(l))}function j(a,b,c,d,f){return q=0,b=b||"j",e(a)?i("c"==b?v:u,a,b,this.i++,c,d,f):(p.splice(this.i++,0,a),1==p.length&&h()),this}function k(){var a=B;return a.loader={load:j,i:0},a}var l=b.documentElement,m=a.setTimeout,n=b.getElementsByTagName("script")[0],o={}.toString,p=[],q=0,r="MozAppearance"in l.style,s=r&&!!b.createRange().compareNode,t=s?l:n.parentNode,l=a.opera&&"[object Opera]"==o.call(a.opera),l=!!b.attachEvent&&!l,u=r?"object":l?"script":"img",v=l?"script":u,w=Array.isArray||function(a){return"[object Array]"==o.call(a)},x=[],y={},z={timeout:function(a,b){return b.length&&(a.timeout=b[0]),a}},A,B;B=function(a){function b(a){var a=a.split("!"),b=x.length,c=a.pop(),d=a.length,c={url:c,origUrl:c,prefixes:a},e,f,g;for(f=0;f' ).load( function() {
_self._init( options );
} ).attr( 'src', 'images/loading.gif' );
}
};
$.GridRotator.defaults = {
// number of rows
rows : 4,
// number of columns
columns : 10,
w1024 : {
rows : 3,
columns : 8
},
w768 : {
rows : 3,
columns : 7
},
w480 : {
rows : 3,
columns : 5
},
w320 : {
rows : 2,
columns : 4
},
w240 : {
rows : 2,
columns : 3
},
// step: number of items that are replaced at the same time
// random || [some number]
// note: for performance issues, the number "can't" be > options.maxStep
step : 'random',
maxStep : 3,
// prevent user to click the items
preventClick : true,
// animation type
// showHide || fadeInOut || slideLeft ||
// slideRight || slideTop || slideBottom ||
// rotateLeft || rotateRight || rotateTop ||
// rotateBottom || scale || rotate3d ||
// rotateLeftScale || rotateRightScale ||
// rotateTopScale || rotateBottomScale || random
animType : 'random',
// animation speed
animSpeed : 500,
// animation easings
animEasingOut : 'linear',
animEasingIn : 'linear',
// the item(s) will be replaced every 3 seconds
// note: for performance issues, the time "can't" be < 300 ms
interval : 3000
};
$.GridRotator.prototype = {
_init : function( options ) {
var _self = this;
// options
this.options = $.extend( true, {}, $.GridRotator.defaults, options );
// all types of animations
this.animTypesAll = [ 'fadeInOut', 'slideLeft', 'slideRight', 'slideTop', 'slideBottom', 'rotateLeft', 'rotateRight', 'rotateTop', 'rotateBottom', 'scale', 'rotate3d', 'rotateLeftScale', 'rotateRightScale', 'rotateTopScale', 'rotateBottomScale' ];
// types of animations for "older" browsers
this.animTypesCond = [ 'fadeInOut', 'slideLeft', 'slideRight', 'slideTop', 'slideBottom' ];
// array containing the animation types to choose from when the options.animType is set to 'random'
this.animTypes = this.animTypesCond;
if( Modernizr.csstransforms3d ) {
this.animTypes = this.animTypesAll;
}
this.animType = this.options.animType;
if( this.animType !== 'random' ) {
if( !Modernizr.csstransforms3d && $.inArray( this.animType, this.animTypesCond ) === -1 && this.animType !== 'showHide' ) {
// fallback to 'fadeInOut' if user sets a type which is not supported
this.animType = 'fadeInOut';
}
}
this.animTypesTotal = this.animTypes.length;
// the where the items are placed
this.$list = this.$el.children( 'ul' );
// remove img's and add background-image to anchors
// preload the images before
var loaded = 0,
$imgs = this.$list.find( 'img' ),
count = $imgs.length;
$imgs.each( function() {
var $img = $( this ),
src = $img.attr( 'src' );
$( '
' ).load( function() {
++loaded;
$img.parent().css( 'background-image', 'url(' + src + ')' );
if( loaded === count ) {
$imgs.remove();
_self.$el.removeClass( 'ri-grid-loading' );
// the items
_self.$items = _self.$list.children( 'li' );
// make a copy of the items
_self.$itemsCache = _self.$items.clone();
// total number of items
_self.itemsTotal = _self.$items.length;
// the items that will be out of the grid
// actually the item's child (anchor element)
_self.outItems = [];
_self._layout();
_self._initEvents();
// replace "options.step" items after "options.interval" time
// the items that go out are randomly chosen, while the ones that get in
// respect the order (first in first out)
_self._start();
}
} ).attr( 'src', src )
} );
},
_layout : function( callback ) {
var _self = this;
// sets the grid dimentions based on the container's width
this._setGridDim();
// reset
this.$list.empty();
this.$items = this.$itemsCache.clone().appendTo( this.$list );
var $outItems = this.$items.filter( ':gt(' + ( this.showTotal - 1 ) + ')' ),
$outAItems = $outItems.children( 'a' );
this.outItems.length = 0;
$outAItems.each( function( i ) {
_self.outItems.push( $( this ) );
} );
$outItems.remove();
// container's width
var containerWidth = ( document.defaultView ) ? parseInt( document.defaultView.getComputedStyle( this.$el.get( 0 ), null ).width ) : this.$el.width(),
// item's width
itemWidth = Math.floor( containerWidth / this.columns ),
// calculate gap
gapWidth = containerWidth - ( this.columns * Math.floor( itemWidth ) );
for( var i = 0; i < this.rows; ++i ) {
for( var j = 0; j < this.columns; ++j ) {
var $item = this.$items.eq( this.columns * i + j ),
h = itemWidth,
w = ( j < Math.floor( gapWidth ) ) ? itemWidth + 1 : itemWidth;
$item.css( {
width : w,
height : h
} );
/*
if( gapWidth % 1 !== 0 && j === this.columns - 1 ) {
$item.children( 'a' ).css( {
width : '+=1'//,
height : '+=1'
} );
}
*/
}
}
if( this.options.preventClick ) {
this.$items.children().css( 'cursor', 'default' ).on( 'click.gridrotator', false );
}
if( callback ) {
callback.call();
}
},
// set the grid rows and columns
_setGridDim : function() {
// container's width
var c_w = this.$el.width();
// we will choose the number of rows/columns according to the container's width and the values set on the plugin options
switch( true ) {
case ( c_w < 240 ) : this.rows = this.options.w240.rows; this.columns = this.options.w240.columns; break;
case ( c_w < 320 ) : this.rows = this.options.w320.rows; this.columns = this.options.w320.columns; break;
case ( c_w < 480 ) : this.rows = this.options.w480.rows; this.columns = this.options.w480.columns; break;
case ( c_w < 768 ) : this.rows = this.options.w768.rows; this.columns = this.options.w768.columns; break;
case ( c_w < 1024 ) : this.rows = this.options.w1024.rows; this.columns = this.options.w1024.columns; break;
default : this.rows = this.options.rows; this.columns = this.options.columns; break;
}
this.showTotal = this.rows * this.columns;
},
// init window resize event
_initEvents : function() {
var _self = this;
$window.on( 'debouncedresize.gridrotator', function( event ) {
clearTimeout( _self.playtimeout );
_self._layout( function() {
_self._start();
} );
} );
},
// start rotating elements
_start : function() {
if( this.showTotal < this.itemsTotal ) {
this._showNext();
}
},
// get which type of animation
_getAnimType : function() {
if( this.animType === 'random' ) {
return this.animTypes[ Math.floor( Math.random() * this.animTypesTotal ) ];
}
else {
return this.animType;
}
},
// get css properties for the transition effect
_getAnimProperties : function( $in, $out ) {
var startInProp = {},
startOutProp = {},
endInProp = {},
endOutProp = {},
animType = this._getAnimType(),
speed;
switch( animType ) {
case 'showHide' :
speed = 0;
endOutProp.opacity = 0;
break;
case 'fadeInOut' :
endOutProp.opacity = 0;
break;
case 'slideLeft' :
startInProp.left = $out.width();
endInProp.left = 0;
endOutProp.left = -$out.width();
break;
case 'slideRight' :
startInProp.left = -$out.width();
endInProp.left = 0;
endOutProp.left = $out.width();
break;
case 'slideTop' :
startInProp.top = $out.height();
endInProp.top = 0;
endOutProp.top = -$out.height();
break;
case 'slideBottom' :
startInProp.top = -$out.height();
endInProp.top = 0;
endOutProp.top = $out.height();
break;
case 'rotateLeft' :
speed = this.options.animSpeed / 2;
startInProp.rotateY = '90deg';
endInProp.rotateY = '0deg';
endInProp.delay = speed;
endOutProp.rotateY = '-90deg';
break;
case 'rotateRight' :
speed = this.options.animSpeed / 2;
startInProp.rotateY = '-90deg';
endInProp.rotateY = '0deg';
endInProp.delay = speed;
endOutProp.rotateY = '90deg';
break;
case 'rotateTop' :
speed = this.options.animSpeed / 2;
startInProp.rotateX = '90deg';
endInProp.rotateX = '0deg';
endInProp.delay = speed;
endOutProp.rotateX = '-90deg';
break;
case 'rotateBottom' :
speed = this.options.animSpeed / 2;
startInProp.rotateX = '-90deg';
endInProp.rotateX = '0deg';
endInProp.delay = speed;
endOutProp.rotateX = '90deg';
break;
case 'scale' :
speed = this.options.animSpeed / 2;
startInProp.scale = '0';
startOutProp.scale = '1';
endInProp.scale = '1';
endInProp.delay = speed;
endOutProp.scale = '0';
break;
case 'rotateLeftScale' :
startInProp.scale = '0.3';
startOutProp.scale = '1';
endInProp.scale = '1';
endOutProp.scale = '0.3';
speed = this.options.animSpeed / 2;
startInProp.rotateY = '90deg';
endInProp.rotateY = '0deg';
endInProp.delay = speed;
endOutProp.rotateY = '-90deg';
break;
case 'rotateRightScale' :
startInProp.scale = '0.3';
startOutProp.scale = '1';
endInProp.scale = '1';
endOutProp.scale = '0.3';
speed = this.options.animSpeed / 2;
startInProp.rotateY = '-90deg';
endInProp.rotateY = '0deg';
endInProp.delay = speed;
endOutProp.rotateY = '90deg';
break;
case 'rotateTopScale' :
startInProp.scale = '0.3';
startOutProp.scale = '1';
endInProp.scale = '1';
endOutProp.scale = '0.3';
speed = this.options.animSpeed / 2;
startInProp.rotateX = '90deg';
endInProp.rotateX = '0deg';
endInProp.delay = speed;
endOutProp.rotateX = '-90deg';
break;
case 'rotateBottomScale' :
startInProp.scale = '0.3';
startOutProp.scale = '1';
endInProp.scale = '1';
endOutProp.scale = '0.3';
speed = this.options.animSpeed / 2;
startInProp.rotateX = '-90deg';
endInProp.rotateX = '0deg';
endInProp.delay = speed;
endOutProp.rotateX = '90deg';
break;
case 'rotate3d' :
speed = this.options.animSpeed / 2;
startInProp.rotate3d = '1, 1, 0, 90deg';
endInProp.rotate3d = '1, 1, 0, 0deg';
endInProp.delay = speed;
endOutProp.rotate3d = '1, 1, 0, -90deg';
break;
}
var animSpeed = ( speed != undefined ) ? speed : this.options.animSpeed;
return {
startInProp : startInProp,
startOutProp : startOutProp,
endInProp : endInProp,
endOutProp : endOutProp,
animSpeed : animSpeed
};
},
// show next "option.step" elements
_showNext : function( t ) {
var _self = this;
clearTimeout( this.playtimeout );
this.playtimeout = setTimeout( function() {
var step = _self.options.step,
max = _self.options.maxStep,
min = 1;
if( max > _self.showTotal ) {
max = _self.showTotal;
}
var $items = _self.$items,
outs = [],
// number of items to swith at this point of time
nmbOut = ( step === 'random' ) ? Math.floor( Math.random() * max + min ) : Math.min( Math.abs( step ) , max ) ,
// array with random indexes. These will be the indexes of the items we will replace
randArr = _self._getRandom( nmbOut, _self.showTotal );
for( var i = 0; i < nmbOut; ++i ) {
// element to go out
var $out = $items.eq( randArr[ i ] );
// if element is active, which means it is currently animating,
// then we need to get different positions..
if( $out.data( 'active' ) ) {
// one of the items is active, call again..
_self._showNext( 1 );
return false;
}
// add it to outs array
outs.push( $out );
}
for( var i = 0; i < nmbOut; ++i ) {
var $out = outs[ i ],
$outA = $out.children( 'a:last' ),
newElProp = {
width : $outA.width(),
height : $outA.height()
};
// element stays active
$out.data( 'active', true );
// get the element (anchor) that will go in (first one inserted in _self.outItems)
var $inA = _self.outItems.shift();
// save element that went out
_self.outItems.push( $outA.clone() );
// prepend in element
$inA.css( newElProp ).prependTo( $out );
var animProp = _self._getAnimProperties( $inA, $outA );
if( Modernizr.csstransitions ) {
$inA.css( animProp.startInProp ).transition( animProp.endInProp, animProp.animSpeed, _self.options.animEasingIn );
$outA.css( animProp.startOutProp ).transition( animProp.endOutProp, animProp.animSpeed, _self.options.animEasingOut, function() {
$( this ).parent().data( 'active', false ).end().remove();
} );
}
// fallback to jQuery animate
else {
$inA.css( animProp.startInProp ).stop().animate( animProp.endInProp, animProp.animSpeed );
$outA.css( animProp.startOutProp ).stop().animate( animProp.endOutProp, animProp.animSpeed, function() {
$( this ).parent().data( 'active', false ).end().remove();
} )
}
}
// again and again..
_self._showNext();
}, t || Math.max( Math.abs( this.options.interval ) , 300 ) );
},
_getRandom : function( cnt, limit ) {
var randArray = [];
for( var i = 0; i < limit; ++i ) {
randArray.push( i )
}
return randArray.shuffle().slice(0,cnt);
}
};
var logError = function( message ) {
if ( window.console ) {
window.console.error( message );
}
};
$.fn.gridrotator = function( options ) {
if ( typeof options === 'string' ) {
var args = Array.prototype.slice.call( arguments, 1 );
this.each(function() {
var instance = $.data( this, 'gridrotator' );
if ( !instance ) {
logError( "cannot call methods on gridrotator prior to initialization; " +
"attempted to call method '" + options + "'" );
return;
}
if ( !$.isFunction( instance[options] ) || options.charAt(0) === "_" ) {
logError( "no such method '" + options + "' for gridrotator instance" );
return;
}
instance[ options ].apply( instance, args );
});
}
else {
this.each(function() {
var instance = $.data( this, 'gridrotator' );
if ( instance ) {
instance._init();
}
else {
$.data( this, 'gridrotator', new $.GridRotator( options, this ) );
}
});
}
return this;
};
} )( jQuery, window );
/*!
* jQuery Transit - CSS3 transitions and transformations
* Copyright(c) 2011 Rico Sta. Cruz
* MIT Licensed.
*
* http://ricostacruz.com/jquery.transit
* http://github.com/rstacruz/jquery.transit
*/
(function(d){function k(a){var b=["Moz","Webkit","O","ms"],c=a.charAt(0).toUpperCase()+a.substr(1);if(a in i.style)return a;for(a=0;a=b;++b)a[b]&&(a[b]=parseFloat(a[b]));a[3]&&(a[3]=g(a[3],"deg"));return a}},parse:function(a){var b=this;a.replace(/([a-zA-Z0-9]+)\((.*?)\)/g,function(a,d,e){b.setFromString(d,e)})},toString:function(a){var b=[],c;for(c in this)if(this.hasOwnProperty(c)&&(e.transform3d||!("rotateX"===
c||"rotateY"===c||"perspective"===c||"transformOrigin"===c)))"_"!==c[0]&&(a&&"scale"===c?b.push(c+"3d("+this[c]+",1)"):a&&"translate"===c?b.push(c+"3d("+this[c]+",0)"):b.push(c+"("+this[c]+")"));return b.join(" ")}};d.fn.transition=d.fn.transit=function(a,b,c,f){var h=this,g=0,i=!0;"function"===typeof b&&(f=b,b=void 0);"function"===typeof c&&(f=c,c=void 0);"undefined"!==typeof a.easing&&(c=a.easing,delete a.easing);"undefined"!==typeof a.duration&&(b=a.duration,delete a.duration);"undefined"!==typeof a.complete&&
(f=a.complete,delete a.complete);"undefined"!==typeof a.queue&&(i=a.queue,delete a.queue);"undefined"!==typeof a.delay&&(g=a.delay,delete a.delay);"undefined"===typeof b&&(b=d.fx.speeds._default);"undefined"===typeof c&&(c=d.cssEase._default);var b=n(b),j=q(a,b,c,g),l=d.transit.enabled&&e.transition?parseInt(b,10)+parseInt(g,10):0;if(0===l)return p(h,i,function(b){h.css(a);f&&f();b()}),h;var k={},m=function(b){var c=!1,g=function(){c&&h.unbind(o,g);0b&&(b=25);window.setTimeout(function(){m(a)},b)});return this};d.transit.getTransitionValue=q})(jQuery);