Skip to content

Instantly share code, notes, and snippets.

@adesignl
Created January 29, 2013 16:37
Show Gist options
  • Save adesignl/4665625 to your computer and use it in GitHub Desktop.
Save adesignl/4665625 to your computer and use it in GitHub Desktop.
cycle.js
(function(f,e){function g(h){f.fn.cycle.debug&&a(h)}function a(){window.console&&console.log&&console.log("[cycle] "+Array.prototype.join.call(arguments," "))}function m(a,b,q){var d=f(a).data("cycle.opts");if(d){var e=!!a.cyclePause;e&&d.paused?d.paused(a,d,b,q):!e&&d.resumed&&d.resumed(a,d,b,q)}}function k(h,b,d){function k(b,c,h){if(!b&&!0===c){b=f(h).data("cycle.opts");if(!b)return a("options not found, can not resume"),!1;h.cycleTimeout&&(clearTimeout(h.cycleTimeout),h.cycleTimeout=0);t(b.elements,
b,1,!b.backwards)}}h.cycleStop===e&&(h.cycleStop=0);if(b===e||null===b)b={};if(b.constructor==String)switch(b){case "destroy":case "stop":d=f(h).data("cycle.opts");if(!d)return!1;h.cycleStop++;h.cycleTimeout&&clearTimeout(h.cycleTimeout);h.cycleTimeout=0;d.elements&&f(d.elements).stop();f(h).removeData("cycle.opts");if("destroy"==b){b=d;b.next&&f(b.next).unbind(b.prevNextEvent);b.prev&&f(b.prev).unbind(b.prevNextEvent);if(b.pager||b.pagerAnchorBuilder)f.each(b.pagerAnchors||[],function(){this.unbind().remove()});
b.pagerAnchors=null;f(h).unbind("mouseenter.cycle mouseleave.cycle");b.destroy&&b.destroy(b)}return!1;case "toggle":return h.cyclePause=1===h.cyclePause?0:1,k(h.cyclePause,d,h),m(h),!1;case "pause":return h.cyclePause=1,m(h),!1;case "resume":return h.cyclePause=0,k(!1,d,h),m(h),!1;case "prev":case "next":d=f(h).data("cycle.opts");if(!d)return a('options not found, "prev/next" ignored'),!1;f.fn.cycle[b](d);return!1;default:b={fx:b}}else if(b.constructor==Number){var r=b;b=f(h).data("cycle.opts");if(!b)return a("options not found, can not advance slide"),
!1;if(0>r||r>=b.elements.length)return a("invalid slide index: "+r),!1;b.nextSlide=r;h.cycleTimeout&&(clearTimeout(h.cycleTimeout),h.cycleTimeout=0);"string"==typeof d&&(b.oneTimeFx=d);t(b.elements,b,1,r>=b.currSlide);return!1}return b}function d(a,b){if(!f.support.opacity&&b.cleartype&&a.style.filter)try{a.style.removeAttribute("filter")}catch(d){}}function v(h,b,q,k,r){var j,c=f.extend({},f.fn.cycle.defaults,k||{},f.metadata?h.metadata():f.meta?h.data():{}),l=f.isFunction(h.data)?h.data(c.metaAttr):
null;l&&(c=f.extend(c,l));c.autostop&&(c.countdown=c.autostopCount||q.length);var v=h[0];h.data("cycle.opts",c);c.$cont=h;c.stopCount=v.cycleStop;c.elements=q;c.before=c.before?[c.before]:[];c.after=c.after?[c.after]:[];!f.support.opacity&&c.cleartype&&c.after.push(function(){d(this,c)});c.continuous&&c.after.push(function(){t(q,c,0,!c.backwards)});var u=c;u.original={before:[],after:[]};u.original.cssBefore=f.extend({},u.cssBefore);u.original.cssAfter=f.extend({},u.cssAfter);u.original.animIn=f.extend({},
u.animIn);u.original.animOut=f.extend({},u.animOut);f.each(u.before,function(){u.original.before.push(this)});f.each(u.after,function(){u.original.after.push(this)});!f.support.opacity&&(c.cleartype&&!c.cleartypeNoBg)&&z(b);"static"==h.css("position")&&h.css("position","relative");c.width&&h.width(c.width);c.height&&"auto"!=c.height&&h.height(c.height);c.startingSlide!==e?(c.startingSlide=parseInt(c.startingSlide,10),c.startingSlide>=q.length||0>c.startSlide?c.startingSlide=0:j=!0):c.startingSlide=
c.backwards?q.length-1:0;if(c.random){c.randomMap=[];for(l=0;l<q.length;l++)c.randomMap.push(l);c.randomMap.sort(function(){return Math.random()-0.5});if(j)for(j=0;j<q.length;j++)c.startingSlide==c.randomMap[j]&&(c.randomIndex=j);else c.randomIndex=1,c.startingSlide=c.randomMap[1]}else c.startingSlide>=q.length&&(c.startingSlide=0);c.currSlide=c.startingSlide||0;var p=c.startingSlide;b.css({position:"absolute",top:0,left:0}).hide().each(function(b){b=c.backwards?p?b<=p?q.length+(b-p):p-b:q.length-
b:p?b>=p?q.length-(b-p):p-b:q.length-b;f(this).css("z-index",b)});f(q[p]).css("opacity",1).show();d(q[p],c);c.fit&&(c.aspect?b.each(function(){var b=f(this),a=!0===c.aspect?b.width()/b.height():c.aspect;c.width&&b.width()!=c.width&&(b.width(c.width),b.height(c.width/a));c.height&&b.height()<c.height&&(b.height(c.height),b.width(c.height*a))}):(c.width&&b.width(c.width),c.height&&"auto"!=c.height&&b.height(c.height)));c.center&&(!c.fit||c.aspect)&&b.each(function(){var b=f(this);b.css({"margin-left":c.width?
(c.width-b.width())/2+"px":0,"margin-top":c.height?(c.height-b.height())/2+"px":0})});c.center&&(!c.fit&&!c.slideResize)&&b.each(function(){var b=f(this);b.css({"margin-left":c.width?(c.width-b.width())/2+"px":0,"margin-top":c.height?(c.height-b.height())/2+"px":0})});if((c.containerResize||c.containerResizeHeight)&&!h.innerHeight()){for(var w=l=j=0;w<q.length;w++){var y=f(q[w]),B=y[0],C=y.outerWidth(),D=y.outerHeight();C||(C=B.offsetWidth||B.width||y.attr("width"));D||(D=B.offsetHeight||B.height||
y.attr("height"));j=C>j?C:j;l=D>l?D:l}c.containerResize&&(0<j&&0<l)&&h.css({width:j+"px",height:l+"px"});c.containerResizeHeight&&0<l&&h.css({height:l+"px"})}var E=!1;c.pause&&h.bind("mouseenter.cycle",function(){E=!0;this.cyclePause++;m(v,!0)}).bind("mouseleave.cycle",function(){E&&this.cyclePause--;m(v,!0)});var s;a:{j=c;w=f.fn.cycle.transitions;if(0<j.fx.indexOf(",")){j.multiFx=!0;j.fxs=j.fx.replace(/\s*/g,"").split(",");for(s=0;s<j.fxs.length;s++)if(y=j.fxs[s],l=w[y],!l||!w.hasOwnProperty(y)||
!f.isFunction(l))a("discarding unknown transition: ",y),j.fxs.splice(s,1),s--;if(!j.fxs.length){a("No valid transitions named; slideshow terminating.");s=!1;break a}}else if("all"==j.fx)for(s in j.multiFx=!0,j.fxs=[],w)w.hasOwnProperty(s)&&(l=w[s],w.hasOwnProperty(s)&&f.isFunction(l)&&j.fxs.push(s));if(j.multiFx&&j.randomizeEffects){l=Math.floor(20*Math.random())+30;for(s=0;s<l;s++)w=Math.floor(Math.random()*j.fxs.length),j.fxs.push(j.fxs.splice(w,1)[0]);g("randomized fx sequence: ",j.fxs)}s=!0}if(!1===
s)return!1;var F=!1;k.requeueAttempts=k.requeueAttempts||0;b.each(function(){var b=f(this);this.cycleH=c.fit&&c.height?c.height:b.height()||this.offsetHeight||this.height||b.attr("height")||0;this.cycleW=c.fit&&c.width?c.width:b.width()||this.offsetWidth||this.width||b.attr("width")||0;if(b.is("img")&&0===this.cycleH&&0===this.cycleW&&!this.complete){if(r.s&&c.requeueOnImageNotLoaded&&100>++k.requeueAttempts)return a(k.requeueAttempts," - img slide not loaded, requeuing slideshow: ",this.src,this.cycleW,
this.cycleH),setTimeout(function(){f(r.s,r.c).cycle(k)},c.requeueTimeout),F=!0,!1;a("could not determine size of image: "+this.src,this.cycleW,this.cycleH)}return!0});if(F)return!1;c.cssBefore=c.cssBefore||{};c.cssAfter=c.cssAfter||{};c.cssFirst=c.cssFirst||{};c.animIn=c.animIn||{};c.animOut=c.animOut||{};b.not(":eq("+p+")").css(c.cssBefore);f(b[p]).css(c.cssFirst);if(c.timeout){c.timeout=parseInt(c.timeout,10);c.speed.constructor==String&&(c.speed=f.fx.speeds[c.speed]||parseInt(c.speed,10));c.sync||
(c.speed/=2);for(s="none"==c.fx?0:"shuffle"==c.fx?500:250;c.timeout-c.speed<s;)c.timeout+=c.speed}c.easing&&(c.easeIn=c.easeOut=c.easing);c.speedIn||(c.speedIn=c.speed);c.speedOut||(c.speedOut=c.speed);c.slideCount=q.length;c.currSlide=c.lastSlide=p;c.random?(++c.randomIndex==q.length&&(c.randomIndex=0),c.nextSlide=c.randomMap[c.randomIndex]):c.nextSlide=c.backwards?0===c.startingSlide?q.length-1:c.startingSlide-1:c.startingSlide>=q.length-1?0:c.startingSlide+1;if(!c.multiFx)if(s=f.fn.cycle.transitions[c.fx],
f.isFunction(s))s(h,b,c);else if("custom"!=c.fx&&!c.multiFx)return a("unknown transition: "+c.fx,"; slideshow terminating"),!1;h=b[p];c.skipInitializationCallbacks||(c.before.length&&c.before[0].apply(h,[h,h,c,!0]),c.after.length&&c.after[0].apply(h,[h,h,c,!0]));c.next&&f(c.next).bind(c.prevNextEvent,function(){return x(c,1)});c.prev&&f(c.prev).bind(c.prevNextEvent,function(){return x(c,0)});if(c.pager||c.pagerAnchorBuilder){var A=c,G=f(A.pager);f.each(q,function(b,a){f.fn.cycle.createPagerAnchor(b,
a,G,q,A)});A.updateActivePagerLink(A.pager,A.startingSlide,A.activePagerClass)}var n=c;n.addSlide=function(b,a){var c=f(b),h=c[0];n.autostopCount||n.countdown++;q[a?"unshift":"push"](h);if(n.els)n.els[a?"unshift":"push"](h);n.slideCount=q.length;n.random&&(n.randomMap.push(n.slideCount-1),n.randomMap.sort(function(){return Math.random()-0.5}));c.css("position","absolute");c[a?"prependTo":"appendTo"](n.$cont);a&&(n.currSlide++,n.nextSlide++);!f.support.opacity&&(n.cleartype&&!n.cleartypeNoBg)&&z(c);
n.fit&&n.width&&c.width(n.width);n.fit&&(n.height&&"auto"!=n.height)&&c.height(n.height);h.cycleH=n.fit&&n.height?n.height:c.height();h.cycleW=n.fit&&n.width?n.width:c.width();c.css(n.cssBefore);(n.pager||n.pagerAnchorBuilder)&&f.fn.cycle.createPagerAnchor(q.length-1,h,f(n.pager),q,n);if(f.isFunction(n.onAddSlide))n.onAddSlide(c);else c.hide()};return c}function t(a,b,d,k){function m(){var c=0;b.timeout&&!b.continuous?(c=p(a[b.currSlide],a[b.nextSlide],b,k),"shuffle"==b.fx&&(c-=b.speedOut)):b.continuous&&
j.cyclePause&&(c=10);0<c&&(j.cycleTimeout=setTimeout(function(){t(a,b,0,!b.backwards)},c))}var j=b.$cont[0],c=a[b.currSlide],l=a[b.nextSlide];d&&(b.busy&&b.manualTrump)&&(g("manualTrump in go(), stopping active transition"),f(a).stop(!0,!0),b.busy=0,clearTimeout(j.cycleTimeout));if(b.busy)g("transition active, ignoring new tx request");else if(!(j.cycleStop!=b.stopCount||0===j.cycleTimeout&&!d))if(!d&&!j.cyclePause&&!b.bounce&&(b.autostop&&0>=--b.countdown||b.nowrap&&!b.random&&b.nextSlide<b.currSlide))b.end&&
b.end(b);else{var v=!1;if((d||!j.cyclePause)&&b.nextSlide!=b.currSlide){var v=!0,u=b.fx;c.cycleH=c.cycleH||f(c).height();c.cycleW=c.cycleW||f(c).width();l.cycleH=l.cycleH||f(l).height();l.cycleW=l.cycleW||f(l).width();if(b.multiFx){if(k&&(b.lastFx===e||++b.lastFx>=b.fxs.length))b.lastFx=0;else if(!k&&(b.lastFx===e||0>--b.lastFx))b.lastFx=b.fxs.length-1;u=b.fxs[b.lastFx]}b.oneTimeFx&&(u=b.oneTimeFx,b.oneTimeFx=null);f.fn.cycle.resetState(b,u);b.before.length&&f.each(b.before,function(a,f){j.cycleStop==
b.stopCount&&f.apply(l,[c,l,b,k])});var z=function(){b.busy=0;f.each(b.after,function(a,f){j.cycleStop==b.stopCount&&f.apply(l,[c,l,b,k])});j.cycleStop||m()};g("tx firing("+u+"); currSlide: "+b.currSlide+"; nextSlide: "+b.nextSlide);b.busy=1;if(b.fxFn)b.fxFn(c,l,b,z,k,d&&b.fastOnEvent);else if(f.isFunction(f.fn.cycle[b.fx]))f.fn.cycle[b.fx](c,l,b,z,k,d&&b.fastOnEvent);else f.fn.cycle.custom(c,l,b,z,k,d&&b.fastOnEvent)}else m();if(v||b.nextSlide==b.currSlide)b.lastSlide=b.currSlide,b.random?(b.currSlide=
b.nextSlide,++b.randomIndex==a.length&&(b.randomIndex=0,b.randomMap.sort(function(){return Math.random()-0.5})),b.nextSlide=b.randomMap[b.randomIndex],b.nextSlide==b.currSlide&&(b.nextSlide=b.currSlide==b.slideCount-1?0:b.currSlide+1)):b.backwards?(d=0>b.nextSlide-1)&&b.bounce?(b.backwards=!b.backwards,b.nextSlide=1,b.currSlide=0):(b.nextSlide=d?a.length-1:b.nextSlide-1,b.currSlide=d?0:b.nextSlide+1):(d=b.nextSlide+1==a.length)&&b.bounce?(b.backwards=!b.backwards,b.nextSlide=a.length-2,b.currSlide=
a.length-1):(b.nextSlide=d?0:b.nextSlide+1,b.currSlide=d?a.length-1:b.nextSlide-1);v&&b.pager&&b.updateActivePagerLink(b.pager,b.currSlide,b.activePagerClass)}}function p(a,b,f,d){if(f.timeoutFn){for(a=f.timeoutFn.call(a,a,b,f,d);"none"!=f.fx&&250>a-f.speed;)a+=f.speed;g("calculated timeout: "+a+"; speed: "+f.speed);if(!1!==a)return a}return f.timeout}function x(a,b){var d=b?1:-1,k=a.elements,e=a.$cont[0],m=e.cycleTimeout;m&&(clearTimeout(m),e.cycleTimeout=0);if(a.random&&0>d)a.randomIndex--,-2==
--a.randomIndex?a.randomIndex=k.length-2:-1==a.randomIndex&&(a.randomIndex=k.length-1),a.nextSlide=a.randomMap[a.randomIndex];else if(a.random)a.nextSlide=a.randomMap[a.randomIndex];else if(a.nextSlide=a.currSlide+d,0>a.nextSlide){if(a.nowrap)return!1;a.nextSlide=k.length-1}else if(a.nextSlide>=k.length){if(a.nowrap)return!1;a.nextSlide=0}e=a.onPrevNextEvent||a.prevNextClick;f.isFunction(e)&&e(0<d,a.nextSlide,k[a.nextSlide]);t(k,a,1,b);return!1}function z(a){function b(a){a=parseInt(a,10).toString(16);
return 2>a.length?"0"+a:a}function d(a){for(;a&&"html"!=a.nodeName.toLowerCase();a=a.parentNode){var h=f.css(a,"background-color");if(h&&0<=h.indexOf("rgb"))return a=h.match(/\d+/g),"#"+b(a[0])+b(a[1])+b(a[2]);if(h&&"transparent"!=h)return h}return"#ffffff"}g("applying clearType background-color hack");a.each(function(){f(this).css("background-color",d(this))})}f.expr[":"].paused=function(a){return a.cyclePause};f.fn.cycle=function(d,b){var e={s:this.selector,c:this.context};if(0===this.length&&"stop"!=
d){if(!f.isReady&&e.s)return a("DOM not ready, queuing slideshow"),f(function(){f(e.s,e.c).cycle(d,b)}),this;a("terminating; zero elements found by selector"+(f.isReady?"":" (DOM not ready)"));return this}return this.each(function(){var m=k(this,d,b);if(!1!==m){m.updateActivePagerLink=m.updateActivePagerLink||f.fn.cycle.updateActivePagerLink;this.cycleTimeout&&clearTimeout(this.cycleTimeout);this.cycleStop=this.cycleTimeout=this.cyclePause=0;var r=f(this),j=m.slideExpr?f(m.slideExpr,this):r.children(),
c=j.get();if(2>c.length)a("terminating; too few slides: "+c.length);else{var l=v(r,j,c,m,e);if(!1!==l&&(r=l.continuous?10:p(c[l.currSlide],c[l.nextSlide],l,!l.backwards)))r+=l.delay||0,10>r&&(r=10),g("first timeout: "+r),this.cycleTimeout=setTimeout(function(){t(c,l,0,!m.backwards)},r)}}})};f.fn.cycle.resetState=function(a,b){b=b||a.fx;a.before=[];a.after=[];a.cssBefore=f.extend({},a.original.cssBefore);a.cssAfter=f.extend({},a.original.cssAfter);a.animIn=f.extend({},a.original.animIn);a.animOut=
f.extend({},a.original.animOut);a.fxFn=null;f.each(a.original.before,function(){a.before.push(this)});f.each(a.original.after,function(){a.after.push(this)});var d=f.fn.cycle.transitions[b];f.isFunction(d)&&d(a.$cont,f(a.elements),a)};f.fn.cycle.updateActivePagerLink=function(a,b,d){f(a).each(function(){f(this).children().removeClass(d).eq(b).addClass(d)})};f.fn.cycle.next=function(a){x(a,1)};f.fn.cycle.prev=function(a){x(a,0)};f.fn.cycle.createPagerAnchor=function(a,b,d,k,e){f.isFunction(e.pagerAnchorBuilder)?
(b=e.pagerAnchorBuilder(a,b),g("pagerAnchorBuilder("+a+", el) returned: "+b)):b='<a href="#">'+(a+1)+"</a>";if(b){var j=f(b);if(0===j.parents("body").length){var c=[];1<d.length?(d.each(function(){var a=j.clone(!0);f(this).append(a);c.push(a[0])}),j=f(c)):j.appendTo(d)}e.pagerAnchors=e.pagerAnchors||[];e.pagerAnchors.push(j);d=function(b){b.preventDefault();e.nextSlide=a;b=e.$cont[0];var c=b.cycleTimeout;c&&(clearTimeout(c),b.cycleTimeout=0);b=e.onPagerEvent||e.pagerClick;f.isFunction(b)&&b(e.nextSlide,
k[e.nextSlide]);t(k,e,1,e.currSlide<a)};/mouseenter|mouseover/i.test(e.pagerEvent)?j.hover(d,function(){}):j.bind(e.pagerEvent,d);!/^click/.test(e.pagerEvent)&&!e.allowPagerClickBubble&&j.bind("click.cycle",function(){return!1});var l=e.$cont[0],p=!1;e.pauseOnPagerHover&&j.hover(function(){p=!0;l.cyclePause++;m(l,!0,!0)},function(){p&&l.cyclePause--;m(l,!0,!0)})}};f.fn.cycle.hopsFromLast=function(a,b){var f=a.lastSlide,d=a.currSlide;return b?d>f?d-f:a.slideCount-f:d<f?f-d:f+a.slideCount-d};f.fn.cycle.commonReset=
function(a,b,d,e,k,m){f(d.elements).not(a).hide();"undefined"==typeof d.cssBefore.opacity&&(d.cssBefore.opacity=1);d.cssBefore.display="block";d.slideResize&&(!1!==e&&0<b.cycleW)&&(d.cssBefore.width=b.cycleW);d.slideResize&&(!1!==k&&0<b.cycleH)&&(d.cssBefore.height=b.cycleH);d.cssAfter=d.cssAfter||{};d.cssAfter.display="none";f(a).css("zIndex",d.slideCount+(!0===m?1:0));f(b).css("zIndex",d.slideCount+(!0===m?0:1))};f.fn.cycle.custom=function(a,b,d,e,k,m){var c=f(a),l=f(b),g=d.speedIn;a=d.speedOut;
var p=d.easeIn;b=d.easeOut;l.css(d.cssBefore);m&&(g="number"==typeof m?a=m:a=1,p=b=null);var v=function(){l.animate(d.animIn,g,p,function(){e()})};c.animate(d.animOut,a,b,function(){c.css(d.cssAfter);d.sync||v()});d.sync&&v()};f.fn.cycle.transitions={fade:function(a,b,d){b.not(":eq("+d.currSlide+")").css("opacity",0);d.before.push(function(a,b,d){f.fn.cycle.commonReset(a,b,d);d.cssBefore.opacity=0});d.animIn={opacity:1};d.animOut={opacity:0};d.cssBefore={top:0,left:0}}};f.fn.cycle.ver=function(){return"2.9999.81"};
f.fn.cycle.defaults={activePagerClass:"activeSlide",after:null,allowPagerClickBubble:!1,animIn:null,animOut:null,aspect:!1,autostop:0,autostopCount:0,backwards:!1,before:null,center:null,cleartype:!f.support.opacity,cleartypeNoBg:!1,containerResize:1,containerResizeHeight:0,continuous:0,cssAfter:null,cssBefore:null,delay:0,easeIn:null,easeOut:null,easing:null,end:null,fastOnEvent:0,fit:0,fx:"fade",fxFn:null,height:"auto",manualTrump:!0,metaAttr:"cycle",next:null,nowrap:0,onPagerEvent:null,onPrevNextEvent:null,
pager:null,pagerAnchorBuilder:null,pagerEvent:"click.cycle",pause:0,pauseOnPagerHover:0,prev:null,prevNextEvent:"click.cycle",random:0,randomizeEffects:1,requeueOnImageNotLoaded:!0,requeueTimeout:250,rev:0,shuffle:null,skipInitializationCallbacks:!1,slideExpr:null,slideResize:1,speed:1E3,speedIn:null,speedOut:null,startingSlide:e,sync:1,timeout:4E3,timeoutFn:null,updateActivePagerLink:null,width:null}})(jQuery);
(function(f){f.fn.cycle.transitions.none=function(e,g,a){a.fxFn=function(a,e,d,g){f(e).show();f(a).hide();g()}};f.fn.cycle.transitions.fadeout=function(e,g,a){g.not(":eq("+a.currSlide+")").css({display:"block",opacity:1});a.before.push(function(a,e,d,g,t,p){f(a).css("zIndex",d.slideCount+(!0!==p?1:0));f(e).css("zIndex",d.slideCount+(!0!==p?0:1))});a.animIn.opacity=1;a.animOut.opacity=0;a.cssBefore.opacity=1;a.cssBefore.display="block";a.cssAfter.zIndex=0};f.fn.cycle.transitions.scrollUp=function(e,
g,a){e.css("overflow","hidden");a.before.push(f.fn.cycle.commonReset);e=e.height();a.cssBefore.top=e;a.cssBefore.left=0;a.cssFirst.top=0;a.animIn.top=0;a.animOut.top=-e};f.fn.cycle.transitions.scrollDown=function(e,g,a){e.css("overflow","hidden");a.before.push(f.fn.cycle.commonReset);e=e.height();a.cssFirst.top=0;a.cssBefore.top=-e;a.cssBefore.left=0;a.animIn.top=0;a.animOut.top=e};f.fn.cycle.transitions.scrollLeft=function(e,g,a){e.css("overflow","hidden");a.before.push(f.fn.cycle.commonReset);e=
e.width();a.cssFirst.left=0;a.cssBefore.left=e;a.cssBefore.top=0;a.animIn.left=0;a.animOut.left=0-e};f.fn.cycle.transitions.scrollRight=function(e,g,a){e.css("overflow","hidden");a.before.push(f.fn.cycle.commonReset);e=e.width();a.cssFirst.left=0;a.cssBefore.left=-e;a.cssBefore.top=0;a.animIn.left=0;a.animOut.left=e};f.fn.cycle.transitions.scrollHorz=function(e,g,a){e.css("overflow","hidden").width();a.before.push(function(a,e,d,g){d.rev&&(g=!g);f.fn.cycle.commonReset(a,e,d);d.cssBefore.left=g?e.cycleW-
1:1-e.cycleW;d.animOut.left=g?-a.cycleW:a.cycleW});a.cssFirst.left=0;a.cssBefore.top=0;a.animIn.left=0;a.animOut.top=0};f.fn.cycle.transitions.scrollVert=function(e,g,a){e.css("overflow","hidden");a.before.push(function(a,e,d,g){d.rev&&(g=!g);f.fn.cycle.commonReset(a,e,d);d.cssBefore.top=g?1-e.cycleH:e.cycleH-1;d.animOut.top=g?a.cycleH:-a.cycleH});a.cssFirst.top=0;a.cssBefore.left=0;a.animIn.top=0;a.animOut.left=0};f.fn.cycle.transitions.slideX=function(e,g,a){a.before.push(function(a,e,d){f(d.elements).not(a).hide();
f.fn.cycle.commonReset(a,e,d,!1,!0);d.animIn.width=e.cycleW});a.cssBefore.left=0;a.cssBefore.top=0;a.cssBefore.width=0;a.animIn.width="show";a.animOut.width=0};f.fn.cycle.transitions.slideY=function(e,g,a){a.before.push(function(a,e,d){f(d.elements).not(a).hide();f.fn.cycle.commonReset(a,e,d,!0,!1);d.animIn.height=e.cycleH});a.cssBefore.left=0;a.cssBefore.top=0;a.cssBefore.height=0;a.animIn.height="show";a.animOut.height=0};f.fn.cycle.transitions.shuffle=function(e,g,a){e=e.css("overflow","visible").width();
g.css({left:0,top:0});a.before.push(function(a,e,d){f.fn.cycle.commonReset(a,e,d,!0,!0,!0)});a.speedAdjusted||(a.speed/=2,a.speedAdjusted=!0);a.random=0;a.shuffle=a.shuffle||{left:-e,top:15};a.els=[];for(e=0;e<g.length;e++)a.els.push(g[e]);for(e=0;e<a.currSlide;e++)a.els.push(a.els.shift());a.fxFn=function(a,e,d,g,t){d.rev&&(t=!t);var p=t?f(a):f(e);f(e).css(d.cssBefore);var x=d.slideCount;p.animate(d.shuffle,d.speedIn,d.easeIn,function(){for(var e=f.fn.cycle.hopsFromLast(d,t),k=0;k<e;k++)t?d.els.push(d.els.shift()):
d.els.unshift(d.els.pop());if(t){e=0;for(k=d.els.length;e<k;e++)f(d.els[e]).css("z-index",k-e+x)}else e=f(a).css("z-index"),p.css("z-index",parseInt(e,10)+1+x);p.animate({left:0,top:0},d.speedOut,d.easeOut,function(){f(t?this:a).hide();g&&g()})})};f.extend(a.cssBefore,{display:"block",opacity:1,top:0,left:0})};f.fn.cycle.transitions.turnUp=function(e,g,a){a.before.push(function(a,e,d){f.fn.cycle.commonReset(a,e,d,!0,!1);d.cssBefore.top=e.cycleH;d.animIn.height=e.cycleH;d.animOut.width=e.cycleW});
a.cssFirst.top=0;a.cssBefore.left=0;a.cssBefore.height=0;a.animIn.top=0;a.animOut.height=0};f.fn.cycle.transitions.turnDown=function(e,g,a){a.before.push(function(a,e,d){f.fn.cycle.commonReset(a,e,d,!0,!1);d.animIn.height=e.cycleH;d.animOut.top=a.cycleH});a.cssFirst.top=0;a.cssBefore.left=0;a.cssBefore.top=0;a.cssBefore.height=0;a.animOut.height=0};f.fn.cycle.transitions.turnLeft=function(e,g,a){a.before.push(function(a,e,d){f.fn.cycle.commonReset(a,e,d,!1,!0);d.cssBefore.left=e.cycleW;d.animIn.width=
e.cycleW});a.cssBefore.top=0;a.cssBefore.width=0;a.animIn.left=0;a.animOut.width=0};f.fn.cycle.transitions.turnRight=function(e,g,a){a.before.push(function(a,e,d){f.fn.cycle.commonReset(a,e,d,!1,!0);d.animIn.width=e.cycleW;d.animOut.left=a.cycleW});f.extend(a.cssBefore,{top:0,left:0,width:0});a.animIn.left=0;a.animOut.width=0};f.fn.cycle.transitions.zoom=function(e,g,a){a.before.push(function(a,e,d){f.fn.cycle.commonReset(a,e,d,!1,!1,!0);d.cssBefore.top=e.cycleH/2;d.cssBefore.left=e.cycleW/2;f.extend(d.animIn,
{top:0,left:0,width:e.cycleW,height:e.cycleH});f.extend(d.animOut,{width:0,height:0,top:a.cycleH/2,left:a.cycleW/2})});a.cssFirst.top=0;a.cssFirst.left=0;a.cssBefore.width=0;a.cssBefore.height=0};f.fn.cycle.transitions.fadeZoom=function(e,g,a){a.before.push(function(a,e,d){f.fn.cycle.commonReset(a,e,d,!1,!1);d.cssBefore.left=e.cycleW/2;d.cssBefore.top=e.cycleH/2;f.extend(d.animIn,{top:0,left:0,width:e.cycleW,height:e.cycleH})});a.cssBefore.width=0;a.cssBefore.height=0;a.animOut.opacity=0};f.fn.cycle.transitions.blindX=
function(e,g,a){e=e.css("overflow","hidden").width();a.before.push(function(a,e,d){f.fn.cycle.commonReset(a,e,d);d.animIn.width=e.cycleW;d.animOut.left=a.cycleW});a.cssBefore.left=e;a.cssBefore.top=0;a.animIn.left=0;a.animOut.left=e};f.fn.cycle.transitions.blindY=function(e,g,a){e=e.css("overflow","hidden").height();a.before.push(function(a,e,d){f.fn.cycle.commonReset(a,e,d);d.animIn.height=e.cycleH;d.animOut.top=a.cycleH});a.cssBefore.top=e;a.cssBefore.left=0;a.animIn.top=0;a.animOut.top=e};f.fn.cycle.transitions.blindZ=
function(e,g,a){g=e.css("overflow","hidden").height();e=e.width();a.before.push(function(a,e,d){f.fn.cycle.commonReset(a,e,d);d.animIn.height=e.cycleH;d.animOut.top=a.cycleH});a.cssBefore.top=g;a.cssBefore.left=e;a.animIn.top=0;a.animIn.left=0;a.animOut.top=g;a.animOut.left=e};f.fn.cycle.transitions.growX=function(e,g,a){a.before.push(function(a,e,d){f.fn.cycle.commonReset(a,e,d,!1,!0);d.cssBefore.left=this.cycleW/2;d.animIn.left=0;d.animIn.width=this.cycleW;d.animOut.left=0});a.cssBefore.top=0;a.cssBefore.width=
0};f.fn.cycle.transitions.growY=function(e,g,a){a.before.push(function(a,e,d){f.fn.cycle.commonReset(a,e,d,!0,!1);d.cssBefore.top=this.cycleH/2;d.animIn.top=0;d.animIn.height=this.cycleH;d.animOut.top=0});a.cssBefore.height=0;a.cssBefore.left=0};f.fn.cycle.transitions.curtainX=function(e,g,a){a.before.push(function(a,e,d){f.fn.cycle.commonReset(a,e,d,!1,!0,!0);d.cssBefore.left=e.cycleW/2;d.animIn.left=0;d.animIn.width=this.cycleW;d.animOut.left=a.cycleW/2;d.animOut.width=0});a.cssBefore.top=0;a.cssBefore.width=
0};f.fn.cycle.transitions.curtainY=function(e,g,a){a.before.push(function(a,e,d){f.fn.cycle.commonReset(a,e,d,!0,!1,!0);d.cssBefore.top=e.cycleH/2;d.animIn.top=0;d.animIn.height=e.cycleH;d.animOut.top=a.cycleH/2;d.animOut.height=0});a.cssBefore.height=0;a.cssBefore.left=0};f.fn.cycle.transitions.cover=function(e,g,a){var m=a.direction||"left",k=e.css("overflow","hidden").width(),d=e.height();a.before.push(function(a,e,g){f.fn.cycle.commonReset(a,e,g);g.cssAfter.display="";"right"==m?g.cssBefore.left=
-k:"up"==m?g.cssBefore.top=d:"down"==m?g.cssBefore.top=-d:g.cssBefore.left=k});a.animIn.left=0;a.animIn.top=0;a.cssBefore.top=0;a.cssBefore.left=0};f.fn.cycle.transitions.uncover=function(e,g,a){var m=a.direction||"left",k=e.css("overflow","hidden").width(),d=e.height();a.before.push(function(a,e,g){f.fn.cycle.commonReset(a,e,g,!0,!0,!0);"right"==m?g.animOut.left=k:"up"==m?g.animOut.top=-d:"down"==m?g.animOut.top=d:g.animOut.left=-k});a.animIn.left=0;a.animIn.top=0;a.cssBefore.top=0;a.cssBefore.left=
0};f.fn.cycle.transitions.toss=function(e,g,a){var m=e.css("overflow","visible").width(),k=e.height();a.before.push(function(a,e,g){f.fn.cycle.commonReset(a,e,g,!0,!0,!0);!g.animOut.left&&!g.animOut.top?f.extend(g.animOut,{left:2*m,top:-k/2,opacity:0}):g.animOut.opacity=0});a.cssBefore.left=0;a.cssBefore.top=0;a.animIn.left=0};f.fn.cycle.transitions.wipe=function(e,g,a){var m=e.css("overflow","hidden").width(),k=e.height();a.cssBefore=a.cssBefore||{};var d;a.clip&&(/l2r/.test(a.clip)?d="rect(0px 0px "+
k+"px 0px)":/r2l/.test(a.clip)?d="rect(0px "+m+"px "+k+"px "+m+"px)":/t2b/.test(a.clip)?d="rect(0px "+m+"px 0px 0px)":/b2t/.test(a.clip)?d="rect("+k+"px "+m+"px "+k+"px 0px)":/zoom/.test(a.clip)&&(e=parseInt(k/2,10),g=parseInt(m/2,10),d="rect("+e+"px "+g+"px "+e+"px "+g+"px)"));a.cssBefore.clip=a.cssBefore.clip||d||"rect(0px 0px 0px 0px)";e=a.cssBefore.clip.match(/(\d+)/g);var v=parseInt(e[0],10),t=parseInt(e[1],10),p=parseInt(e[2],10),x=parseInt(e[3],10);a.before.push(function(a,d,b){if(a!=d){var e=
f(a),g=f(d);f.fn.cycle.commonReset(a,d,b,!0,!0,!1);b.cssAfter.display="block";var r=1,j=parseInt(b.speedIn/13,10)-1;(function l(){var a=v?v-parseInt(r*(v/j),10):0,b=x?x-parseInt(r*(x/j),10):0,d=p<k?p+parseInt(r*((k-p)/j||1),10):k,f=t<m?t+parseInt(r*((m-t)/j||1),10):m;g.css({clip:"rect("+a+"px "+f+"px "+d+"px "+b+"px)"});r++<=j?setTimeout(l,13):e.css("display","none")})()}});f.extend(a.cssBefore,{display:"block",opacity:1,top:0,left:0});a.animIn={left:0};a.animOut={left:0}}})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment