Plugin Directory

Changeset 434828


Ignore:
Timestamp:
09/07/2011 06:38:15 PM (15 years ago)
Author:
jenz
Message:

Height bug fix, updated version of jQuery Cycle

Location:
sdac-post-slideshows
Files:
6 edited
1 copied

Legend:

Unmodified
Added
Removed
  • sdac-post-slideshows/tags/1.1.3/js/jquery.cycle.min.js

    r350003 r434828  
    1 /*
     1/*!
    22 * jQuery Cycle Plugin (with Transition Definitions)
    33 * Examples and documentation at: http://jquery.malsup.com/cycle/
    44 * Copyright (c) 2007-2010 M. Alsup
    5  * Version: 2.94 (20-DEC-2010)
     5 * Version: 2.9995 (09-AUG-2011)
    66 * Dual licensed under the MIT and GPL licenses.
    77 * http://jquery.malsup.com/license.html
    8  * Requires: jQuery v1.2.6 or later
     8 * Requires: jQuery v1.3.2 or later
    99 */
    10 (function($){var ver="2.94";if($.support==undefined){$.support={opacity:!($.browser.msie)};}function debug(s){if($.fn.cycle.debug){log(s);}}function log(){if(window.console&&window.console.log){window.console.log("[cycle] "+Array.prototype.join.call(arguments," "));}}$.fn.cycle=function(options,arg2){var o={s:this.selector,c:this.context};if(this.length===0&&options!="stop"){if(!$.isReady&&o.s){log("DOM not ready, queuing slideshow");$(function(){$(o.s,o.c).cycle(options,arg2);});return this;}log("terminating; zero elements found by selector"+($.isReady?"":" (DOM not ready)"));return this;}return this.each(function(){var opts=handleArguments(this,options,arg2);if(opts===false){return;}opts.updateActivePagerLink=opts.updateActivePagerLink||$.fn.cycle.updateActivePagerLink;if(this.cycleTimeout){clearTimeout(this.cycleTimeout);}this.cycleTimeout=this.cyclePause=0;var $cont=$(this);var $slides=opts.slideExpr?$(opts.slideExpr,this):$cont.children();var els=$slides.get();if(els.length<2){log("terminating; too few slides: "+els.length);return;}var opts2=buildOptions($cont,$slides,els,opts,o);if(opts2===false){return;}var startTime=opts2.continuous?10:getTimeout(els[opts2.currSlide],els[opts2.nextSlide],opts2,!opts2.backwards);if(startTime){startTime+=(opts2.delay||0);if(startTime<10){startTime=10;}debug("first timeout: "+startTime);this.cycleTimeout=setTimeout(function(){go(els,opts2,0,!opts.backwards);},startTime);}});};function handleArguments(cont,options,arg2){if(cont.cycleStop==undefined){cont.cycleStop=0;}if(options===undefined||options===null){options={};}if(options.constructor==String){switch(options){case"destroy":case"stop":var opts=$(cont).data("cycle.opts");if(!opts){return false;}cont.cycleStop++;if(cont.cycleTimeout){clearTimeout(cont.cycleTimeout);}cont.cycleTimeout=0;$(cont).removeData("cycle.opts");if(options=="destroy"){destroy(opts);}return false;case"toggle":cont.cyclePause=(cont.cyclePause===1)?0:1;checkInstantResume(cont.cyclePause,arg2,cont);return false;case"pause":cont.cyclePause=1;return false;case"resume":cont.cyclePause=0;checkInstantResume(false,arg2,cont);return false;case"prev":case"next":var opts=$(cont).data("cycle.opts");if(!opts){log('options not found, "prev/next" ignored');return false;}$.fn.cycle[options](opts);return false;default:options={fx:options};}return options;}else{if(options.constructor==Number){var num=options;options=$(cont).data("cycle.opts");if(!options){log("options not found, can not advance slide");return false;}if(num<0||num>=options.elements.length){log("invalid slide index: "+num);return false;}options.nextSlide=num;if(cont.cycleTimeout){clearTimeout(cont.cycleTimeout);cont.cycleTimeout=0;}if(typeof arg2=="string"){options.oneTimeFx=arg2;}go(options.elements,options,1,num>=options.currSlide);return false;}}return options;function checkInstantResume(isPaused,arg2,cont){if(!isPaused&&arg2===true){var options=$(cont).data("cycle.opts");if(!options){log("options not found, can not resume");return false;}if(cont.cycleTimeout){clearTimeout(cont.cycleTimeout);cont.cycleTimeout=0;}go(options.elements,options,1,!options.backwards);}}}function removeFilter(el,opts){if(!$.support.opacity&&opts.cleartype&&el.style.filter){try{el.style.removeAttribute("filter");}catch(smother){}}}function destroy(opts){if(opts.next){$(opts.next).unbind(opts.prevNextEvent);}if(opts.prev){$(opts.prev).unbind(opts.prevNextEvent);}if(opts.pager||opts.pagerAnchorBuilder){$.each(opts.pagerAnchors||[],function(){this.unbind().remove();});}opts.pagerAnchors=null;if(opts.destroy){opts.destroy(opts);}}function buildOptions($cont,$slides,els,options,o){var opts=$.extend({},$.fn.cycle.defaults,options||{},$.metadata?$cont.metadata():$.meta?$cont.data():{});if(opts.autostop){opts.countdown=opts.autostopCount||els.length;}var cont=$cont[0];$cont.data("cycle.opts",opts);opts.$cont=$cont;opts.stopCount=cont.cycleStop;opts.elements=els;opts.before=opts.before?[opts.before]:[];opts.after=opts.after?[opts.after]:[];opts.after.unshift(function(){opts.busy=0;});if(!$.support.opacity&&opts.cleartype){opts.after.push(function(){removeFilter(this,opts);});}if(opts.continuous){opts.after.push(function(){go(els,opts,0,!opts.backwards);});}saveOriginalOpts(opts);if(!$.support.opacity&&opts.cleartype&&!opts.cleartypeNoBg){clearTypeFix($slides);}if($cont.css("position")=="static"){$cont.css("position","relative");}if(opts.width){$cont.width(opts.width);}if(opts.height&&opts.height!="auto"){$cont.height(opts.height);}if(opts.startingSlide){opts.startingSlide=parseInt(opts.startingSlide);}else{if(opts.backwards){opts.startingSlide=els.length-1;}}if(opts.random){opts.randomMap=[];for(var i=0;i<els.length;i++){opts.randomMap.push(i);}opts.randomMap.sort(function(a,b){return Math.random()-0.5;});opts.randomIndex=1;opts.startingSlide=opts.randomMap[1];}else{if(opts.startingSlide>=els.length){opts.startingSlide=0;}}opts.currSlide=opts.startingSlide||0;var first=opts.startingSlide;$slides.css({position:"absolute",top:0,left:0}).hide().each(function(i){var z;if(opts.backwards){z=first?i<=first?els.length+(i-first):first-i:els.length-i;}else{z=first?i>=first?els.length-(i-first):first-i:els.length-i;}$(this).css("z-index",z);});$(els[first]).css("opacity",1).show();removeFilter(els[first],opts);if(opts.fit&&opts.width){$slides.width(opts.width);}if(opts.fit&&opts.height&&opts.height!="auto"){$slides.height(opts.height);}var reshape=opts.containerResize&&!$cont.innerHeight();if(reshape){var maxw=0,maxh=0;for(var j=0;j<els.length;j++){var $e=$(els[j]),e=$e[0],w=$e.outerWidth(),h=$e.outerHeight();if(!w){w=e.offsetWidth||e.width||$e.attr("width");}if(!h){h=e.offsetHeight||e.height||$e.attr("height");}maxw=w>maxw?w:maxw;maxh=h>maxh?h:maxh;}if(maxw>0&&maxh>0){$cont.css({width:maxw+"px",height:maxh+"px"});}}if(opts.pause){$cont.hover(function(){this.cyclePause++;},function(){this.cyclePause--;});}if(supportMultiTransitions(opts)===false){return false;}var requeue=false;options.requeueAttempts=options.requeueAttempts||0;$slides.each(function(){var $el=$(this);this.cycleH=(opts.fit&&opts.height)?opts.height:($el.height()||this.offsetHeight||this.height||$el.attr("height")||0);this.cycleW=(opts.fit&&opts.width)?opts.width:($el.width()||this.offsetWidth||this.width||$el.attr("width")||0);if($el.is("img")){var loadingIE=($.browser.msie&&this.cycleW==28&&this.cycleH==30&&!this.complete);var loadingFF=($.browser.mozilla&&this.cycleW==34&&this.cycleH==19&&!this.complete);var loadingOp=($.browser.opera&&((this.cycleW==42&&this.cycleH==19)||(this.cycleW==37&&this.cycleH==17))&&!this.complete);var loadingOther=(this.cycleH==0&&this.cycleW==0&&!this.complete);if(loadingIE||loadingFF||loadingOp||loadingOther){if(o.s&&opts.requeueOnImageNotLoaded&&++options.requeueAttempts<100){log(options.requeueAttempts," - img slide not loaded, requeuing slideshow: ",this.src,this.cycleW,this.cycleH);setTimeout(function(){$(o.s,o.c).cycle(options);},opts.requeueTimeout);requeue=true;return false;}else{log("could not determine size of image: "+this.src,this.cycleW,this.cycleH);}}}return true;});if(requeue){return false;}opts.cssBefore=opts.cssBefore||{};opts.animIn=opts.animIn||{};opts.animOut=opts.animOut||{};$slides.not(":eq("+first+")").css(opts.cssBefore);if(opts.cssFirst){$($slides[first]).css(opts.cssFirst);}if(opts.timeout){opts.timeout=parseInt(opts.timeout);if(opts.speed.constructor==String){opts.speed=$.fx.speeds[opts.speed]||parseInt(opts.speed);}if(!opts.sync){opts.speed=opts.speed/2;}var buffer=opts.fx=="shuffle"?500:250;while((opts.timeout-opts.speed)<buffer){opts.timeout+=opts.speed;}}if(opts.easing){opts.easeIn=opts.easeOut=opts.easing;}if(!opts.speedIn){opts.speedIn=opts.speed;}if(!opts.speedOut){opts.speedOut=opts.speed;}opts.slideCount=els.length;opts.currSlide=opts.lastSlide=first;if(opts.random){if(++opts.randomIndex==els.length){opts.randomIndex=0;}opts.nextSlide=opts.randomMap[opts.randomIndex];}else{if(opts.backwards){opts.nextSlide=opts.startingSlide==0?(els.length-1):opts.startingSlide-1;}else{opts.nextSlide=opts.startingSlide>=(els.length-1)?0:opts.startingSlide+1;}}if(!opts.multiFx){var init=$.fn.cycle.transitions[opts.fx];if($.isFunction(init)){init($cont,$slides,opts);}else{if(opts.fx!="custom"&&!opts.multiFx){log("unknown transition: "+opts.fx,"; slideshow terminating");return false;}}}var e0=$slides[first];if(opts.before.length){opts.before[0].apply(e0,[e0,e0,opts,true]);}if(opts.after.length>1){opts.after[1].apply(e0,[e0,e0,opts,true]);}if(opts.next){$(opts.next).bind(opts.prevNextEvent,function(){return advance(opts,1);});}if(opts.prev){$(opts.prev).bind(opts.prevNextEvent,function(){return advance(opts,0);});}if(opts.pager||opts.pagerAnchorBuilder){buildPager(els,opts);}exposeAddSlide(opts,els);return opts;}function saveOriginalOpts(opts){opts.original={before:[],after:[]};opts.original.cssBefore=$.extend({},opts.cssBefore);opts.original.cssAfter=$.extend({},opts.cssAfter);opts.original.animIn=$.extend({},opts.animIn);opts.original.animOut=$.extend({},opts.animOut);$.each(opts.before,function(){opts.original.before.push(this);});$.each(opts.after,function(){opts.original.after.push(this);});}function supportMultiTransitions(opts){var i,tx,txs=$.fn.cycle.transitions;if(opts.fx.indexOf(",")>0){opts.multiFx=true;opts.fxs=opts.fx.replace(/\s*/g,"").split(",");for(i=0;i<opts.fxs.length;i++){var fx=opts.fxs[i];tx=txs[fx];if(!tx||!txs.hasOwnProperty(fx)||!$.isFunction(tx)){log("discarding unknown transition: ",fx);opts.fxs.splice(i,1);i--;}}if(!opts.fxs.length){log("No valid transitions named; slideshow terminating.");return false;}}else{if(opts.fx=="all"){opts.multiFx=true;opts.fxs=[];for(p in txs){tx=txs[p];if(txs.hasOwnProperty(p)&&$.isFunction(tx)){opts.fxs.push(p);}}}}if(opts.multiFx&&opts.randomizeEffects){var r1=Math.floor(Math.random()*20)+30;for(i=0;i<r1;i++){var r2=Math.floor(Math.random()*opts.fxs.length);opts.fxs.push(opts.fxs.splice(r2,1)[0]);}debug("randomized fx sequence: ",opts.fxs);}return true;}function exposeAddSlide(opts,els){opts.addSlide=function(newSlide,prepend){var $s=$(newSlide),s=$s[0];if(!opts.autostopCount){opts.countdown++;}els[prepend?"unshift":"push"](s);if(opts.els){opts.els[prepend?"unshift":"push"](s);}opts.slideCount=els.length;$s.css("position","absolute");$s[prepend?"prependTo":"appendTo"](opts.$cont);if(prepend){opts.currSlide++;opts.nextSlide++;}if(!$.support.opacity&&opts.cleartype&&!opts.cleartypeNoBg){clearTypeFix($s);}if(opts.fit&&opts.width){$s.width(opts.width);}if(opts.fit&&opts.height&&opts.height!="auto"){$s.height(opts.height);}s.cycleH=(opts.fit&&opts.height)?opts.height:$s.height();s.cycleW=(opts.fit&&opts.width)?opts.width:$s.width();$s.css(opts.cssBefore);if(opts.pager||opts.pagerAnchorBuilder){$.fn.cycle.createPagerAnchor(els.length-1,s,$(opts.pager),els,opts);}if($.isFunction(opts.onAddSlide)){opts.onAddSlide($s);}else{$s.hide();}};}$.fn.cycle.resetState=function(opts,fx){fx=fx||opts.fx;opts.before=[];opts.after=[];opts.cssBefore=$.extend({},opts.original.cssBefore);opts.cssAfter=$.extend({},opts.original.cssAfter);opts.animIn=$.extend({},opts.original.animIn);opts.animOut=$.extend({},opts.original.animOut);opts.fxFn=null;$.each(opts.original.before,function(){opts.before.push(this);});$.each(opts.original.after,function(){opts.after.push(this);});var init=$.fn.cycle.transitions[fx];if($.isFunction(init)){init(opts.$cont,$(opts.elements),opts);}};function go(els,opts,manual,fwd){if(manual&&opts.busy&&opts.manualTrump){debug("manualTrump in go(), stopping active transition");$(els).stop(true,true);opts.busy=false;}if(opts.busy){debug("transition active, ignoring new tx request");return;}var p=opts.$cont[0],curr=els[opts.currSlide],next=els[opts.nextSlide];if(p.cycleStop!=opts.stopCount||p.cycleTimeout===0&&!manual){return;}if(!manual&&!p.cyclePause&&!opts.bounce&&((opts.autostop&&(--opts.countdown<=0))||(opts.nowrap&&!opts.random&&opts.nextSlide<opts.currSlide))){if(opts.end){opts.end(opts);}return;}var changed=false;if((manual||!p.cyclePause)&&(opts.nextSlide!=opts.currSlide)){changed=true;var fx=opts.fx;curr.cycleH=curr.cycleH||$(curr).height();curr.cycleW=curr.cycleW||$(curr).width();next.cycleH=next.cycleH||$(next).height();next.cycleW=next.cycleW||$(next).width();if(opts.multiFx){if(opts.lastFx==undefined||++opts.lastFx>=opts.fxs.length){opts.lastFx=0;}fx=opts.fxs[opts.lastFx];opts.currFx=fx;}if(opts.oneTimeFx){fx=opts.oneTimeFx;opts.oneTimeFx=null;}$.fn.cycle.resetState(opts,fx);if(opts.before.length){$.each(opts.before,function(i,o){if(p.cycleStop!=opts.stopCount){return;}o.apply(next,[curr,next,opts,fwd]);});}var after=function(){$.each(opts.after,function(i,o){if(p.cycleStop!=opts.stopCount){return;}o.apply(next,[curr,next,opts,fwd]);});};debug("tx firing; currSlide: "+opts.currSlide+"; nextSlide: "+opts.nextSlide);opts.busy=1;if(opts.fxFn){opts.fxFn(curr,next,opts,after,fwd,manual&&opts.fastOnEvent);}else{if($.isFunction($.fn.cycle[opts.fx])){$.fn.cycle[opts.fx](curr,next,opts,after,fwd,manual&&opts.fastOnEvent);}else{$.fn.cycle.custom(curr,next,opts,after,fwd,manual&&opts.fastOnEvent);}}}if(changed||opts.nextSlide==opts.currSlide){opts.lastSlide=opts.currSlide;if(opts.random){opts.currSlide=opts.nextSlide;if(++opts.randomIndex==els.length){opts.randomIndex=0;}opts.nextSlide=opts.randomMap[opts.randomIndex];if(opts.nextSlide==opts.currSlide){opts.nextSlide=(opts.currSlide==opts.slideCount-1)?0:opts.currSlide+1;}}else{if(opts.backwards){var roll=(opts.nextSlide-1)<0;if(roll&&opts.bounce){opts.backwards=!opts.backwards;opts.nextSlide=1;opts.currSlide=0;}else{opts.nextSlide=roll?(els.length-1):opts.nextSlide-1;opts.currSlide=roll?0:opts.nextSlide+1;}}else{var roll=(opts.nextSlide+1)==els.length;if(roll&&opts.bounce){opts.backwards=!opts.backwards;opts.nextSlide=els.length-2;opts.currSlide=els.length-1;}else{opts.nextSlide=roll?0:opts.nextSlide+1;opts.currSlide=roll?els.length-1:opts.nextSlide-1;}}}}if(changed&&opts.pager){opts.updateActivePagerLink(opts.pager,opts.currSlide,opts.activePagerClass);}var ms=0;if(opts.timeout&&!opts.continuous){ms=getTimeout(els[opts.currSlide],els[opts.nextSlide],opts,fwd);}else{if(opts.continuous&&p.cyclePause){ms=10;}}if(ms>0){p.cycleTimeout=setTimeout(function(){go(els,opts,0,!opts.backwards);},ms);}}$.fn.cycle.updateActivePagerLink=function(pager,currSlide,clsName){$(pager).each(function(){$(this).children().removeClass(clsName).eq(currSlide).addClass(clsName);});};function getTimeout(curr,next,opts,fwd){if(opts.timeoutFn){var t=opts.timeoutFn.call(curr,curr,next,opts,fwd);while((t-opts.speed)<250){t+=opts.speed;}debug("calculated timeout: "+t+"; speed: "+opts.speed);if(t!==false){return t;}}return opts.timeout;}$.fn.cycle.next=function(opts){advance(opts,1);};$.fn.cycle.prev=function(opts){advance(opts,0);};function advance(opts,moveForward){var val=moveForward?1:-1;var els=opts.elements;var p=opts.$cont[0],timeout=p.cycleTimeout;if(timeout){clearTimeout(timeout);p.cycleTimeout=0;}if(opts.random&&val<0){opts.randomIndex--;if(--opts.randomIndex==-2){opts.randomIndex=els.length-2;}else{if(opts.randomIndex==-1){opts.randomIndex=els.length-1;}}opts.nextSlide=opts.randomMap[opts.randomIndex];}else{if(opts.random){opts.nextSlide=opts.randomMap[opts.randomIndex];}else{opts.nextSlide=opts.currSlide+val;if(opts.nextSlide<0){if(opts.nowrap){return false;}opts.nextSlide=els.length-1;}else{if(opts.nextSlide>=els.length){if(opts.nowrap){return false;}opts.nextSlide=0;}}}}var cb=opts.onPrevNextEvent||opts.prevNextClick;if($.isFunction(cb)){cb(val>0,opts.nextSlide,els[opts.nextSlide]);}go(els,opts,1,moveForward);return false;}function buildPager(els,opts){var $p=$(opts.pager);$.each(els,function(i,o){$.fn.cycle.createPagerAnchor(i,o,$p,els,opts);});opts.updateActivePagerLink(opts.pager,opts.startingSlide,opts.activePagerClass);}$.fn.cycle.createPagerAnchor=function(i,el,$p,els,opts){var a;if($.isFunction(opts.pagerAnchorBuilder)){a=opts.pagerAnchorBuilder(i,el);debug("pagerAnchorBuilder("+i+", el) returned: "+a);}else{a='<a href="#">'+(i+1)+"</a>";}if(!a){return;}var $a=$(a);if($a.parents("body").length===0){var arr=[];if($p.length>1){$p.each(function(){var $clone=$a.clone(true);$(this).append($clone);arr.push($clone[0]);});$a=$(arr);}else{$a.appendTo($p);}}opts.pagerAnchors=opts.pagerAnchors||[];opts.pagerAnchors.push($a);$a.bind(opts.pagerEvent,function(e){e.preventDefault();opts.nextSlide=i;var p=opts.$cont[0],timeout=p.cycleTimeout;if(timeout){clearTimeout(timeout);p.cycleTimeout=0;}var cb=opts.onPagerEvent||opts.pagerClick;if($.isFunction(cb)){cb(opts.nextSlide,els[opts.nextSlide]);}go(els,opts,1,opts.currSlide<i);});if(!/^click/.test(opts.pagerEvent)&&!opts.allowPagerClickBubble){$a.bind("click.cycle",function(){return false;});}if(opts.pauseOnPagerHover){$a.hover(function(){opts.$cont[0].cyclePause++;},function(){opts.$cont[0].cyclePause--;});}};$.fn.cycle.hopsFromLast=function(opts,fwd){var hops,l=opts.lastSlide,c=opts.currSlide;if(fwd){hops=c>l?c-l:opts.slideCount-l;}else{hops=c<l?l-c:l+opts.slideCount-c;}return hops;};function clearTypeFix($slides){debug("applying clearType background-color hack");function hex(s){s=parseInt(s).toString(16);return s.length<2?"0"+s:s;}function getBg(e){for(;e&&e.nodeName.toLowerCase()!="html";e=e.parentNode){var v=$.css(e,"background-color");if(v.indexOf("rgb")>=0){var rgb=v.match(/\d+/g);return"#"+hex(rgb[0])+hex(rgb[1])+hex(rgb[2]);}if(v&&v!="transparent"){return v;}}return"#ffffff";}$slides.each(function(){$(this).css("background-color",getBg(this));});}$.fn.cycle.commonReset=function(curr,next,opts,w,h,rev){$(opts.elements).not(curr).hide();opts.cssBefore.opacity=1;opts.cssBefore.display="block";if(opts.slideResize&&w!==false&&next.cycleW>0){opts.cssBefore.width=next.cycleW;}if(opts.slideResize&&h!==false&&next.cycleH>0){opts.cssBefore.height=next.cycleH;}opts.cssAfter=opts.cssAfter||{};opts.cssAfter.display="none";$(curr).css("zIndex",opts.slideCount+(rev===true?1:0));$(next).css("zIndex",opts.slideCount+(rev===true?0:1));};$.fn.cycle.custom=function(curr,next,opts,cb,fwd,speedOverride){var $l=$(curr),$n=$(next);var speedIn=opts.speedIn,speedOut=opts.speedOut,easeIn=opts.easeIn,easeOut=opts.easeOut;$n.css(opts.cssBefore);if(speedOverride){if(typeof speedOverride=="number"){speedIn=speedOut=speedOverride;}else{speedIn=speedOut=1;}easeIn=easeOut=null;}var fn=function(){$n.animate(opts.animIn,speedIn,easeIn,cb);};$l.animate(opts.animOut,speedOut,easeOut,function(){if(opts.cssAfter){$l.css(opts.cssAfter);}if(!opts.sync){fn();}});if(opts.sync){fn();}};$.fn.cycle.transitions={fade:function($cont,$slides,opts){$slides.not(":eq("+opts.currSlide+")").css("opacity",0);opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts);opts.cssBefore.opacity=0;});opts.animIn={opacity:1};opts.animOut={opacity:0};opts.cssBefore={top:0,left:0};}};$.fn.cycle.ver=function(){return ver;};$.fn.cycle.defaults={fx:"fade",timeout:4000,timeoutFn:null,continuous:0,speed:1000,speedIn:null,speedOut:null,next:null,prev:null,onPrevNextEvent:null,prevNextEvent:"click.cycle",pager:null,onPagerEvent:null,pagerEvent:"click.cycle",allowPagerClickBubble:false,pagerAnchorBuilder:null,before:null,after:null,end:null,easing:null,easeIn:null,easeOut:null,shuffle:null,animIn:null,animOut:null,cssBefore:null,cssAfter:null,fxFn:null,height:"auto",startingSlide:0,sync:1,random:0,fit:0,containerResize:1,slideResize:1,pause:0,pauseOnPagerHover:0,autostop:0,autostopCount:0,delay:0,slideExpr:null,cleartype:!$.support.opacity,cleartypeNoBg:false,nowrap:0,fastOnEvent:0,randomizeEffects:1,rev:0,manualTrump:true,requeueOnImageNotLoaded:true,requeueTimeout:250,activePagerClass:"activeSlide",updateActivePagerLink:null,backwards:false};})(jQuery);
    11 /*
     10;(function($) {
     11
     12var ver = '2.9995';
     13
     14// if $.support is not defined (pre jQuery 1.3) add what I need
     15if ($.support == undefined) {
     16    $.support = {
     17        opacity: !($.browser.msie)
     18    };
     19}
     20
     21function debug(s) {
     22    $.fn.cycle.debug && log(s);
     23}       
     24function log() {
     25    window.console && console.log && console.log('[cycle] ' + Array.prototype.join.call(arguments,' '));
     26}
     27$.expr[':'].paused = function(el) {
     28    return el.cyclePause;
     29}
     30
     31
     32// the options arg can be...
     33//   a number  - indicates an immediate transition should occur to the given slide index
     34//   a string  - 'pause', 'resume', 'toggle', 'next', 'prev', 'stop', 'destroy' or the name of a transition effect (ie, 'fade', 'zoom', etc)
     35//   an object - properties to control the slideshow
     36//
     37// the arg2 arg can be...
     38//   the name of an fx (only used in conjunction with a numeric value for 'options')
     39//   the value true (only used in first arg == 'resume') and indicates
     40//   that the resume should occur immediately (not wait for next timeout)
     41
     42$.fn.cycle = function(options, arg2) {
     43    var o = { s: this.selector, c: this.context };
     44
     45    // in 1.3+ we can fix mistakes with the ready state
     46    if (this.length === 0 && options != 'stop') {
     47        if (!$.isReady && o.s) {
     48            log('DOM not ready, queuing slideshow');
     49            $(function() {
     50                $(o.s,o.c).cycle(options,arg2);
     51            });
     52            return this;
     53        }
     54        // is your DOM ready?  http://docs.jquery.com/Tutorials:Introducing_$(document).ready()
     55        log('terminating; zero elements found by selector' + ($.isReady ? '' : ' (DOM not ready)'));
     56        return this;
     57    }
     58
     59    // iterate the matched nodeset
     60    return this.each(function() {
     61        var opts = handleArguments(this, options, arg2);
     62        if (opts === false)
     63            return;
     64
     65        opts.updateActivePagerLink = opts.updateActivePagerLink || $.fn.cycle.updateActivePagerLink;
     66       
     67        // stop existing slideshow for this container (if there is one)
     68        if (this.cycleTimeout)
     69            clearTimeout(this.cycleTimeout);
     70        this.cycleTimeout = this.cyclePause = 0;
     71
     72        var $cont = $(this);
     73        var $slides = opts.slideExpr ? $(opts.slideExpr, this) : $cont.children();
     74        var els = $slides.get();
     75
     76        var opts2 = buildOptions($cont, $slides, els, opts, o);
     77        if (opts2 === false)
     78            return;
     79
     80        if (els.length < 2) {
     81            log('terminating; too few slides: ' + els.length);
     82            return;
     83        }
     84
     85        var startTime = opts2.continuous ? 10 : getTimeout(els[opts2.currSlide], els[opts2.nextSlide], opts2, !opts2.backwards);
     86
     87        // if it's an auto slideshow, kick it off
     88        if (startTime) {
     89            startTime += (opts2.delay || 0);
     90            if (startTime < 10)
     91                startTime = 10;
     92            debug('first timeout: ' + startTime);
     93            this.cycleTimeout = setTimeout(function(){go(els,opts2,0,!opts.backwards)}, startTime);
     94        }
     95    });
     96};
     97
     98function triggerPause(cont, byHover, onPager) {
     99    var opts = $(cont).data('cycle.opts');
     100    var paused = !!cont.cyclePause;
     101    if (paused && opts.paused)
     102        opts.paused(cont, opts, byHover, onPager);
     103    else if (!paused && opts.resumed)
     104        opts.resumed(cont, opts, byHover, onPager);
     105}
     106
     107// process the args that were passed to the plugin fn
     108function handleArguments(cont, options, arg2) {
     109    if (cont.cycleStop == undefined)
     110        cont.cycleStop = 0;
     111    if (options === undefined || options === null)
     112        options = {};
     113    if (options.constructor == String) {
     114        switch(options) {
     115        case 'destroy':
     116        case 'stop':
     117            var opts = $(cont).data('cycle.opts');
     118            if (!opts)
     119                return false;
     120            cont.cycleStop++; // callbacks look for change
     121            if (cont.cycleTimeout)
     122                clearTimeout(cont.cycleTimeout);
     123            cont.cycleTimeout = 0;
     124            opts.elements && $(opts.elements).stop();
     125            $(cont).removeData('cycle.opts');
     126            if (options == 'destroy')
     127                destroy(opts);
     128            return false;
     129        case 'toggle':
     130            cont.cyclePause = (cont.cyclePause === 1) ? 0 : 1;
     131            checkInstantResume(cont.cyclePause, arg2, cont);
     132            triggerPause(cont);
     133            return false;
     134        case 'pause':
     135            cont.cyclePause = 1;
     136            triggerPause(cont);
     137            return false;
     138        case 'resume':
     139            cont.cyclePause = 0;
     140            checkInstantResume(false, arg2, cont);
     141            triggerPause(cont);
     142            return false;
     143        case 'prev':
     144        case 'next':
     145            var opts = $(cont).data('cycle.opts');
     146            if (!opts) {
     147                log('options not found, "prev/next" ignored');
     148                return false;
     149            }
     150            $.fn.cycle[options](opts);
     151            return false;
     152        default:
     153            options = { fx: options };
     154        };
     155        return options;
     156    }
     157    else if (options.constructor == Number) {
     158        // go to the requested slide
     159        var num = options;
     160        options = $(cont).data('cycle.opts');
     161        if (!options) {
     162            log('options not found, can not advance slide');
     163            return false;
     164        }
     165        if (num < 0 || num >= options.elements.length) {
     166            log('invalid slide index: ' + num);
     167            return false;
     168        }
     169        options.nextSlide = num;
     170        if (cont.cycleTimeout) {
     171            clearTimeout(cont.cycleTimeout);
     172            cont.cycleTimeout = 0;
     173        }
     174        if (typeof arg2 == 'string')
     175            options.oneTimeFx = arg2;
     176        go(options.elements, options, 1, num >= options.currSlide);
     177        return false;
     178    }
     179    return options;
     180   
     181    function checkInstantResume(isPaused, arg2, cont) {
     182        if (!isPaused && arg2 === true) { // resume now!
     183            var options = $(cont).data('cycle.opts');
     184            if (!options) {
     185                log('options not found, can not resume');
     186                return false;
     187            }
     188            if (cont.cycleTimeout) {
     189                clearTimeout(cont.cycleTimeout);
     190                cont.cycleTimeout = 0;
     191            }
     192            go(options.elements, options, 1, !options.backwards);
     193        }
     194    }
     195};
     196
     197function removeFilter(el, opts) {
     198    if (!$.support.opacity && opts.cleartype && el.style.filter) {
     199        try { el.style.removeAttribute('filter'); }
     200        catch(smother) {} // handle old opera versions
     201    }
     202};
     203
     204// unbind event handlers
     205function destroy(opts) {
     206    if (opts.next)
     207        $(opts.next).unbind(opts.prevNextEvent);
     208    if (opts.prev)
     209        $(opts.prev).unbind(opts.prevNextEvent);
     210   
     211    if (opts.pager || opts.pagerAnchorBuilder)
     212        $.each(opts.pagerAnchors || [], function() {
     213            this.unbind().remove();
     214        });
     215    opts.pagerAnchors = null;
     216    if (opts.destroy) // callback
     217        opts.destroy(opts);
     218};
     219
     220// one-time initialization
     221function buildOptions($cont, $slides, els, options, o) {
     222    // support metadata plugin (v1.0 and v2.0)
     223    var opts = $.extend({}, $.fn.cycle.defaults, options || {}, $.metadata ? $cont.metadata() : $.meta ? $cont.data() : {});
     224    var meta = $.isFunction($cont.data) ? $cont.data(opts.metaAttr) : null;
     225    if (meta)
     226        opts = $.extend(opts, meta);
     227    if (opts.autostop)
     228        opts.countdown = opts.autostopCount || els.length;
     229
     230    var cont = $cont[0];
     231    $cont.data('cycle.opts', opts);
     232    opts.$cont = $cont;
     233    opts.stopCount = cont.cycleStop;
     234    opts.elements = els;
     235    opts.before = opts.before ? [opts.before] : [];
     236    opts.after = opts.after ? [opts.after] : [];
     237
     238    // push some after callbacks
     239    if (!$.support.opacity && opts.cleartype)
     240        opts.after.push(function() { removeFilter(this, opts); });
     241    if (opts.continuous)
     242        opts.after.push(function() { go(els,opts,0,!opts.backwards); });
     243
     244    saveOriginalOpts(opts);
     245
     246    // clearType corrections
     247    if (!$.support.opacity && opts.cleartype && !opts.cleartypeNoBg)
     248        clearTypeFix($slides);
     249
     250    // container requires non-static position so that slides can be position within
     251    if ($cont.css('position') == 'static')
     252        $cont.css('position', 'relative');
     253    if (opts.width)
     254        $cont.width(opts.width);
     255    if (opts.height && opts.height != 'auto')
     256        $cont.height(opts.height);
     257
     258    if (opts.startingSlide)
     259        opts.startingSlide = parseInt(opts.startingSlide,10);
     260    else if (opts.backwards)
     261        opts.startingSlide = els.length - 1;
     262
     263    // if random, mix up the slide array
     264    if (opts.random) {
     265        opts.randomMap = [];
     266        for (var i = 0; i < els.length; i++)
     267            opts.randomMap.push(i);
     268        opts.randomMap.sort(function(a,b) {return Math.random() - 0.5;});
     269        opts.randomIndex = 1;
     270        opts.startingSlide = opts.randomMap[1];
     271    }
     272    else if (opts.startingSlide >= els.length)
     273        opts.startingSlide = 0; // catch bogus input
     274    opts.currSlide = opts.startingSlide || 0;
     275    var first = opts.startingSlide;
     276
     277    // set position and zIndex on all the slides
     278    $slides.css({position: 'absolute', top:0, left:0}).hide().each(function(i) {
     279        var z;
     280        if (opts.backwards)
     281            z = first ? i <= first ? els.length + (i-first) : first-i : els.length-i;
     282        else
     283            z = first ? i >= first ? els.length - (i-first) : first-i : els.length-i;
     284        $(this).css('z-index', z)
     285    });
     286
     287    // make sure first slide is visible
     288    $(els[first]).css('opacity',1).show(); // opacity bit needed to handle restart use case
     289    removeFilter(els[first], opts);
     290
     291    // stretch slides
     292    if (opts.fit) {
     293        if (!opts.aspect) {
     294            if (opts.width)
     295                $slides.width(opts.width);
     296            if (opts.height && opts.height != 'auto')
     297                $slides.height(opts.height);
     298        } else {
     299            $slides.each(function(){
     300                var $slide = $(this);
     301                var ratio = (opts.aspect === true) ? $slide.width()/$slide.height() : opts.aspect;
     302                if( opts.width && $slide.width() != opts.width ) {
     303                    $slide.width( opts.width );
     304                    $slide.height( opts.width / ratio );
     305                }
     306
     307                if( opts.height && $slide.height() < opts.height ) {
     308                    $slide.height( opts.height );
     309                    $slide.width( opts.height * ratio );
     310                }
     311            });
     312        }
     313    }
     314
     315    if (opts.center && ((!opts.fit) || opts.aspect)) {
     316        $slides.each(function(){
     317            var $slide = $(this);
     318            $slide.css({
     319                "margin-left": opts.width ?
     320                    ((opts.width - $slide.width()) / 2) + "px" :
     321                    0,
     322                "margin-top": opts.height ?
     323                    ((opts.height - $slide.height()) / 2) + "px" :
     324                    0
     325            });
     326        });
     327    }
     328
     329    if (opts.center && !opts.fit && !opts.slideResize) {
     330        $slides.each(function(){
     331            var $slide = $(this);
     332            $slide.css({
     333                "margin-left": opts.width ? ((opts.width - $slide.width()) / 2) + "px" : 0,
     334                "margin-top": opts.height ? ((opts.height - $slide.height()) / 2) + "px" : 0
     335            });
     336        });
     337    }
     338       
     339    // stretch container
     340    var reshape = opts.containerResize && !$cont.innerHeight();
     341    if (reshape) { // do this only if container has no size http://tinyurl.com/da2oa9
     342        var maxw = 0, maxh = 0;
     343        for(var j=0; j < els.length; j++) {
     344            var $e = $(els[j]), e = $e[0], w = $e.outerWidth(), h = $e.outerHeight();
     345            if (!w) w = e.offsetWidth || e.width || $e.attr('width');
     346            if (!h) h = e.offsetHeight || e.height || $e.attr('height');
     347            maxw = w > maxw ? w : maxw;
     348            maxh = h > maxh ? h : maxh;
     349        }
     350        if (maxw > 0 && maxh > 0)
     351            $cont.css({width:maxw+'px',height:maxh+'px'});
     352    }
     353
     354    var pauseFlag = false;  // https://github.com/malsup/cycle/issues/44
     355    if (opts.pause)
     356        $cont.hover(
     357            function(){
     358                pauseFlag = true;
     359                this.cyclePause++;
     360                triggerPause(cont, true);
     361            },
     362            function(){
     363                pauseFlag && this.cyclePause--;
     364                triggerPause(cont, true);
     365            }
     366        );
     367
     368    if (supportMultiTransitions(opts) === false)
     369        return false;
     370
     371    // apparently a lot of people use image slideshows without height/width attributes on the images.
     372    // Cycle 2.50+ requires the sizing info for every slide; this block tries to deal with that.
     373    var requeue = false;
     374    options.requeueAttempts = options.requeueAttempts || 0;
     375    $slides.each(function() {
     376        // try to get height/width of each slide
     377        var $el = $(this);
     378        this.cycleH = (opts.fit && opts.height) ? opts.height : ($el.height() || this.offsetHeight || this.height || $el.attr('height') || 0);
     379        this.cycleW = (opts.fit && opts.width) ? opts.width : ($el.width() || this.offsetWidth || this.width || $el.attr('width') || 0);
     380
     381        if ( $el.is('img') ) {
     382            // sigh..  sniffing, hacking, shrugging...  this crappy hack tries to account for what browsers do when
     383            // an image is being downloaded and the markup did not include sizing info (height/width attributes);
     384            // there seems to be some "default" sizes used in this situation
     385            var loadingIE   = ($.browser.msie  && this.cycleW == 28 && this.cycleH == 30 && !this.complete);
     386            var loadingFF   = ($.browser.mozilla && this.cycleW == 34 && this.cycleH == 19 && !this.complete);
     387            var loadingOp   = ($.browser.opera && ((this.cycleW == 42 && this.cycleH == 19) || (this.cycleW == 37 && this.cycleH == 17)) && !this.complete);
     388            var loadingOther = (this.cycleH == 0 && this.cycleW == 0 && !this.complete);
     389            // don't requeue for images that are still loading but have a valid size
     390            if (loadingIE || loadingFF || loadingOp || loadingOther) {
     391                if (o.s && opts.requeueOnImageNotLoaded && ++options.requeueAttempts < 100) { // track retry count so we don't loop forever
     392                    log(options.requeueAttempts,' - img slide not loaded, requeuing slideshow: ', this.src, this.cycleW, this.cycleH);
     393                    setTimeout(function() {$(o.s,o.c).cycle(options)}, opts.requeueTimeout);
     394                    requeue = true;
     395                    return false; // break each loop
     396                }
     397                else {
     398                    log('could not determine size of image: '+this.src, this.cycleW, this.cycleH);
     399                }
     400            }
     401        }
     402        return true;
     403    });
     404
     405    if (requeue)
     406        return false;
     407
     408    opts.cssBefore = opts.cssBefore || {};
     409    opts.cssAfter = opts.cssAfter || {};
     410    opts.cssFirst = opts.cssFirst || {};
     411    opts.animIn = opts.animIn || {};
     412    opts.animOut = opts.animOut || {};
     413
     414    $slides.not(':eq('+first+')').css(opts.cssBefore);
     415    $($slides[first]).css(opts.cssFirst);
     416
     417    if (opts.timeout) {
     418        opts.timeout = parseInt(opts.timeout,10);
     419        // ensure that timeout and speed settings are sane
     420        if (opts.speed.constructor == String)
     421            opts.speed = $.fx.speeds[opts.speed] || parseInt(opts.speed,10);
     422        if (!opts.sync)
     423            opts.speed = opts.speed / 2;
     424       
     425        var buffer = opts.fx == 'none' ? 0 : opts.fx == 'shuffle' ? 500 : 250;
     426        while((opts.timeout - opts.speed) < buffer) // sanitize timeout
     427            opts.timeout += opts.speed;
     428    }
     429    if (opts.easing)
     430        opts.easeIn = opts.easeOut = opts.easing;
     431    if (!opts.speedIn)
     432        opts.speedIn = opts.speed;
     433    if (!opts.speedOut)
     434        opts.speedOut = opts.speed;
     435
     436    opts.slideCount = els.length;
     437    opts.currSlide = opts.lastSlide = first;
     438    if (opts.random) {
     439        if (++opts.randomIndex == els.length)
     440            opts.randomIndex = 0;
     441        opts.nextSlide = opts.randomMap[opts.randomIndex];
     442    }
     443    else if (opts.backwards)
     444        opts.nextSlide = opts.startingSlide == 0 ? (els.length-1) : opts.startingSlide-1;
     445    else
     446        opts.nextSlide = opts.startingSlide >= (els.length-1) ? 0 : opts.startingSlide+1;
     447
     448    // run transition init fn
     449    if (!opts.multiFx) {
     450        var init = $.fn.cycle.transitions[opts.fx];
     451        if ($.isFunction(init))
     452            init($cont, $slides, opts);
     453        else if (opts.fx != 'custom' && !opts.multiFx) {
     454            log('unknown transition: ' + opts.fx,'; slideshow terminating');
     455            return false;
     456        }
     457    }
     458
     459    // fire artificial events
     460    var e0 = $slides[first];
     461    if (!opts.skipInitializationCallbacks) {
     462        if (opts.before.length)
     463            opts.before[0].apply(e0, [e0, e0, opts, true]);
     464        if (opts.after.length)
     465            opts.after[0].apply(e0, [e0, e0, opts, true]);
     466    }
     467    if (opts.next)
     468        $(opts.next).bind(opts.prevNextEvent,function(){return advance(opts,1)});
     469    if (opts.prev)
     470        $(opts.prev).bind(opts.prevNextEvent,function(){return advance(opts,0)});
     471    if (opts.pager || opts.pagerAnchorBuilder)
     472        buildPager(els,opts);
     473
     474    exposeAddSlide(opts, els);
     475
     476    return opts;
     477};
     478
     479// save off original opts so we can restore after clearing state
     480function saveOriginalOpts(opts) {
     481    opts.original = { before: [], after: [] };
     482    opts.original.cssBefore = $.extend({}, opts.cssBefore);
     483    opts.original.cssAfter  = $.extend({}, opts.cssAfter);
     484    opts.original.animIn    = $.extend({}, opts.animIn);
     485    opts.original.animOut   = $.extend({}, opts.animOut);
     486    $.each(opts.before, function() { opts.original.before.push(this); });
     487    $.each(opts.after,  function() { opts.original.after.push(this); });
     488};
     489
     490function supportMultiTransitions(opts) {
     491    var i, tx, txs = $.fn.cycle.transitions;
     492    // look for multiple effects
     493    if (opts.fx.indexOf(',') > 0) {
     494        opts.multiFx = true;
     495        opts.fxs = opts.fx.replace(/\s*/g,'').split(',');
     496        // discard any bogus effect names
     497        for (i=0; i < opts.fxs.length; i++) {
     498            var fx = opts.fxs[i];
     499            tx = txs[fx];
     500            if (!tx || !txs.hasOwnProperty(fx) || !$.isFunction(tx)) {
     501                log('discarding unknown transition: ',fx);
     502                opts.fxs.splice(i,1);
     503                i--;
     504            }
     505        }
     506        // if we have an empty list then we threw everything away!
     507        if (!opts.fxs.length) {
     508            log('No valid transitions named; slideshow terminating.');
     509            return false;
     510        }
     511    }
     512    else if (opts.fx == 'all') {  // auto-gen the list of transitions
     513        opts.multiFx = true;
     514        opts.fxs = [];
     515        for (p in txs) {
     516            tx = txs[p];
     517            if (txs.hasOwnProperty(p) && $.isFunction(tx))
     518                opts.fxs.push(p);
     519        }
     520    }
     521    if (opts.multiFx && opts.randomizeEffects) {
     522        // munge the fxs array to make effect selection random
     523        var r1 = Math.floor(Math.random() * 20) + 30;
     524        for (i = 0; i < r1; i++) {
     525            var r2 = Math.floor(Math.random() * opts.fxs.length);
     526            opts.fxs.push(opts.fxs.splice(r2,1)[0]);
     527        }
     528        debug('randomized fx sequence: ',opts.fxs);
     529    }
     530    return true;
     531};
     532
     533// provide a mechanism for adding slides after the slideshow has started
     534function exposeAddSlide(opts, els) {
     535    opts.addSlide = function(newSlide, prepend) {
     536        var $s = $(newSlide), s = $s[0];
     537        if (!opts.autostopCount)
     538            opts.countdown++;
     539        els[prepend?'unshift':'push'](s);
     540        if (opts.els)
     541            opts.els[prepend?'unshift':'push'](s); // shuffle needs this
     542        opts.slideCount = els.length;
     543
     544        $s.css('position','absolute');
     545        $s[prepend?'prependTo':'appendTo'](opts.$cont);
     546
     547        if (prepend) {
     548            opts.currSlide++;
     549            opts.nextSlide++;
     550        }
     551
     552        if (!$.support.opacity && opts.cleartype && !opts.cleartypeNoBg)
     553            clearTypeFix($s);
     554
     555        if (opts.fit && opts.width)
     556            $s.width(opts.width);
     557        if (opts.fit && opts.height && opts.height != 'auto')
     558            $s.height(opts.height);
     559        s.cycleH = (opts.fit && opts.height) ? opts.height : $s.height();
     560        s.cycleW = (opts.fit && opts.width) ? opts.width : $s.width();
     561
     562        $s.css(opts.cssBefore);
     563
     564        if (opts.pager || opts.pagerAnchorBuilder)
     565            $.fn.cycle.createPagerAnchor(els.length-1, s, $(opts.pager), els, opts);
     566
     567        if ($.isFunction(opts.onAddSlide))
     568            opts.onAddSlide($s);
     569        else
     570            $s.hide(); // default behavior
     571    };
     572}
     573
     574// reset internal state; we do this on every pass in order to support multiple effects
     575$.fn.cycle.resetState = function(opts, fx) {
     576    fx = fx || opts.fx;
     577    opts.before = []; opts.after = [];
     578    opts.cssBefore = $.extend({}, opts.original.cssBefore);
     579    opts.cssAfter  = $.extend({}, opts.original.cssAfter);
     580    opts.animIn = $.extend({}, opts.original.animIn);
     581    opts.animOut   = $.extend({}, opts.original.animOut);
     582    opts.fxFn = null;
     583    $.each(opts.original.before, function() { opts.before.push(this); });
     584    $.each(opts.original.after,  function() { opts.after.push(this); });
     585
     586    // re-init
     587    var init = $.fn.cycle.transitions[fx];
     588    if ($.isFunction(init))
     589        init(opts.$cont, $(opts.elements), opts);
     590};
     591
     592// this is the main engine fn, it handles the timeouts, callbacks and slide index mgmt
     593function go(els, opts, manual, fwd) {
     594    // opts.busy is true if we're in the middle of an animation
     595    if (manual && opts.busy && opts.manualTrump) {
     596        // let manual transitions requests trump active ones
     597        debug('manualTrump in go(), stopping active transition');
     598        $(els).stop(true,true);
     599        opts.busy = 0;
     600    }
     601    // don't begin another timeout-based transition if there is one active
     602    if (opts.busy) {
     603        debug('transition active, ignoring new tx request');
     604        return;
     605    }
     606
     607    var p = opts.$cont[0], curr = els[opts.currSlide], next = els[opts.nextSlide];
     608
     609    // stop cycling if we have an outstanding stop request
     610    if (p.cycleStop != opts.stopCount || p.cycleTimeout === 0 && !manual)
     611        return;
     612
     613    // check to see if we should stop cycling based on autostop options
     614    if (!manual && !p.cyclePause && !opts.bounce &&
     615        ((opts.autostop && (--opts.countdown <= 0)) ||
     616        (opts.nowrap && !opts.random && opts.nextSlide < opts.currSlide))) {
     617        if (opts.end)
     618            opts.end(opts);
     619        return;
     620    }
     621
     622    // if slideshow is paused, only transition on a manual trigger
     623    var changed = false;
     624    if ((manual || !p.cyclePause) && (opts.nextSlide != opts.currSlide)) {
     625        changed = true;
     626        var fx = opts.fx;
     627        // keep trying to get the slide size if we don't have it yet
     628        curr.cycleH = curr.cycleH || $(curr).height();
     629        curr.cycleW = curr.cycleW || $(curr).width();
     630        next.cycleH = next.cycleH || $(next).height();
     631        next.cycleW = next.cycleW || $(next).width();
     632
     633        // support multiple transition types
     634        if (opts.multiFx) {
     635            if (fwd && (opts.lastFx == undefined || ++opts.lastFx >= opts.fxs.length))
     636                opts.lastFx = 0;
     637            else if (!fwd && (opts.lastFx == undefined || --opts.lastFx < 0))
     638                opts.lastFx = opts.fxs.length - 1;
     639            fx = opts.fxs[opts.lastFx];
     640        }
     641
     642        // one-time fx overrides apply to:  $('div').cycle(3,'zoom');
     643        if (opts.oneTimeFx) {
     644            fx = opts.oneTimeFx;
     645            opts.oneTimeFx = null;
     646        }
     647
     648        $.fn.cycle.resetState(opts, fx);
     649
     650        // run the before callbacks
     651        if (opts.before.length)
     652            $.each(opts.before, function(i,o) {
     653                if (p.cycleStop != opts.stopCount) return;
     654                o.apply(next, [curr, next, opts, fwd]);
     655            });
     656
     657        // stage the after callacks
     658        var after = function() {
     659            opts.busy = 0;
     660            $.each(opts.after, function(i,o) {
     661                if (p.cycleStop != opts.stopCount) return;
     662                o.apply(next, [curr, next, opts, fwd]);
     663            });
     664        };
     665
     666        debug('tx firing('+fx+'); currSlide: ' + opts.currSlide + '; nextSlide: ' + opts.nextSlide);
     667       
     668        // get ready to perform the transition
     669        opts.busy = 1;
     670        if (opts.fxFn) // fx function provided?
     671            opts.fxFn(curr, next, opts, after, fwd, manual && opts.fastOnEvent);
     672        else if ($.isFunction($.fn.cycle[opts.fx])) // fx plugin ?
     673            $.fn.cycle[opts.fx](curr, next, opts, after, fwd, manual && opts.fastOnEvent);
     674        else
     675            $.fn.cycle.custom(curr, next, opts, after, fwd, manual && opts.fastOnEvent);
     676    }
     677
     678    if (changed || opts.nextSlide == opts.currSlide) {
     679        // calculate the next slide
     680        opts.lastSlide = opts.currSlide;
     681        if (opts.random) {
     682            opts.currSlide = opts.nextSlide;
     683            if (++opts.randomIndex == els.length)
     684                opts.randomIndex = 0;
     685            opts.nextSlide = opts.randomMap[opts.randomIndex];
     686            if (opts.nextSlide == opts.currSlide)
     687                opts.nextSlide = (opts.currSlide == opts.slideCount - 1) ? 0 : opts.currSlide + 1;
     688        }
     689        else if (opts.backwards) {
     690            var roll = (opts.nextSlide - 1) < 0;
     691            if (roll && opts.bounce) {
     692                opts.backwards = !opts.backwards;
     693                opts.nextSlide = 1;
     694                opts.currSlide = 0;
     695            }
     696            else {
     697                opts.nextSlide = roll ? (els.length-1) : opts.nextSlide-1;
     698                opts.currSlide = roll ? 0 : opts.nextSlide+1;
     699            }
     700        }
     701        else { // sequence
     702            var roll = (opts.nextSlide + 1) == els.length;
     703            if (roll && opts.bounce) {
     704                opts.backwards = !opts.backwards;
     705                opts.nextSlide = els.length-2;
     706                opts.currSlide = els.length-1;
     707            }
     708            else {
     709                opts.nextSlide = roll ? 0 : opts.nextSlide+1;
     710                opts.currSlide = roll ? els.length-1 : opts.nextSlide-1;
     711            }
     712        }
     713    }
     714    if (changed && opts.pager)
     715        opts.updateActivePagerLink(opts.pager, opts.currSlide, opts.activePagerClass);
     716   
     717    // stage the next transition
     718    var ms = 0;
     719    if (opts.timeout && !opts.continuous)
     720        ms = getTimeout(els[opts.currSlide], els[opts.nextSlide], opts, fwd);
     721    else if (opts.continuous && p.cyclePause) // continuous shows work off an after callback, not this timer logic
     722        ms = 10;
     723    if (ms > 0)
     724        p.cycleTimeout = setTimeout(function(){ go(els, opts, 0, !opts.backwards) }, ms);
     725};
     726
     727// invoked after transition
     728$.fn.cycle.updateActivePagerLink = function(pager, currSlide, clsName) {
     729   $(pager).each(function() {
     730       $(this).children().removeClass(clsName).eq(currSlide).addClass(clsName);
     731   });
     732};
     733
     734// calculate timeout value for current transition
     735function getTimeout(curr, next, opts, fwd) {
     736    if (opts.timeoutFn) {
     737        // call user provided calc fn
     738        var t = opts.timeoutFn.call(curr,curr,next,opts,fwd);
     739        while (opts.fx != 'none' && (t - opts.speed) < 250) // sanitize timeout
     740            t += opts.speed;
     741        debug('calculated timeout: ' + t + '; speed: ' + opts.speed);
     742        if (t !== false)
     743            return t;
     744    }
     745    return opts.timeout;
     746};
     747
     748// expose next/prev function, caller must pass in state
     749$.fn.cycle.next = function(opts) { advance(opts,1); };
     750$.fn.cycle.prev = function(opts) { advance(opts,0);};
     751
     752// advance slide forward or back
     753function advance(opts, moveForward) {
     754    var val = moveForward ? 1 : -1;
     755    var els = opts.elements;
     756    var p = opts.$cont[0], timeout = p.cycleTimeout;
     757    if (timeout) {
     758        clearTimeout(timeout);
     759        p.cycleTimeout = 0;
     760    }
     761    if (opts.random && val < 0) {
     762        // move back to the previously display slide
     763        opts.randomIndex--;
     764        if (--opts.randomIndex == -2)
     765            opts.randomIndex = els.length-2;
     766        else if (opts.randomIndex == -1)
     767            opts.randomIndex = els.length-1;
     768        opts.nextSlide = opts.randomMap[opts.randomIndex];
     769    }
     770    else if (opts.random) {
     771        opts.nextSlide = opts.randomMap[opts.randomIndex];
     772    }
     773    else {
     774        opts.nextSlide = opts.currSlide + val;
     775        if (opts.nextSlide < 0) {
     776            if (opts.nowrap) return false;
     777            opts.nextSlide = els.length - 1;
     778        }
     779        else if (opts.nextSlide >= els.length) {
     780            if (opts.nowrap) return false;
     781            opts.nextSlide = 0;
     782        }
     783    }
     784
     785    var cb = opts.onPrevNextEvent || opts.prevNextClick; // prevNextClick is deprecated
     786    if ($.isFunction(cb))
     787        cb(val > 0, opts.nextSlide, els[opts.nextSlide]);
     788    go(els, opts, 1, moveForward);
     789    return false;
     790};
     791
     792function buildPager(els, opts) {
     793    var $p = $(opts.pager);
     794    $.each(els, function(i,o) {
     795        $.fn.cycle.createPagerAnchor(i,o,$p,els,opts);
     796    });
     797    opts.updateActivePagerLink(opts.pager, opts.startingSlide, opts.activePagerClass);
     798};
     799
     800$.fn.cycle.createPagerAnchor = function(i, el, $p, els, opts) {
     801    var a;
     802    if ($.isFunction(opts.pagerAnchorBuilder)) {
     803        a = opts.pagerAnchorBuilder(i,el);
     804        debug('pagerAnchorBuilder('+i+', el) returned: ' + a);
     805    }
     806    else
     807        a = '<a href="#">'+(i+1)+'</a>';
     808       
     809    if (!a)
     810        return;
     811    var $a = $(a);
     812    // don't reparent if anchor is in the dom
     813    if ($a.parents('body').length === 0) {
     814        var arr = [];
     815        if ($p.length > 1) {
     816            $p.each(function() {
     817                var $clone = $a.clone(true);
     818                $(this).append($clone);
     819                arr.push($clone[0]);
     820            });
     821            $a = $(arr);
     822        }
     823        else {
     824            $a.appendTo($p);
     825        }
     826    }
     827
     828    opts.pagerAnchors =  opts.pagerAnchors || [];
     829    opts.pagerAnchors.push($a);
     830   
     831    var pagerFn = function(e) {
     832        e.preventDefault();
     833        opts.nextSlide = i;
     834        var p = opts.$cont[0], timeout = p.cycleTimeout;
     835        if (timeout) {
     836            clearTimeout(timeout);
     837            p.cycleTimeout = 0;
     838        }
     839        var cb = opts.onPagerEvent || opts.pagerClick; // pagerClick is deprecated
     840        if ($.isFunction(cb))
     841            cb(opts.nextSlide, els[opts.nextSlide]);
     842        go(els,opts,1,opts.currSlide < i); // trigger the trans
     843//      return false; // <== allow bubble
     844    }
     845   
     846    if ( /mouseenter|mouseover/i.test(opts.pagerEvent) ) {
     847        $a.hover(pagerFn, function(){/* no-op */} );
     848    }
     849    else {
     850        $a.bind(opts.pagerEvent, pagerFn);
     851    }
     852   
     853    if ( ! /^click/.test(opts.pagerEvent) && !opts.allowPagerClickBubble)
     854        $a.bind('click.cycle', function(){return false;}); // suppress click
     855   
     856    var cont = opts.$cont[0];
     857    var pauseFlag = false; // https://github.com/malsup/cycle/issues/44
     858    if (opts.pauseOnPagerHover) {
     859        $a.hover(
     860            function() {
     861                pauseFlag = true;
     862                cont.cyclePause++;
     863                triggerPause(cont,true,true);
     864            }, function() {
     865                pauseFlag && cont.cyclePause--;
     866                triggerPause(cont,true,true);
     867            }
     868        );
     869    }
     870};
     871
     872// helper fn to calculate the number of slides between the current and the next
     873$.fn.cycle.hopsFromLast = function(opts, fwd) {
     874    var hops, l = opts.lastSlide, c = opts.currSlide;
     875    if (fwd)
     876        hops = c > l ? c - l : opts.slideCount - l;
     877    else
     878        hops = c < l ? l - c : l + opts.slideCount - c;
     879    return hops;
     880};
     881
     882// fix clearType problems in ie6 by setting an explicit bg color
     883// (otherwise text slides look horrible during a fade transition)
     884function clearTypeFix($slides) {
     885    debug('applying clearType background-color hack');
     886    function hex(s) {
     887        s = parseInt(s,10).toString(16);
     888        return s.length < 2 ? '0'+s : s;
     889    };
     890    function getBg(e) {
     891        for ( ; e && e.nodeName.toLowerCase() != 'html'; e = e.parentNode) {
     892            var v = $.css(e,'background-color');
     893            if (v && v.indexOf('rgb') >= 0 ) {
     894                var rgb = v.match(/\d+/g);
     895                return '#'+ hex(rgb[0]) + hex(rgb[1]) + hex(rgb[2]);
     896            }
     897            if (v && v != 'transparent')
     898                return v;
     899        }
     900        return '#ffffff';
     901    };
     902    $slides.each(function() { $(this).css('background-color', getBg(this)); });
     903};
     904
     905// reset common props before the next transition
     906$.fn.cycle.commonReset = function(curr,next,opts,w,h,rev) {
     907    $(opts.elements).not(curr).hide();
     908    if (typeof opts.cssBefore.opacity == 'undefined')
     909        opts.cssBefore.opacity = 1;
     910    opts.cssBefore.display = 'block';
     911    if (opts.slideResize && w !== false && next.cycleW > 0)
     912        opts.cssBefore.width = next.cycleW;
     913    if (opts.slideResize && h !== false && next.cycleH > 0)
     914        opts.cssBefore.height = next.cycleH;
     915    opts.cssAfter = opts.cssAfter || {};
     916    opts.cssAfter.display = 'none';
     917    $(curr).css('zIndex',opts.slideCount + (rev === true ? 1 : 0));
     918    $(next).css('zIndex',opts.slideCount + (rev === true ? 0 : 1));
     919};
     920
     921// the actual fn for effecting a transition
     922$.fn.cycle.custom = function(curr, next, opts, cb, fwd, speedOverride) {
     923    var $l = $(curr), $n = $(next);
     924    var speedIn = opts.speedIn, speedOut = opts.speedOut, easeIn = opts.easeIn, easeOut = opts.easeOut;
     925    $n.css(opts.cssBefore);
     926    if (speedOverride) {
     927        if (typeof speedOverride == 'number')
     928            speedIn = speedOut = speedOverride;
     929        else
     930            speedIn = speedOut = 1;
     931        easeIn = easeOut = null;
     932    }
     933    var fn = function() {
     934        $n.animate(opts.animIn, speedIn, easeIn, function() {
     935            cb();
     936        });
     937    };
     938    $l.animate(opts.animOut, speedOut, easeOut, function() {
     939        $l.css(opts.cssAfter);
     940        if (!opts.sync)
     941            fn();
     942    });
     943    if (opts.sync) fn();
     944};
     945
     946// transition definitions - only fade is defined here, transition pack defines the rest
     947$.fn.cycle.transitions = {
     948    fade: function($cont, $slides, opts) {
     949        $slides.not(':eq('+opts.currSlide+')').css('opacity',0);
     950        opts.before.push(function(curr,next,opts) {
     951            $.fn.cycle.commonReset(curr,next,opts);
     952            opts.cssBefore.opacity = 0;
     953        });
     954        opts.animIn    = { opacity: 1 };
     955        opts.animOut   = { opacity: 0 };
     956        opts.cssBefore = { top: 0, left: 0 };
     957    }
     958};
     959
     960$.fn.cycle.ver = function() { return ver; };
     961
     962// override these globally if you like (they are all optional)
     963$.fn.cycle.defaults = {
     964    activePagerClass: 'activeSlide', // class name used for the active pager link
     965    after:         null,  // transition callback (scope set to element that was shown):  function(currSlideElement, nextSlideElement, options, forwardFlag)
     966    allowPagerClickBubble: false, // allows or prevents click event on pager anchors from bubbling
     967    animIn:        null,  // properties that define how the slide animates in
     968    animOut:       null,  // properties that define how the slide animates out
     969    aspect:        false,  // preserve aspect ratio during fit resizing, cropping if necessary (must be used with fit option)
     970    autostop:      0,     // true to end slideshow after X transitions (where X == slide count)
     971    autostopCount: 0,     // number of transitions (optionally used with autostop to define X)
     972    backwards:     false, // true to start slideshow at last slide and move backwards through the stack
     973    before:        null,  // transition callback (scope set to element to be shown):     function(currSlideElement, nextSlideElement, options, forwardFlag)
     974    center:        null,  // set to true to have cycle add top/left margin to each slide (use with width and height options)
     975    cleartype:     !$.support.opacity,  // true if clearType corrections should be applied (for IE)
     976    cleartypeNoBg: false, // set to true to disable extra cleartype fixing (leave false to force background color setting on slides)
     977    containerResize: 1,   // resize container to fit largest slide
     978    continuous:    0,     // true to start next transition immediately after current one completes
     979    cssAfter:      null,  // properties that defined the state of the slide after transitioning out
     980    cssBefore:     null,  // properties that define the initial state of the slide before transitioning in
     981    delay:         0,     // additional delay (in ms) for first transition (hint: can be negative)
     982    easeIn:        null,  // easing for "in" transition
     983    easeOut:       null,  // easing for "out" transition
     984    easing:        null,  // easing method for both in and out transitions
     985    end:           null,  // callback invoked when the slideshow terminates (use with autostop or nowrap options): function(options)
     986    fastOnEvent:   0,     // force fast transitions when triggered manually (via pager or prev/next); value == time in ms
     987    fit:           0,     // force slides to fit container
     988    fx:           'fade', // name of transition effect (or comma separated names, ex: 'fade,scrollUp,shuffle')
     989    fxFn:          null,  // function used to control the transition: function(currSlideElement, nextSlideElement, options, afterCalback, forwardFlag)
     990    height:       'auto', // container height (if the 'fit' option is true, the slides will be set to this height as well)
     991    manualTrump:   true,  // causes manual transition to stop an active transition instead of being ignored
     992    metaAttr:     'cycle',// data- attribute that holds the option data for the slideshow
     993    next:          null,  // element, jQuery object, or jQuery selector string for the element to use as event trigger for next slide
     994    nowrap:        0,     // true to prevent slideshow from wrapping
     995    onPagerEvent:  null,  // callback fn for pager events: function(zeroBasedSlideIndex, slideElement)
     996    onPrevNextEvent: null,// callback fn for prev/next events: function(isNext, zeroBasedSlideIndex, slideElement)
     997    pager:         null,  // element, jQuery object, or jQuery selector string for the element to use as pager container
     998    pagerAnchorBuilder: null, // callback fn for building anchor links:  function(index, DOMelement)
     999    pagerEvent:   'click.cycle', // name of event which drives the pager navigation
     1000    pause:         0,     // true to enable "pause on hover"
     1001    pauseOnPagerHover: 0, // true to pause when hovering over pager link
     1002    prev:          null,  // element, jQuery object, or jQuery selector string for the element to use as event trigger for previous slide
     1003    prevNextEvent:'click.cycle',// event which drives the manual transition to the previous or next slide
     1004    random:        0,     // true for random, false for sequence (not applicable to shuffle fx)
     1005    randomizeEffects: 1,  // valid when multiple effects are used; true to make the effect sequence random
     1006    requeueOnImageNotLoaded: true, // requeue the slideshow if any image slides are not yet loaded
     1007    requeueTimeout: 250,  // ms delay for requeue
     1008    rev:           0,     // causes animations to transition in reverse (for effects that support it such as scrollHorz/scrollVert/shuffle)
     1009    shuffle:       null,  // coords for shuffle animation, ex: { top:15, left: 200 }
     1010    skipInitializationCallbacks: false, // set to true to disable the first before/after callback that occurs prior to any transition
     1011    slideExpr:     null,  // expression for selecting slides (if something other than all children is required)
     1012    slideResize:   1,     // force slide width/height to fixed size before every transition
     1013    speed:         1000,  // speed of the transition (any valid fx speed value)
     1014    speedIn:       null,  // speed of the 'in' transition
     1015    speedOut:      null,  // speed of the 'out' transition
     1016    startingSlide: 0,     // zero-based index of the first slide to be displayed
     1017    sync:          1,     // true if in/out transitions should occur simultaneously
     1018    timeout:       4000,  // milliseconds between slide transitions (0 to disable auto advance)
     1019    timeoutFn:     null,  // callback for determining per-slide timeout value:  function(currSlideElement, nextSlideElement, options, forwardFlag)
     1020    updateActivePagerLink: null, // callback fn invoked to update the active pager link (adds/removes activePagerClass style)
     1021    width:         null   // container width (if the 'fit' option is true, the slides will be set to this width as well)
     1022};
     1023
     1024})(jQuery);
     1025
     1026
     1027/*!
    121028 * jQuery Cycle Plugin Transition Definitions
    131029 * This script is a plugin for the jQuery Cycle Plugin
     
    191035 * http://www.gnu.org/licenses/gpl.html
    201036 */
    21 (function($){$.fn.cycle.transitions.none=function($cont,$slides,opts){opts.fxFn=function(curr,next,opts,after){$(next).show();$(curr).hide();after();};};$.fn.cycle.transitions.fadeout=function($cont,$slides,opts){$slides.not(":eq("+opts.currSlide+")").css({display:"block",opacity:1});opts.before.push(function(curr,next,opts,w,h,rev){$(curr).css("zIndex",opts.slideCount+(!rev===true?1:0));$(next).css("zIndex",opts.slideCount+(!rev===true?0:1));});opts.animIn={opacity:1};opts.animOut={opacity:0};opts.cssBefore={opacity:1,display:"block"};opts.cssAfter={zIndex:0};};$.fn.cycle.transitions.scrollUp=function($cont,$slides,opts){$cont.css("overflow","hidden");opts.before.push($.fn.cycle.commonReset);var h=$cont.height();opts.cssBefore={top:h,left:0};opts.cssFirst={top:0};opts.animIn={top:0};opts.animOut={top:-h};};$.fn.cycle.transitions.scrollDown=function($cont,$slides,opts){$cont.css("overflow","hidden");opts.before.push($.fn.cycle.commonReset);var h=$cont.height();opts.cssFirst={top:0};opts.cssBefore={top:-h,left:0};opts.animIn={top:0};opts.animOut={top:h};};$.fn.cycle.transitions.scrollLeft=function($cont,$slides,opts){$cont.css("overflow","hidden");opts.before.push($.fn.cycle.commonReset);var w=$cont.width();opts.cssFirst={left:0};opts.cssBefore={left:w,top:0};opts.animIn={left:0};opts.animOut={left:0-w};};$.fn.cycle.transitions.scrollRight=function($cont,$slides,opts){$cont.css("overflow","hidden");opts.before.push($.fn.cycle.commonReset);var w=$cont.width();opts.cssFirst={left:0};opts.cssBefore={left:-w,top:0};opts.animIn={left:0};opts.animOut={left:w};};$.fn.cycle.transitions.scrollHorz=function($cont,$slides,opts){$cont.css("overflow","hidden").width();opts.before.push(function(curr,next,opts,fwd){if(opts.rev){fwd=!fwd;}$.fn.cycle.commonReset(curr,next,opts);opts.cssBefore.left=fwd?(next.cycleW-1):(1-next.cycleW);opts.animOut.left=fwd?-curr.cycleW:curr.cycleW;});opts.cssFirst={left:0};opts.cssBefore={top:0};opts.animIn={left:0};opts.animOut={top:0};};$.fn.cycle.transitions.scrollVert=function($cont,$slides,opts){$cont.css("overflow","hidden");opts.before.push(function(curr,next,opts,fwd){if(opts.rev){fwd=!fwd;}$.fn.cycle.commonReset(curr,next,opts);opts.cssBefore.top=fwd?(1-next.cycleH):(next.cycleH-1);opts.animOut.top=fwd?curr.cycleH:-curr.cycleH;});opts.cssFirst={top:0};opts.cssBefore={left:0};opts.animIn={top:0};opts.animOut={left:0};};$.fn.cycle.transitions.slideX=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$(opts.elements).not(curr).hide();$.fn.cycle.commonReset(curr,next,opts,false,true);opts.animIn.width=next.cycleW;});opts.cssBefore={left:0,top:0,width:0};opts.animIn={width:"show"};opts.animOut={width:0};};$.fn.cycle.transitions.slideY=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$(opts.elements).not(curr).hide();$.fn.cycle.commonReset(curr,next,opts,true,false);opts.animIn.height=next.cycleH;});opts.cssBefore={left:0,top:0,height:0};opts.animIn={height:"show"};opts.animOut={height:0};};$.fn.cycle.transitions.shuffle=function($cont,$slides,opts){var i,w=$cont.css("overflow","visible").width();$slides.css({left:0,top:0});opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,true,true,true);});if(!opts.speedAdjusted){opts.speed=opts.speed/2;opts.speedAdjusted=true;}opts.random=0;opts.shuffle=opts.shuffle||{left:-w,top:15};opts.els=[];for(i=0;i<$slides.length;i++){opts.els.push($slides[i]);}for(i=0;i<opts.currSlide;i++){opts.els.push(opts.els.shift());}opts.fxFn=function(curr,next,opts,cb,fwd){if(opts.rev){fwd=!fwd;}var $el=fwd?$(curr):$(next);$(next).css(opts.cssBefore);var count=opts.slideCount;$el.animate(opts.shuffle,opts.speedIn,opts.easeIn,function(){var hops=$.fn.cycle.hopsFromLast(opts,fwd);for(var k=0;k<hops;k++){fwd?opts.els.push(opts.els.shift()):opts.els.unshift(opts.els.pop());}if(fwd){for(var i=0,len=opts.els.length;i<len;i++){$(opts.els[i]).css("z-index",len-i+count);}}else{var z=$(curr).css("z-index");$el.css("z-index",parseInt(z)+1+count);}$el.animate({left:0,top:0},opts.speedOut,opts.easeOut,function(){$(fwd?this:curr).hide();if(cb){cb();}});});};opts.cssBefore={display:"block",opacity:1,top:0,left:0};};$.fn.cycle.transitions.turnUp=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,true,false);opts.cssBefore.top=next.cycleH;opts.animIn.height=next.cycleH;opts.animOut.width=next.cycleW;});opts.cssFirst={top:0};opts.cssBefore={left:0,height:0};opts.animIn={top:0};opts.animOut={height:0};};$.fn.cycle.transitions.turnDown=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,true,false);opts.animIn.height=next.cycleH;opts.animOut.top=curr.cycleH;});opts.cssFirst={top:0};opts.cssBefore={left:0,top:0,height:0};opts.animOut={height:0};};$.fn.cycle.transitions.turnLeft=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,false,true);opts.cssBefore.left=next.cycleW;opts.animIn.width=next.cycleW;});opts.cssBefore={top:0,width:0};opts.animIn={left:0};opts.animOut={width:0};};$.fn.cycle.transitions.turnRight=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,false,true);opts.animIn.width=next.cycleW;opts.animOut.left=curr.cycleW;});opts.cssBefore={top:0,left:0,width:0};opts.animIn={left:0};opts.animOut={width:0};};$.fn.cycle.transitions.zoom=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,false,false,true);opts.cssBefore.top=next.cycleH/2;opts.cssBefore.left=next.cycleW/2;opts.animIn={top:0,left:0,width:next.cycleW,height:next.cycleH};opts.animOut={width:0,height:0,top:curr.cycleH/2,left:curr.cycleW/2};});opts.cssFirst={top:0,left:0};opts.cssBefore={width:0,height:0};};$.fn.cycle.transitions.fadeZoom=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,false,false);opts.cssBefore.left=next.cycleW/2;opts.cssBefore.top=next.cycleH/2;opts.animIn={top:0,left:0,width:next.cycleW,height:next.cycleH};});opts.cssBefore={width:0,height:0};opts.animOut={opacity:0};};$.fn.cycle.transitions.blindX=function($cont,$slides,opts){var w=$cont.css("overflow","hidden").width();opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts);opts.animIn.width=next.cycleW;opts.animOut.left=curr.cycleW;});opts.cssBefore={left:w,top:0};opts.animIn={left:0};opts.animOut={left:w};};$.fn.cycle.transitions.blindY=function($cont,$slides,opts){var h=$cont.css("overflow","hidden").height();opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts);opts.animIn.height=next.cycleH;opts.animOut.top=curr.cycleH;});opts.cssBefore={top:h,left:0};opts.animIn={top:0};opts.animOut={top:h};};$.fn.cycle.transitions.blindZ=function($cont,$slides,opts){var h=$cont.css("overflow","hidden").height();var w=$cont.width();opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts);opts.animIn.height=next.cycleH;opts.animOut.top=curr.cycleH;});opts.cssBefore={top:h,left:w};opts.animIn={top:0,left:0};opts.animOut={top:h,left:w};};$.fn.cycle.transitions.growX=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,false,true);opts.cssBefore.left=this.cycleW/2;opts.animIn={left:0,width:this.cycleW};opts.animOut={left:0};});opts.cssBefore={width:0,top:0};};$.fn.cycle.transitions.growY=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,true,false);opts.cssBefore.top=this.cycleH/2;opts.animIn={top:0,height:this.cycleH};opts.animOut={top:0};});opts.cssBefore={height:0,left:0};};$.fn.cycle.transitions.curtainX=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,false,true,true);opts.cssBefore.left=next.cycleW/2;opts.animIn={left:0,width:this.cycleW};opts.animOut={left:curr.cycleW/2,width:0};});opts.cssBefore={top:0,width:0};};$.fn.cycle.transitions.curtainY=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,true,false,true);opts.cssBefore.top=next.cycleH/2;opts.animIn={top:0,height:next.cycleH};opts.animOut={top:curr.cycleH/2,height:0};});opts.cssBefore={left:0,height:0};};$.fn.cycle.transitions.cover=function($cont,$slides,opts){var d=opts.direction||"left";var w=$cont.css("overflow","hidden").width();var h=$cont.height();opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts);if(d=="right"){opts.cssBefore.left=-w;}else{if(d=="up"){opts.cssBefore.top=h;}else{if(d=="down"){opts.cssBefore.top=-h;}else{opts.cssBefore.left=w;}}}});opts.animIn={left:0,top:0};opts.animOut={opacity:1};opts.cssBefore={top:0,left:0};};$.fn.cycle.transitions.uncover=function($cont,$slides,opts){var d=opts.direction||"left";var w=$cont.css("overflow","hidden").width();var h=$cont.height();opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,true,true,true);if(d=="right"){opts.animOut.left=w;}else{if(d=="up"){opts.animOut.top=-h;}else{if(d=="down"){opts.animOut.top=h;}else{opts.animOut.left=-w;}}}});opts.animIn={left:0,top:0};opts.animOut={opacity:1};opts.cssBefore={top:0,left:0};};$.fn.cycle.transitions.toss=function($cont,$slides,opts){var w=$cont.css("overflow","visible").width();var h=$cont.height();opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,true,true,true);if(!opts.animOut.left&&!opts.animOut.top){opts.animOut={left:w*2,top:-h/2,opacity:0};}else{opts.animOut.opacity=0;}});opts.cssBefore={left:0,top:0};opts.animIn={left:0};};$.fn.cycle.transitions.wipe=function($cont,$slides,opts){var w=$cont.css("overflow","hidden").width();var h=$cont.height();opts.cssBefore=opts.cssBefore||{};var clip;if(opts.clip){if(/l2r/.test(opts.clip)){clip="rect(0px 0px "+h+"px 0px)";}else{if(/r2l/.test(opts.clip)){clip="rect(0px "+w+"px "+h+"px "+w+"px)";}else{if(/t2b/.test(opts.clip)){clip="rect(0px "+w+"px 0px 0px)";}else{if(/b2t/.test(opts.clip)){clip="rect("+h+"px "+w+"px "+h+"px 0px)";}else{if(/zoom/.test(opts.clip)){var top=parseInt(h/2);var left=parseInt(w/2);clip="rect("+top+"px "+left+"px "+top+"px "+left+"px)";}}}}}}opts.cssBefore.clip=opts.cssBefore.clip||clip||"rect(0px 0px 0px 0px)";var d=opts.cssBefore.clip.match(/(\d+)/g);var t=parseInt(d[0]),r=parseInt(d[1]),b=parseInt(d[2]),l=parseInt(d[3]);opts.before.push(function(curr,next,opts){if(curr==next){return;}var $curr=$(curr),$next=$(next);$.fn.cycle.commonReset(curr,next,opts,true,true,false);opts.cssAfter.display="block";var step=1,count=parseInt((opts.speedIn/13))-1;(function f(){var tt=t?t-parseInt(step*(t/count)):0;var ll=l?l-parseInt(step*(l/count)):0;var bb=b<h?b+parseInt(step*((h-b)/count||1)):h;var rr=r<w?r+parseInt(step*((w-r)/count||1)):w;$next.css({clip:"rect("+tt+"px "+rr+"px "+bb+"px "+ll+"px)"});(step++<=count)?setTimeout(f,13):$curr.css("display","none");})();});opts.cssBefore={display:"block",opacity:1,top:0,left:0};opts.animIn={left:0};opts.animOut={left:0};};})(jQuery);
     1037(function($) {
     1038
     1039//
     1040// These functions define slide initialization and properties for the named
     1041// transitions. To save file size feel free to remove any of these that you
     1042// don't need.
     1043//
     1044$.fn.cycle.transitions.none = function($cont, $slides, opts) {
     1045    opts.fxFn = function(curr,next,opts,after){
     1046        $(next).show();
     1047        $(curr).hide();
     1048        after();
     1049    };
     1050};
     1051
     1052// not a cross-fade, fadeout only fades out the top slide
     1053$.fn.cycle.transitions.fadeout = function($cont, $slides, opts) {
     1054    $slides.not(':eq('+opts.currSlide+')').css({ display: 'block', 'opacity': 1 });
     1055    opts.before.push(function(curr,next,opts,w,h,rev) {
     1056        $(curr).css('zIndex',opts.slideCount + (!rev === true ? 1 : 0));
     1057        $(next).css('zIndex',opts.slideCount + (!rev === true ? 0 : 1));
     1058    });
     1059    opts.animIn.opacity = 1;
     1060    opts.animOut.opacity = 0;
     1061    opts.cssBefore.opacity = 1;
     1062    opts.cssBefore.display = 'block';
     1063    opts.cssAfter.zIndex = 0;
     1064};
     1065
     1066// scrollUp/Down/Left/Right
     1067$.fn.cycle.transitions.scrollUp = function($cont, $slides, opts) {
     1068    $cont.css('overflow','hidden');
     1069    opts.before.push($.fn.cycle.commonReset);
     1070    var h = $cont.height();
     1071    opts.cssBefore.top = h;
     1072    opts.cssBefore.left = 0;
     1073    opts.cssFirst.top = 0;
     1074    opts.animIn.top = 0;
     1075    opts.animOut.top = -h;
     1076};
     1077$.fn.cycle.transitions.scrollDown = function($cont, $slides, opts) {
     1078    $cont.css('overflow','hidden');
     1079    opts.before.push($.fn.cycle.commonReset);
     1080    var h = $cont.height();
     1081    opts.cssFirst.top = 0;
     1082    opts.cssBefore.top = -h;
     1083    opts.cssBefore.left = 0;
     1084    opts.animIn.top = 0;
     1085    opts.animOut.top = h;
     1086};
     1087$.fn.cycle.transitions.scrollLeft = function($cont, $slides, opts) {
     1088    $cont.css('overflow','hidden');
     1089    opts.before.push($.fn.cycle.commonReset);
     1090    var w = $cont.width();
     1091    opts.cssFirst.left = 0;
     1092    opts.cssBefore.left = w;
     1093    opts.cssBefore.top = 0;
     1094    opts.animIn.left = 0;
     1095    opts.animOut.left = 0-w;
     1096};
     1097$.fn.cycle.transitions.scrollRight = function($cont, $slides, opts) {
     1098    $cont.css('overflow','hidden');
     1099    opts.before.push($.fn.cycle.commonReset);
     1100    var w = $cont.width();
     1101    opts.cssFirst.left = 0;
     1102    opts.cssBefore.left = -w;
     1103    opts.cssBefore.top = 0;
     1104    opts.animIn.left = 0;
     1105    opts.animOut.left = w;
     1106};
     1107$.fn.cycle.transitions.scrollHorz = function($cont, $slides, opts) {
     1108    $cont.css('overflow','hidden').width();
     1109    opts.before.push(function(curr, next, opts, fwd) {
     1110        if (opts.rev)
     1111            fwd = !fwd;
     1112        $.fn.cycle.commonReset(curr,next,opts);
     1113        opts.cssBefore.left = fwd ? (next.cycleW-1) : (1-next.cycleW);
     1114        opts.animOut.left = fwd ? -curr.cycleW : curr.cycleW;
     1115    });
     1116    opts.cssFirst.left = 0;
     1117    opts.cssBefore.top = 0;
     1118    opts.animIn.left = 0;
     1119    opts.animOut.top = 0;
     1120};
     1121$.fn.cycle.transitions.scrollVert = function($cont, $slides, opts) {
     1122    $cont.css('overflow','hidden');
     1123    opts.before.push(function(curr, next, opts, fwd) {
     1124        if (opts.rev)
     1125            fwd = !fwd;
     1126        $.fn.cycle.commonReset(curr,next,opts);
     1127        opts.cssBefore.top = fwd ? (1-next.cycleH) : (next.cycleH-1);
     1128        opts.animOut.top = fwd ? curr.cycleH : -curr.cycleH;
     1129    });
     1130    opts.cssFirst.top = 0;
     1131    opts.cssBefore.left = 0;
     1132    opts.animIn.top = 0;
     1133    opts.animOut.left = 0;
     1134};
     1135
     1136// slideX/slideY
     1137$.fn.cycle.transitions.slideX = function($cont, $slides, opts) {
     1138    opts.before.push(function(curr, next, opts) {
     1139        $(opts.elements).not(curr).hide();
     1140        $.fn.cycle.commonReset(curr,next,opts,false,true);
     1141        opts.animIn.width = next.cycleW;
     1142    });
     1143    opts.cssBefore.left = 0;
     1144    opts.cssBefore.top = 0;
     1145    opts.cssBefore.width = 0;
     1146    opts.animIn.width = 'show';
     1147    opts.animOut.width = 0;
     1148};
     1149$.fn.cycle.transitions.slideY = function($cont, $slides, opts) {
     1150    opts.before.push(function(curr, next, opts) {
     1151        $(opts.elements).not(curr).hide();
     1152        $.fn.cycle.commonReset(curr,next,opts,true,false);
     1153        opts.animIn.height = next.cycleH;
     1154    });
     1155    opts.cssBefore.left = 0;
     1156    opts.cssBefore.top = 0;
     1157    opts.cssBefore.height = 0;
     1158    opts.animIn.height = 'show';
     1159    opts.animOut.height = 0;
     1160};
     1161
     1162// shuffle
     1163$.fn.cycle.transitions.shuffle = function($cont, $slides, opts) {
     1164    var i, w = $cont.css('overflow', 'visible').width();
     1165    $slides.css({left: 0, top: 0});
     1166    opts.before.push(function(curr,next,opts) {
     1167        $.fn.cycle.commonReset(curr,next,opts,true,true,true);
     1168    });
     1169    // only adjust speed once!
     1170    if (!opts.speedAdjusted) {
     1171        opts.speed = opts.speed / 2; // shuffle has 2 transitions
     1172        opts.speedAdjusted = true;
     1173    }
     1174    opts.random = 0;
     1175    opts.shuffle = opts.shuffle || {left:-w, top:15};
     1176    opts.els = [];
     1177    for (i=0; i < $slides.length; i++)
     1178        opts.els.push($slides[i]);
     1179
     1180    for (i=0; i < opts.currSlide; i++)
     1181        opts.els.push(opts.els.shift());
     1182
     1183    // custom transition fn (hat tip to Benjamin Sterling for this bit of sweetness!)
     1184    opts.fxFn = function(curr, next, opts, cb, fwd) {
     1185        if (opts.rev)
     1186            fwd = !fwd;
     1187        var $el = fwd ? $(curr) : $(next);
     1188        $(next).css(opts.cssBefore);
     1189        var count = opts.slideCount;
     1190        $el.animate(opts.shuffle, opts.speedIn, opts.easeIn, function() {
     1191            var hops = $.fn.cycle.hopsFromLast(opts, fwd);
     1192            for (var k=0; k < hops; k++)
     1193                fwd ? opts.els.push(opts.els.shift()) : opts.els.unshift(opts.els.pop());
     1194            if (fwd) {
     1195                for (var i=0, len=opts.els.length; i < len; i++)
     1196                    $(opts.els[i]).css('z-index', len-i+count);
     1197            }
     1198            else {
     1199                var z = $(curr).css('z-index');
     1200                $el.css('z-index', parseInt(z,10)+1+count);
     1201            }
     1202            $el.animate({left:0, top:0}, opts.speedOut, opts.easeOut, function() {
     1203                $(fwd ? this : curr).hide();
     1204                if (cb) cb();
     1205            });
     1206        });
     1207    };
     1208    $.extend(opts.cssBefore, { display: 'block', opacity: 1, top: 0, left: 0 });
     1209};
     1210
     1211// turnUp/Down/Left/Right
     1212$.fn.cycle.transitions.turnUp = function($cont, $slides, opts) {
     1213    opts.before.push(function(curr, next, opts) {
     1214        $.fn.cycle.commonReset(curr,next,opts,true,false);
     1215        opts.cssBefore.top = next.cycleH;
     1216        opts.animIn.height = next.cycleH;
     1217        opts.animOut.width = next.cycleW;
     1218    });
     1219    opts.cssFirst.top = 0;
     1220    opts.cssBefore.left = 0;
     1221    opts.cssBefore.height = 0;
     1222    opts.animIn.top = 0;
     1223    opts.animOut.height = 0;
     1224};
     1225$.fn.cycle.transitions.turnDown = function($cont, $slides, opts) {
     1226    opts.before.push(function(curr, next, opts) {
     1227        $.fn.cycle.commonReset(curr,next,opts,true,false);
     1228        opts.animIn.height = next.cycleH;
     1229        opts.animOut.top   = curr.cycleH;
     1230    });
     1231    opts.cssFirst.top = 0;
     1232    opts.cssBefore.left = 0;
     1233    opts.cssBefore.top = 0;
     1234    opts.cssBefore.height = 0;
     1235    opts.animOut.height = 0;
     1236};
     1237$.fn.cycle.transitions.turnLeft = function($cont, $slides, opts) {
     1238    opts.before.push(function(curr, next, opts) {
     1239        $.fn.cycle.commonReset(curr,next,opts,false,true);
     1240        opts.cssBefore.left = next.cycleW;
     1241        opts.animIn.width = next.cycleW;
     1242    });
     1243    opts.cssBefore.top = 0;
     1244    opts.cssBefore.width = 0;
     1245    opts.animIn.left = 0;
     1246    opts.animOut.width = 0;
     1247};
     1248$.fn.cycle.transitions.turnRight = function($cont, $slides, opts) {
     1249    opts.before.push(function(curr, next, opts) {
     1250        $.fn.cycle.commonReset(curr,next,opts,false,true);
     1251        opts.animIn.width = next.cycleW;
     1252        opts.animOut.left = curr.cycleW;
     1253    });
     1254    $.extend(opts.cssBefore, { top: 0, left: 0, width: 0 });
     1255    opts.animIn.left = 0;
     1256    opts.animOut.width = 0;
     1257};
     1258
     1259// zoom
     1260$.fn.cycle.transitions.zoom = function($cont, $slides, opts) {
     1261    opts.before.push(function(curr, next, opts) {
     1262        $.fn.cycle.commonReset(curr,next,opts,false,false,true);
     1263        opts.cssBefore.top = next.cycleH/2;
     1264        opts.cssBefore.left = next.cycleW/2;
     1265        $.extend(opts.animIn, { top: 0, left: 0, width: next.cycleW, height: next.cycleH });
     1266        $.extend(opts.animOut, { width: 0, height: 0, top: curr.cycleH/2, left: curr.cycleW/2 });
     1267    });
     1268    opts.cssFirst.top = 0;
     1269    opts.cssFirst.left = 0;
     1270    opts.cssBefore.width = 0;
     1271    opts.cssBefore.height = 0;
     1272};
     1273
     1274// fadeZoom
     1275$.fn.cycle.transitions.fadeZoom = function($cont, $slides, opts) {
     1276    opts.before.push(function(curr, next, opts) {
     1277        $.fn.cycle.commonReset(curr,next,opts,false,false);
     1278        opts.cssBefore.left = next.cycleW/2;
     1279        opts.cssBefore.top = next.cycleH/2;
     1280        $.extend(opts.animIn, { top: 0, left: 0, width: next.cycleW, height: next.cycleH });
     1281    });
     1282    opts.cssBefore.width = 0;
     1283    opts.cssBefore.height = 0;
     1284    opts.animOut.opacity = 0;
     1285};
     1286
     1287// blindX
     1288$.fn.cycle.transitions.blindX = function($cont, $slides, opts) {
     1289    var w = $cont.css('overflow','hidden').width();
     1290    opts.before.push(function(curr, next, opts) {
     1291        $.fn.cycle.commonReset(curr,next,opts);
     1292        opts.animIn.width = next.cycleW;
     1293        opts.animOut.left   = curr.cycleW;
     1294    });
     1295    opts.cssBefore.left = w;
     1296    opts.cssBefore.top = 0;
     1297    opts.animIn.left = 0;
     1298    opts.animOut.left = w;
     1299};
     1300// blindY
     1301$.fn.cycle.transitions.blindY = function($cont, $slides, opts) {
     1302    var h = $cont.css('overflow','hidden').height();
     1303    opts.before.push(function(curr, next, opts) {
     1304        $.fn.cycle.commonReset(curr,next,opts);
     1305        opts.animIn.height = next.cycleH;
     1306        opts.animOut.top   = curr.cycleH;
     1307    });
     1308    opts.cssBefore.top = h;
     1309    opts.cssBefore.left = 0;
     1310    opts.animIn.top = 0;
     1311    opts.animOut.top = h;
     1312};
     1313// blindZ
     1314$.fn.cycle.transitions.blindZ = function($cont, $slides, opts) {
     1315    var h = $cont.css('overflow','hidden').height();
     1316    var w = $cont.width();
     1317    opts.before.push(function(curr, next, opts) {
     1318        $.fn.cycle.commonReset(curr,next,opts);
     1319        opts.animIn.height = next.cycleH;
     1320        opts.animOut.top   = curr.cycleH;
     1321    });
     1322    opts.cssBefore.top = h;
     1323    opts.cssBefore.left = w;
     1324    opts.animIn.top = 0;
     1325    opts.animIn.left = 0;
     1326    opts.animOut.top = h;
     1327    opts.animOut.left = w;
     1328};
     1329
     1330// growX - grow horizontally from centered 0 width
     1331$.fn.cycle.transitions.growX = function($cont, $slides, opts) {
     1332    opts.before.push(function(curr, next, opts) {
     1333        $.fn.cycle.commonReset(curr,next,opts,false,true);
     1334        opts.cssBefore.left = this.cycleW/2;
     1335        opts.animIn.left = 0;
     1336        opts.animIn.width = this.cycleW;
     1337        opts.animOut.left = 0;
     1338    });
     1339    opts.cssBefore.top = 0;
     1340    opts.cssBefore.width = 0;
     1341};
     1342// growY - grow vertically from centered 0 height
     1343$.fn.cycle.transitions.growY = function($cont, $slides, opts) {
     1344    opts.before.push(function(curr, next, opts) {
     1345        $.fn.cycle.commonReset(curr,next,opts,true,false);
     1346        opts.cssBefore.top = this.cycleH/2;
     1347        opts.animIn.top = 0;
     1348        opts.animIn.height = this.cycleH;
     1349        opts.animOut.top = 0;
     1350    });
     1351    opts.cssBefore.height = 0;
     1352    opts.cssBefore.left = 0;
     1353};
     1354
     1355// curtainX - squeeze in both edges horizontally
     1356$.fn.cycle.transitions.curtainX = function($cont, $slides, opts) {
     1357    opts.before.push(function(curr, next, opts) {
     1358        $.fn.cycle.commonReset(curr,next,opts,false,true,true);
     1359        opts.cssBefore.left = next.cycleW/2;
     1360        opts.animIn.left = 0;
     1361        opts.animIn.width = this.cycleW;
     1362        opts.animOut.left = curr.cycleW/2;
     1363        opts.animOut.width = 0;
     1364    });
     1365    opts.cssBefore.top = 0;
     1366    opts.cssBefore.width = 0;
     1367};
     1368// curtainY - squeeze in both edges vertically
     1369$.fn.cycle.transitions.curtainY = function($cont, $slides, opts) {
     1370    opts.before.push(function(curr, next, opts) {
     1371        $.fn.cycle.commonReset(curr,next,opts,true,false,true);
     1372        opts.cssBefore.top = next.cycleH/2;
     1373        opts.animIn.top = 0;
     1374        opts.animIn.height = next.cycleH;
     1375        opts.animOut.top = curr.cycleH/2;
     1376        opts.animOut.height = 0;
     1377    });
     1378    opts.cssBefore.height = 0;
     1379    opts.cssBefore.left = 0;
     1380};
     1381
     1382// cover - curr slide covered by next slide
     1383$.fn.cycle.transitions.cover = function($cont, $slides, opts) {
     1384    var d = opts.direction || 'left';
     1385    var w = $cont.css('overflow','hidden').width();
     1386    var h = $cont.height();
     1387    opts.before.push(function(curr, next, opts) {
     1388        $.fn.cycle.commonReset(curr,next,opts);
     1389        if (d == 'right')
     1390            opts.cssBefore.left = -w;
     1391        else if (d == 'up')
     1392            opts.cssBefore.top = h;
     1393        else if (d == 'down')
     1394            opts.cssBefore.top = -h;
     1395        else
     1396            opts.cssBefore.left = w;
     1397    });
     1398    opts.animIn.left = 0;
     1399    opts.animIn.top = 0;
     1400    opts.cssBefore.top = 0;
     1401    opts.cssBefore.left = 0;
     1402};
     1403
     1404// uncover - curr slide moves off next slide
     1405$.fn.cycle.transitions.uncover = function($cont, $slides, opts) {
     1406    var d = opts.direction || 'left';
     1407    var w = $cont.css('overflow','hidden').width();
     1408    var h = $cont.height();
     1409    opts.before.push(function(curr, next, opts) {
     1410        $.fn.cycle.commonReset(curr,next,opts,true,true,true);
     1411        if (d == 'right')
     1412            opts.animOut.left = w;
     1413        else if (d == 'up')
     1414            opts.animOut.top = -h;
     1415        else if (d == 'down')
     1416            opts.animOut.top = h;
     1417        else
     1418            opts.animOut.left = -w;
     1419    });
     1420    opts.animIn.left = 0;
     1421    opts.animIn.top = 0;
     1422    opts.cssBefore.top = 0;
     1423    opts.cssBefore.left = 0;
     1424};
     1425
     1426// toss - move top slide and fade away
     1427$.fn.cycle.transitions.toss = function($cont, $slides, opts) {
     1428    var w = $cont.css('overflow','visible').width();
     1429    var h = $cont.height();
     1430    opts.before.push(function(curr, next, opts) {
     1431        $.fn.cycle.commonReset(curr,next,opts,true,true,true);
     1432        // provide default toss settings if animOut not provided
     1433        if (!opts.animOut.left && !opts.animOut.top)
     1434            $.extend(opts.animOut, { left: w*2, top: -h/2, opacity: 0 });
     1435        else
     1436            opts.animOut.opacity = 0;
     1437    });
     1438    opts.cssBefore.left = 0;
     1439    opts.cssBefore.top = 0;
     1440    opts.animIn.left = 0;
     1441};
     1442
     1443// wipe - clip animation
     1444$.fn.cycle.transitions.wipe = function($cont, $slides, opts) {
     1445    var w = $cont.css('overflow','hidden').width();
     1446    var h = $cont.height();
     1447    opts.cssBefore = opts.cssBefore || {};
     1448    var clip;
     1449    if (opts.clip) {
     1450        if (/l2r/.test(opts.clip))
     1451            clip = 'rect(0px 0px '+h+'px 0px)';
     1452        else if (/r2l/.test(opts.clip))
     1453            clip = 'rect(0px '+w+'px '+h+'px '+w+'px)';
     1454        else if (/t2b/.test(opts.clip))
     1455            clip = 'rect(0px '+w+'px 0px 0px)';
     1456        else if (/b2t/.test(opts.clip))
     1457            clip = 'rect('+h+'px '+w+'px '+h+'px 0px)';
     1458        else if (/zoom/.test(opts.clip)) {
     1459            var top = parseInt(h/2,10);
     1460            var left = parseInt(w/2,10);
     1461            clip = 'rect('+top+'px '+left+'px '+top+'px '+left+'px)';
     1462        }
     1463    }
     1464
     1465    opts.cssBefore.clip = opts.cssBefore.clip || clip || 'rect(0px 0px 0px 0px)';
     1466
     1467    var d = opts.cssBefore.clip.match(/(\d+)/g);
     1468    var t = parseInt(d[0],10), r = parseInt(d[1],10), b = parseInt(d[2],10), l = parseInt(d[3],10);
     1469
     1470    opts.before.push(function(curr, next, opts) {
     1471        if (curr == next) return;
     1472        var $curr = $(curr), $next = $(next);
     1473        $.fn.cycle.commonReset(curr,next,opts,true,true,false);
     1474        opts.cssAfter.display = 'block';
     1475
     1476        var step = 1, count = parseInt((opts.speedIn / 13),10) - 1;
     1477        (function f() {
     1478            var tt = t ? t - parseInt(step * (t/count),10) : 0;
     1479            var ll = l ? l - parseInt(step * (l/count),10) : 0;
     1480            var bb = b < h ? b + parseInt(step * ((h-b)/count || 1),10) : h;
     1481            var rr = r < w ? r + parseInt(step * ((w-r)/count || 1),10) : w;
     1482            $next.css({ clip: 'rect('+tt+'px '+rr+'px '+bb+'px '+ll+'px)' });
     1483            (step++ <= count) ? setTimeout(f, 13) : $curr.css('display', 'none');
     1484        })();
     1485    });
     1486    $.extend(opts.cssBefore, { display: 'block', opacity: 1, top: 0, left: 0 });
     1487    opts.animIn    = { left: 0 };
     1488    opts.animOut   = { left: 0 };
     1489};
     1490
     1491})(jQuery);
  • sdac-post-slideshows/tags/1.1.3/readme.txt

    r386382 r434828  
    33Contributors: jenz
    44Requires at least: 2.8
    5 Tested up to: 3.1
    6 Stable tag: 1.1.2
     5Tested up to: 3.2.1
     6Stable tag: 1.1.3
    77Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=4761649
    88
     
    4848
    4949== Changelog ==
     50= 1.1.3 =
     51* (September 7, 2011)
     52* Fixed an incorrect height setting
     53
    5054= 1.1.2 =
    5155* (May 18, 2011)
  • sdac-post-slideshows/tags/1.1.3/sdac-post_slideshows.php

    r386382 r434828  
    66Author: Jennifer Zelazny/SDAC Inc.
    77Author URI: http://www.sandboxdev.com
    8 Version: 1.1.2
     8Version: 1.1.3
    99---------------------------------------------------
    1010Released under the GPL license
     
    365365        foreach ( $wp_query->posts as $post ) {
    366366            if ( preg_match("#\[post-slideshow[^\]]*\]#is", $post->post_content ) ) {
    367                 wp_enqueue_script( 'jquery' );
     367                wp_enqueue_script( 'jquery' );
    368368                wp_enqueue_script( 'jquery-cycle', plugins_url( 'js/jquery.cycle.min.js', __FILE__ ) );
    369369                add_action( 'wp_head', 'sdac_ps_wp_head' );
     
    378378    // Add in CSS Overrides (if any)
    379379    echo '
    380         <!-- Slideshow CSS -->
     380        <!-- Start Slideshow CSS -->
    381381        <style type="text/css">
    382382            .sdac_ps_nav {margin:10px 0 10px 0;}
     
    385385            .sdac_ps_nav a:focus {outline: none;}
    386386        </style>
     387        <!-- End Slideshow CSS -->
    387388        <script type="text/javascript">var sdac_post_slideshows = new Array();</script>
    388389        ';
     
    420421    // Add in JS for Cycle
    421422    $content .= '
    422         <!-- Slideshow JS -->
     423        <!-- Start Slideshow JS -->
    423424        <script type="text/javascript">
    424425            jQuery(document).ready(function($) {
     
    435436            });
    436437        </script>
     438        <!-- End Slideshow JS -->
    437439        ';
    438440    $returned_slideshow_js = true;
     
    492494            $slide_image_style .= 'width:300px;';
    493495        }
    494         if ( get_post_meta( $post_id, 'sdac_ps_image_width_override', true ) ) {
    495             $slide_image_style .= 'height:'.absint( get_post_meta( $post_id, 'sdac_ps_image_width_override', true ) ).'px;';
     496        if ( get_post_meta( $post_id, 'sdac_ps_image_height_override', true ) ) {
     497            $slide_image_style .= 'height:'.absint( get_post_meta( $post_id, 'sdac_ps_image_height_override', true ) ).'px;';
    496498        } else {
    497499            $slide_image_style .= 'height:300px;';
  • sdac-post-slideshows/trunk/js/jquery.cycle.min.js

    r350003 r434828  
    1 /*
     1/*!
    22 * jQuery Cycle Plugin (with Transition Definitions)
    33 * Examples and documentation at: http://jquery.malsup.com/cycle/
    44 * Copyright (c) 2007-2010 M. Alsup
    5  * Version: 2.94 (20-DEC-2010)
     5 * Version: 2.9995 (09-AUG-2011)
    66 * Dual licensed under the MIT and GPL licenses.
    77 * http://jquery.malsup.com/license.html
    8  * Requires: jQuery v1.2.6 or later
     8 * Requires: jQuery v1.3.2 or later
    99 */
    10 (function($){var ver="2.94";if($.support==undefined){$.support={opacity:!($.browser.msie)};}function debug(s){if($.fn.cycle.debug){log(s);}}function log(){if(window.console&&window.console.log){window.console.log("[cycle] "+Array.prototype.join.call(arguments," "));}}$.fn.cycle=function(options,arg2){var o={s:this.selector,c:this.context};if(this.length===0&&options!="stop"){if(!$.isReady&&o.s){log("DOM not ready, queuing slideshow");$(function(){$(o.s,o.c).cycle(options,arg2);});return this;}log("terminating; zero elements found by selector"+($.isReady?"":" (DOM not ready)"));return this;}return this.each(function(){var opts=handleArguments(this,options,arg2);if(opts===false){return;}opts.updateActivePagerLink=opts.updateActivePagerLink||$.fn.cycle.updateActivePagerLink;if(this.cycleTimeout){clearTimeout(this.cycleTimeout);}this.cycleTimeout=this.cyclePause=0;var $cont=$(this);var $slides=opts.slideExpr?$(opts.slideExpr,this):$cont.children();var els=$slides.get();if(els.length<2){log("terminating; too few slides: "+els.length);return;}var opts2=buildOptions($cont,$slides,els,opts,o);if(opts2===false){return;}var startTime=opts2.continuous?10:getTimeout(els[opts2.currSlide],els[opts2.nextSlide],opts2,!opts2.backwards);if(startTime){startTime+=(opts2.delay||0);if(startTime<10){startTime=10;}debug("first timeout: "+startTime);this.cycleTimeout=setTimeout(function(){go(els,opts2,0,!opts.backwards);},startTime);}});};function handleArguments(cont,options,arg2){if(cont.cycleStop==undefined){cont.cycleStop=0;}if(options===undefined||options===null){options={};}if(options.constructor==String){switch(options){case"destroy":case"stop":var opts=$(cont).data("cycle.opts");if(!opts){return false;}cont.cycleStop++;if(cont.cycleTimeout){clearTimeout(cont.cycleTimeout);}cont.cycleTimeout=0;$(cont).removeData("cycle.opts");if(options=="destroy"){destroy(opts);}return false;case"toggle":cont.cyclePause=(cont.cyclePause===1)?0:1;checkInstantResume(cont.cyclePause,arg2,cont);return false;case"pause":cont.cyclePause=1;return false;case"resume":cont.cyclePause=0;checkInstantResume(false,arg2,cont);return false;case"prev":case"next":var opts=$(cont).data("cycle.opts");if(!opts){log('options not found, "prev/next" ignored');return false;}$.fn.cycle[options](opts);return false;default:options={fx:options};}return options;}else{if(options.constructor==Number){var num=options;options=$(cont).data("cycle.opts");if(!options){log("options not found, can not advance slide");return false;}if(num<0||num>=options.elements.length){log("invalid slide index: "+num);return false;}options.nextSlide=num;if(cont.cycleTimeout){clearTimeout(cont.cycleTimeout);cont.cycleTimeout=0;}if(typeof arg2=="string"){options.oneTimeFx=arg2;}go(options.elements,options,1,num>=options.currSlide);return false;}}return options;function checkInstantResume(isPaused,arg2,cont){if(!isPaused&&arg2===true){var options=$(cont).data("cycle.opts");if(!options){log("options not found, can not resume");return false;}if(cont.cycleTimeout){clearTimeout(cont.cycleTimeout);cont.cycleTimeout=0;}go(options.elements,options,1,!options.backwards);}}}function removeFilter(el,opts){if(!$.support.opacity&&opts.cleartype&&el.style.filter){try{el.style.removeAttribute("filter");}catch(smother){}}}function destroy(opts){if(opts.next){$(opts.next).unbind(opts.prevNextEvent);}if(opts.prev){$(opts.prev).unbind(opts.prevNextEvent);}if(opts.pager||opts.pagerAnchorBuilder){$.each(opts.pagerAnchors||[],function(){this.unbind().remove();});}opts.pagerAnchors=null;if(opts.destroy){opts.destroy(opts);}}function buildOptions($cont,$slides,els,options,o){var opts=$.extend({},$.fn.cycle.defaults,options||{},$.metadata?$cont.metadata():$.meta?$cont.data():{});if(opts.autostop){opts.countdown=opts.autostopCount||els.length;}var cont=$cont[0];$cont.data("cycle.opts",opts);opts.$cont=$cont;opts.stopCount=cont.cycleStop;opts.elements=els;opts.before=opts.before?[opts.before]:[];opts.after=opts.after?[opts.after]:[];opts.after.unshift(function(){opts.busy=0;});if(!$.support.opacity&&opts.cleartype){opts.after.push(function(){removeFilter(this,opts);});}if(opts.continuous){opts.after.push(function(){go(els,opts,0,!opts.backwards);});}saveOriginalOpts(opts);if(!$.support.opacity&&opts.cleartype&&!opts.cleartypeNoBg){clearTypeFix($slides);}if($cont.css("position")=="static"){$cont.css("position","relative");}if(opts.width){$cont.width(opts.width);}if(opts.height&&opts.height!="auto"){$cont.height(opts.height);}if(opts.startingSlide){opts.startingSlide=parseInt(opts.startingSlide);}else{if(opts.backwards){opts.startingSlide=els.length-1;}}if(opts.random){opts.randomMap=[];for(var i=0;i<els.length;i++){opts.randomMap.push(i);}opts.randomMap.sort(function(a,b){return Math.random()-0.5;});opts.randomIndex=1;opts.startingSlide=opts.randomMap[1];}else{if(opts.startingSlide>=els.length){opts.startingSlide=0;}}opts.currSlide=opts.startingSlide||0;var first=opts.startingSlide;$slides.css({position:"absolute",top:0,left:0}).hide().each(function(i){var z;if(opts.backwards){z=first?i<=first?els.length+(i-first):first-i:els.length-i;}else{z=first?i>=first?els.length-(i-first):first-i:els.length-i;}$(this).css("z-index",z);});$(els[first]).css("opacity",1).show();removeFilter(els[first],opts);if(opts.fit&&opts.width){$slides.width(opts.width);}if(opts.fit&&opts.height&&opts.height!="auto"){$slides.height(opts.height);}var reshape=opts.containerResize&&!$cont.innerHeight();if(reshape){var maxw=0,maxh=0;for(var j=0;j<els.length;j++){var $e=$(els[j]),e=$e[0],w=$e.outerWidth(),h=$e.outerHeight();if(!w){w=e.offsetWidth||e.width||$e.attr("width");}if(!h){h=e.offsetHeight||e.height||$e.attr("height");}maxw=w>maxw?w:maxw;maxh=h>maxh?h:maxh;}if(maxw>0&&maxh>0){$cont.css({width:maxw+"px",height:maxh+"px"});}}if(opts.pause){$cont.hover(function(){this.cyclePause++;},function(){this.cyclePause--;});}if(supportMultiTransitions(opts)===false){return false;}var requeue=false;options.requeueAttempts=options.requeueAttempts||0;$slides.each(function(){var $el=$(this);this.cycleH=(opts.fit&&opts.height)?opts.height:($el.height()||this.offsetHeight||this.height||$el.attr("height")||0);this.cycleW=(opts.fit&&opts.width)?opts.width:($el.width()||this.offsetWidth||this.width||$el.attr("width")||0);if($el.is("img")){var loadingIE=($.browser.msie&&this.cycleW==28&&this.cycleH==30&&!this.complete);var loadingFF=($.browser.mozilla&&this.cycleW==34&&this.cycleH==19&&!this.complete);var loadingOp=($.browser.opera&&((this.cycleW==42&&this.cycleH==19)||(this.cycleW==37&&this.cycleH==17))&&!this.complete);var loadingOther=(this.cycleH==0&&this.cycleW==0&&!this.complete);if(loadingIE||loadingFF||loadingOp||loadingOther){if(o.s&&opts.requeueOnImageNotLoaded&&++options.requeueAttempts<100){log(options.requeueAttempts," - img slide not loaded, requeuing slideshow: ",this.src,this.cycleW,this.cycleH);setTimeout(function(){$(o.s,o.c).cycle(options);},opts.requeueTimeout);requeue=true;return false;}else{log("could not determine size of image: "+this.src,this.cycleW,this.cycleH);}}}return true;});if(requeue){return false;}opts.cssBefore=opts.cssBefore||{};opts.animIn=opts.animIn||{};opts.animOut=opts.animOut||{};$slides.not(":eq("+first+")").css(opts.cssBefore);if(opts.cssFirst){$($slides[first]).css(opts.cssFirst);}if(opts.timeout){opts.timeout=parseInt(opts.timeout);if(opts.speed.constructor==String){opts.speed=$.fx.speeds[opts.speed]||parseInt(opts.speed);}if(!opts.sync){opts.speed=opts.speed/2;}var buffer=opts.fx=="shuffle"?500:250;while((opts.timeout-opts.speed)<buffer){opts.timeout+=opts.speed;}}if(opts.easing){opts.easeIn=opts.easeOut=opts.easing;}if(!opts.speedIn){opts.speedIn=opts.speed;}if(!opts.speedOut){opts.speedOut=opts.speed;}opts.slideCount=els.length;opts.currSlide=opts.lastSlide=first;if(opts.random){if(++opts.randomIndex==els.length){opts.randomIndex=0;}opts.nextSlide=opts.randomMap[opts.randomIndex];}else{if(opts.backwards){opts.nextSlide=opts.startingSlide==0?(els.length-1):opts.startingSlide-1;}else{opts.nextSlide=opts.startingSlide>=(els.length-1)?0:opts.startingSlide+1;}}if(!opts.multiFx){var init=$.fn.cycle.transitions[opts.fx];if($.isFunction(init)){init($cont,$slides,opts);}else{if(opts.fx!="custom"&&!opts.multiFx){log("unknown transition: "+opts.fx,"; slideshow terminating");return false;}}}var e0=$slides[first];if(opts.before.length){opts.before[0].apply(e0,[e0,e0,opts,true]);}if(opts.after.length>1){opts.after[1].apply(e0,[e0,e0,opts,true]);}if(opts.next){$(opts.next).bind(opts.prevNextEvent,function(){return advance(opts,1);});}if(opts.prev){$(opts.prev).bind(opts.prevNextEvent,function(){return advance(opts,0);});}if(opts.pager||opts.pagerAnchorBuilder){buildPager(els,opts);}exposeAddSlide(opts,els);return opts;}function saveOriginalOpts(opts){opts.original={before:[],after:[]};opts.original.cssBefore=$.extend({},opts.cssBefore);opts.original.cssAfter=$.extend({},opts.cssAfter);opts.original.animIn=$.extend({},opts.animIn);opts.original.animOut=$.extend({},opts.animOut);$.each(opts.before,function(){opts.original.before.push(this);});$.each(opts.after,function(){opts.original.after.push(this);});}function supportMultiTransitions(opts){var i,tx,txs=$.fn.cycle.transitions;if(opts.fx.indexOf(",")>0){opts.multiFx=true;opts.fxs=opts.fx.replace(/\s*/g,"").split(",");for(i=0;i<opts.fxs.length;i++){var fx=opts.fxs[i];tx=txs[fx];if(!tx||!txs.hasOwnProperty(fx)||!$.isFunction(tx)){log("discarding unknown transition: ",fx);opts.fxs.splice(i,1);i--;}}if(!opts.fxs.length){log("No valid transitions named; slideshow terminating.");return false;}}else{if(opts.fx=="all"){opts.multiFx=true;opts.fxs=[];for(p in txs){tx=txs[p];if(txs.hasOwnProperty(p)&&$.isFunction(tx)){opts.fxs.push(p);}}}}if(opts.multiFx&&opts.randomizeEffects){var r1=Math.floor(Math.random()*20)+30;for(i=0;i<r1;i++){var r2=Math.floor(Math.random()*opts.fxs.length);opts.fxs.push(opts.fxs.splice(r2,1)[0]);}debug("randomized fx sequence: ",opts.fxs);}return true;}function exposeAddSlide(opts,els){opts.addSlide=function(newSlide,prepend){var $s=$(newSlide),s=$s[0];if(!opts.autostopCount){opts.countdown++;}els[prepend?"unshift":"push"](s);if(opts.els){opts.els[prepend?"unshift":"push"](s);}opts.slideCount=els.length;$s.css("position","absolute");$s[prepend?"prependTo":"appendTo"](opts.$cont);if(prepend){opts.currSlide++;opts.nextSlide++;}if(!$.support.opacity&&opts.cleartype&&!opts.cleartypeNoBg){clearTypeFix($s);}if(opts.fit&&opts.width){$s.width(opts.width);}if(opts.fit&&opts.height&&opts.height!="auto"){$s.height(opts.height);}s.cycleH=(opts.fit&&opts.height)?opts.height:$s.height();s.cycleW=(opts.fit&&opts.width)?opts.width:$s.width();$s.css(opts.cssBefore);if(opts.pager||opts.pagerAnchorBuilder){$.fn.cycle.createPagerAnchor(els.length-1,s,$(opts.pager),els,opts);}if($.isFunction(opts.onAddSlide)){opts.onAddSlide($s);}else{$s.hide();}};}$.fn.cycle.resetState=function(opts,fx){fx=fx||opts.fx;opts.before=[];opts.after=[];opts.cssBefore=$.extend({},opts.original.cssBefore);opts.cssAfter=$.extend({},opts.original.cssAfter);opts.animIn=$.extend({},opts.original.animIn);opts.animOut=$.extend({},opts.original.animOut);opts.fxFn=null;$.each(opts.original.before,function(){opts.before.push(this);});$.each(opts.original.after,function(){opts.after.push(this);});var init=$.fn.cycle.transitions[fx];if($.isFunction(init)){init(opts.$cont,$(opts.elements),opts);}};function go(els,opts,manual,fwd){if(manual&&opts.busy&&opts.manualTrump){debug("manualTrump in go(), stopping active transition");$(els).stop(true,true);opts.busy=false;}if(opts.busy){debug("transition active, ignoring new tx request");return;}var p=opts.$cont[0],curr=els[opts.currSlide],next=els[opts.nextSlide];if(p.cycleStop!=opts.stopCount||p.cycleTimeout===0&&!manual){return;}if(!manual&&!p.cyclePause&&!opts.bounce&&((opts.autostop&&(--opts.countdown<=0))||(opts.nowrap&&!opts.random&&opts.nextSlide<opts.currSlide))){if(opts.end){opts.end(opts);}return;}var changed=false;if((manual||!p.cyclePause)&&(opts.nextSlide!=opts.currSlide)){changed=true;var fx=opts.fx;curr.cycleH=curr.cycleH||$(curr).height();curr.cycleW=curr.cycleW||$(curr).width();next.cycleH=next.cycleH||$(next).height();next.cycleW=next.cycleW||$(next).width();if(opts.multiFx){if(opts.lastFx==undefined||++opts.lastFx>=opts.fxs.length){opts.lastFx=0;}fx=opts.fxs[opts.lastFx];opts.currFx=fx;}if(opts.oneTimeFx){fx=opts.oneTimeFx;opts.oneTimeFx=null;}$.fn.cycle.resetState(opts,fx);if(opts.before.length){$.each(opts.before,function(i,o){if(p.cycleStop!=opts.stopCount){return;}o.apply(next,[curr,next,opts,fwd]);});}var after=function(){$.each(opts.after,function(i,o){if(p.cycleStop!=opts.stopCount){return;}o.apply(next,[curr,next,opts,fwd]);});};debug("tx firing; currSlide: "+opts.currSlide+"; nextSlide: "+opts.nextSlide);opts.busy=1;if(opts.fxFn){opts.fxFn(curr,next,opts,after,fwd,manual&&opts.fastOnEvent);}else{if($.isFunction($.fn.cycle[opts.fx])){$.fn.cycle[opts.fx](curr,next,opts,after,fwd,manual&&opts.fastOnEvent);}else{$.fn.cycle.custom(curr,next,opts,after,fwd,manual&&opts.fastOnEvent);}}}if(changed||opts.nextSlide==opts.currSlide){opts.lastSlide=opts.currSlide;if(opts.random){opts.currSlide=opts.nextSlide;if(++opts.randomIndex==els.length){opts.randomIndex=0;}opts.nextSlide=opts.randomMap[opts.randomIndex];if(opts.nextSlide==opts.currSlide){opts.nextSlide=(opts.currSlide==opts.slideCount-1)?0:opts.currSlide+1;}}else{if(opts.backwards){var roll=(opts.nextSlide-1)<0;if(roll&&opts.bounce){opts.backwards=!opts.backwards;opts.nextSlide=1;opts.currSlide=0;}else{opts.nextSlide=roll?(els.length-1):opts.nextSlide-1;opts.currSlide=roll?0:opts.nextSlide+1;}}else{var roll=(opts.nextSlide+1)==els.length;if(roll&&opts.bounce){opts.backwards=!opts.backwards;opts.nextSlide=els.length-2;opts.currSlide=els.length-1;}else{opts.nextSlide=roll?0:opts.nextSlide+1;opts.currSlide=roll?els.length-1:opts.nextSlide-1;}}}}if(changed&&opts.pager){opts.updateActivePagerLink(opts.pager,opts.currSlide,opts.activePagerClass);}var ms=0;if(opts.timeout&&!opts.continuous){ms=getTimeout(els[opts.currSlide],els[opts.nextSlide],opts,fwd);}else{if(opts.continuous&&p.cyclePause){ms=10;}}if(ms>0){p.cycleTimeout=setTimeout(function(){go(els,opts,0,!opts.backwards);},ms);}}$.fn.cycle.updateActivePagerLink=function(pager,currSlide,clsName){$(pager).each(function(){$(this).children().removeClass(clsName).eq(currSlide).addClass(clsName);});};function getTimeout(curr,next,opts,fwd){if(opts.timeoutFn){var t=opts.timeoutFn.call(curr,curr,next,opts,fwd);while((t-opts.speed)<250){t+=opts.speed;}debug("calculated timeout: "+t+"; speed: "+opts.speed);if(t!==false){return t;}}return opts.timeout;}$.fn.cycle.next=function(opts){advance(opts,1);};$.fn.cycle.prev=function(opts){advance(opts,0);};function advance(opts,moveForward){var val=moveForward?1:-1;var els=opts.elements;var p=opts.$cont[0],timeout=p.cycleTimeout;if(timeout){clearTimeout(timeout);p.cycleTimeout=0;}if(opts.random&&val<0){opts.randomIndex--;if(--opts.randomIndex==-2){opts.randomIndex=els.length-2;}else{if(opts.randomIndex==-1){opts.randomIndex=els.length-1;}}opts.nextSlide=opts.randomMap[opts.randomIndex];}else{if(opts.random){opts.nextSlide=opts.randomMap[opts.randomIndex];}else{opts.nextSlide=opts.currSlide+val;if(opts.nextSlide<0){if(opts.nowrap){return false;}opts.nextSlide=els.length-1;}else{if(opts.nextSlide>=els.length){if(opts.nowrap){return false;}opts.nextSlide=0;}}}}var cb=opts.onPrevNextEvent||opts.prevNextClick;if($.isFunction(cb)){cb(val>0,opts.nextSlide,els[opts.nextSlide]);}go(els,opts,1,moveForward);return false;}function buildPager(els,opts){var $p=$(opts.pager);$.each(els,function(i,o){$.fn.cycle.createPagerAnchor(i,o,$p,els,opts);});opts.updateActivePagerLink(opts.pager,opts.startingSlide,opts.activePagerClass);}$.fn.cycle.createPagerAnchor=function(i,el,$p,els,opts){var a;if($.isFunction(opts.pagerAnchorBuilder)){a=opts.pagerAnchorBuilder(i,el);debug("pagerAnchorBuilder("+i+", el) returned: "+a);}else{a='<a href="#">'+(i+1)+"</a>";}if(!a){return;}var $a=$(a);if($a.parents("body").length===0){var arr=[];if($p.length>1){$p.each(function(){var $clone=$a.clone(true);$(this).append($clone);arr.push($clone[0]);});$a=$(arr);}else{$a.appendTo($p);}}opts.pagerAnchors=opts.pagerAnchors||[];opts.pagerAnchors.push($a);$a.bind(opts.pagerEvent,function(e){e.preventDefault();opts.nextSlide=i;var p=opts.$cont[0],timeout=p.cycleTimeout;if(timeout){clearTimeout(timeout);p.cycleTimeout=0;}var cb=opts.onPagerEvent||opts.pagerClick;if($.isFunction(cb)){cb(opts.nextSlide,els[opts.nextSlide]);}go(els,opts,1,opts.currSlide<i);});if(!/^click/.test(opts.pagerEvent)&&!opts.allowPagerClickBubble){$a.bind("click.cycle",function(){return false;});}if(opts.pauseOnPagerHover){$a.hover(function(){opts.$cont[0].cyclePause++;},function(){opts.$cont[0].cyclePause--;});}};$.fn.cycle.hopsFromLast=function(opts,fwd){var hops,l=opts.lastSlide,c=opts.currSlide;if(fwd){hops=c>l?c-l:opts.slideCount-l;}else{hops=c<l?l-c:l+opts.slideCount-c;}return hops;};function clearTypeFix($slides){debug("applying clearType background-color hack");function hex(s){s=parseInt(s).toString(16);return s.length<2?"0"+s:s;}function getBg(e){for(;e&&e.nodeName.toLowerCase()!="html";e=e.parentNode){var v=$.css(e,"background-color");if(v.indexOf("rgb")>=0){var rgb=v.match(/\d+/g);return"#"+hex(rgb[0])+hex(rgb[1])+hex(rgb[2]);}if(v&&v!="transparent"){return v;}}return"#ffffff";}$slides.each(function(){$(this).css("background-color",getBg(this));});}$.fn.cycle.commonReset=function(curr,next,opts,w,h,rev){$(opts.elements).not(curr).hide();opts.cssBefore.opacity=1;opts.cssBefore.display="block";if(opts.slideResize&&w!==false&&next.cycleW>0){opts.cssBefore.width=next.cycleW;}if(opts.slideResize&&h!==false&&next.cycleH>0){opts.cssBefore.height=next.cycleH;}opts.cssAfter=opts.cssAfter||{};opts.cssAfter.display="none";$(curr).css("zIndex",opts.slideCount+(rev===true?1:0));$(next).css("zIndex",opts.slideCount+(rev===true?0:1));};$.fn.cycle.custom=function(curr,next,opts,cb,fwd,speedOverride){var $l=$(curr),$n=$(next);var speedIn=opts.speedIn,speedOut=opts.speedOut,easeIn=opts.easeIn,easeOut=opts.easeOut;$n.css(opts.cssBefore);if(speedOverride){if(typeof speedOverride=="number"){speedIn=speedOut=speedOverride;}else{speedIn=speedOut=1;}easeIn=easeOut=null;}var fn=function(){$n.animate(opts.animIn,speedIn,easeIn,cb);};$l.animate(opts.animOut,speedOut,easeOut,function(){if(opts.cssAfter){$l.css(opts.cssAfter);}if(!opts.sync){fn();}});if(opts.sync){fn();}};$.fn.cycle.transitions={fade:function($cont,$slides,opts){$slides.not(":eq("+opts.currSlide+")").css("opacity",0);opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts);opts.cssBefore.opacity=0;});opts.animIn={opacity:1};opts.animOut={opacity:0};opts.cssBefore={top:0,left:0};}};$.fn.cycle.ver=function(){return ver;};$.fn.cycle.defaults={fx:"fade",timeout:4000,timeoutFn:null,continuous:0,speed:1000,speedIn:null,speedOut:null,next:null,prev:null,onPrevNextEvent:null,prevNextEvent:"click.cycle",pager:null,onPagerEvent:null,pagerEvent:"click.cycle",allowPagerClickBubble:false,pagerAnchorBuilder:null,before:null,after:null,end:null,easing:null,easeIn:null,easeOut:null,shuffle:null,animIn:null,animOut:null,cssBefore:null,cssAfter:null,fxFn:null,height:"auto",startingSlide:0,sync:1,random:0,fit:0,containerResize:1,slideResize:1,pause:0,pauseOnPagerHover:0,autostop:0,autostopCount:0,delay:0,slideExpr:null,cleartype:!$.support.opacity,cleartypeNoBg:false,nowrap:0,fastOnEvent:0,randomizeEffects:1,rev:0,manualTrump:true,requeueOnImageNotLoaded:true,requeueTimeout:250,activePagerClass:"activeSlide",updateActivePagerLink:null,backwards:false};})(jQuery);
    11 /*
     10;(function($) {
     11
     12var ver = '2.9995';
     13
     14// if $.support is not defined (pre jQuery 1.3) add what I need
     15if ($.support == undefined) {
     16    $.support = {
     17        opacity: !($.browser.msie)
     18    };
     19}
     20
     21function debug(s) {
     22    $.fn.cycle.debug && log(s);
     23}       
     24function log() {
     25    window.console && console.log && console.log('[cycle] ' + Array.prototype.join.call(arguments,' '));
     26}
     27$.expr[':'].paused = function(el) {
     28    return el.cyclePause;
     29}
     30
     31
     32// the options arg can be...
     33//   a number  - indicates an immediate transition should occur to the given slide index
     34//   a string  - 'pause', 'resume', 'toggle', 'next', 'prev', 'stop', 'destroy' or the name of a transition effect (ie, 'fade', 'zoom', etc)
     35//   an object - properties to control the slideshow
     36//
     37// the arg2 arg can be...
     38//   the name of an fx (only used in conjunction with a numeric value for 'options')
     39//   the value true (only used in first arg == 'resume') and indicates
     40//   that the resume should occur immediately (not wait for next timeout)
     41
     42$.fn.cycle = function(options, arg2) {
     43    var o = { s: this.selector, c: this.context };
     44
     45    // in 1.3+ we can fix mistakes with the ready state
     46    if (this.length === 0 && options != 'stop') {
     47        if (!$.isReady && o.s) {
     48            log('DOM not ready, queuing slideshow');
     49            $(function() {
     50                $(o.s,o.c).cycle(options,arg2);
     51            });
     52            return this;
     53        }
     54        // is your DOM ready?  http://docs.jquery.com/Tutorials:Introducing_$(document).ready()
     55        log('terminating; zero elements found by selector' + ($.isReady ? '' : ' (DOM not ready)'));
     56        return this;
     57    }
     58
     59    // iterate the matched nodeset
     60    return this.each(function() {
     61        var opts = handleArguments(this, options, arg2);
     62        if (opts === false)
     63            return;
     64
     65        opts.updateActivePagerLink = opts.updateActivePagerLink || $.fn.cycle.updateActivePagerLink;
     66       
     67        // stop existing slideshow for this container (if there is one)
     68        if (this.cycleTimeout)
     69            clearTimeout(this.cycleTimeout);
     70        this.cycleTimeout = this.cyclePause = 0;
     71
     72        var $cont = $(this);
     73        var $slides = opts.slideExpr ? $(opts.slideExpr, this) : $cont.children();
     74        var els = $slides.get();
     75
     76        var opts2 = buildOptions($cont, $slides, els, opts, o);
     77        if (opts2 === false)
     78            return;
     79
     80        if (els.length < 2) {
     81            log('terminating; too few slides: ' + els.length);
     82            return;
     83        }
     84
     85        var startTime = opts2.continuous ? 10 : getTimeout(els[opts2.currSlide], els[opts2.nextSlide], opts2, !opts2.backwards);
     86
     87        // if it's an auto slideshow, kick it off
     88        if (startTime) {
     89            startTime += (opts2.delay || 0);
     90            if (startTime < 10)
     91                startTime = 10;
     92            debug('first timeout: ' + startTime);
     93            this.cycleTimeout = setTimeout(function(){go(els,opts2,0,!opts.backwards)}, startTime);
     94        }
     95    });
     96};
     97
     98function triggerPause(cont, byHover, onPager) {
     99    var opts = $(cont).data('cycle.opts');
     100    var paused = !!cont.cyclePause;
     101    if (paused && opts.paused)
     102        opts.paused(cont, opts, byHover, onPager);
     103    else if (!paused && opts.resumed)
     104        opts.resumed(cont, opts, byHover, onPager);
     105}
     106
     107// process the args that were passed to the plugin fn
     108function handleArguments(cont, options, arg2) {
     109    if (cont.cycleStop == undefined)
     110        cont.cycleStop = 0;
     111    if (options === undefined || options === null)
     112        options = {};
     113    if (options.constructor == String) {
     114        switch(options) {
     115        case 'destroy':
     116        case 'stop':
     117            var opts = $(cont).data('cycle.opts');
     118            if (!opts)
     119                return false;
     120            cont.cycleStop++; // callbacks look for change
     121            if (cont.cycleTimeout)
     122                clearTimeout(cont.cycleTimeout);
     123            cont.cycleTimeout = 0;
     124            opts.elements && $(opts.elements).stop();
     125            $(cont).removeData('cycle.opts');
     126            if (options == 'destroy')
     127                destroy(opts);
     128            return false;
     129        case 'toggle':
     130            cont.cyclePause = (cont.cyclePause === 1) ? 0 : 1;
     131            checkInstantResume(cont.cyclePause, arg2, cont);
     132            triggerPause(cont);
     133            return false;
     134        case 'pause':
     135            cont.cyclePause = 1;
     136            triggerPause(cont);
     137            return false;
     138        case 'resume':
     139            cont.cyclePause = 0;
     140            checkInstantResume(false, arg2, cont);
     141            triggerPause(cont);
     142            return false;
     143        case 'prev':
     144        case 'next':
     145            var opts = $(cont).data('cycle.opts');
     146            if (!opts) {
     147                log('options not found, "prev/next" ignored');
     148                return false;
     149            }
     150            $.fn.cycle[options](opts);
     151            return false;
     152        default:
     153            options = { fx: options };
     154        };
     155        return options;
     156    }
     157    else if (options.constructor == Number) {
     158        // go to the requested slide
     159        var num = options;
     160        options = $(cont).data('cycle.opts');
     161        if (!options) {
     162            log('options not found, can not advance slide');
     163            return false;
     164        }
     165        if (num < 0 || num >= options.elements.length) {
     166            log('invalid slide index: ' + num);
     167            return false;
     168        }
     169        options.nextSlide = num;
     170        if (cont.cycleTimeout) {
     171            clearTimeout(cont.cycleTimeout);
     172            cont.cycleTimeout = 0;
     173        }
     174        if (typeof arg2 == 'string')
     175            options.oneTimeFx = arg2;
     176        go(options.elements, options, 1, num >= options.currSlide);
     177        return false;
     178    }
     179    return options;
     180   
     181    function checkInstantResume(isPaused, arg2, cont) {
     182        if (!isPaused && arg2 === true) { // resume now!
     183            var options = $(cont).data('cycle.opts');
     184            if (!options) {
     185                log('options not found, can not resume');
     186                return false;
     187            }
     188            if (cont.cycleTimeout) {
     189                clearTimeout(cont.cycleTimeout);
     190                cont.cycleTimeout = 0;
     191            }
     192            go(options.elements, options, 1, !options.backwards);
     193        }
     194    }
     195};
     196
     197function removeFilter(el, opts) {
     198    if (!$.support.opacity && opts.cleartype && el.style.filter) {
     199        try { el.style.removeAttribute('filter'); }
     200        catch(smother) {} // handle old opera versions
     201    }
     202};
     203
     204// unbind event handlers
     205function destroy(opts) {
     206    if (opts.next)
     207        $(opts.next).unbind(opts.prevNextEvent);
     208    if (opts.prev)
     209        $(opts.prev).unbind(opts.prevNextEvent);
     210   
     211    if (opts.pager || opts.pagerAnchorBuilder)
     212        $.each(opts.pagerAnchors || [], function() {
     213            this.unbind().remove();
     214        });
     215    opts.pagerAnchors = null;
     216    if (opts.destroy) // callback
     217        opts.destroy(opts);
     218};
     219
     220// one-time initialization
     221function buildOptions($cont, $slides, els, options, o) {
     222    // support metadata plugin (v1.0 and v2.0)
     223    var opts = $.extend({}, $.fn.cycle.defaults, options || {}, $.metadata ? $cont.metadata() : $.meta ? $cont.data() : {});
     224    var meta = $.isFunction($cont.data) ? $cont.data(opts.metaAttr) : null;
     225    if (meta)
     226        opts = $.extend(opts, meta);
     227    if (opts.autostop)
     228        opts.countdown = opts.autostopCount || els.length;
     229
     230    var cont = $cont[0];
     231    $cont.data('cycle.opts', opts);
     232    opts.$cont = $cont;
     233    opts.stopCount = cont.cycleStop;
     234    opts.elements = els;
     235    opts.before = opts.before ? [opts.before] : [];
     236    opts.after = opts.after ? [opts.after] : [];
     237
     238    // push some after callbacks
     239    if (!$.support.opacity && opts.cleartype)
     240        opts.after.push(function() { removeFilter(this, opts); });
     241    if (opts.continuous)
     242        opts.after.push(function() { go(els,opts,0,!opts.backwards); });
     243
     244    saveOriginalOpts(opts);
     245
     246    // clearType corrections
     247    if (!$.support.opacity && opts.cleartype && !opts.cleartypeNoBg)
     248        clearTypeFix($slides);
     249
     250    // container requires non-static position so that slides can be position within
     251    if ($cont.css('position') == 'static')
     252        $cont.css('position', 'relative');
     253    if (opts.width)
     254        $cont.width(opts.width);
     255    if (opts.height && opts.height != 'auto')
     256        $cont.height(opts.height);
     257
     258    if (opts.startingSlide)
     259        opts.startingSlide = parseInt(opts.startingSlide,10);
     260    else if (opts.backwards)
     261        opts.startingSlide = els.length - 1;
     262
     263    // if random, mix up the slide array
     264    if (opts.random) {
     265        opts.randomMap = [];
     266        for (var i = 0; i < els.length; i++)
     267            opts.randomMap.push(i);
     268        opts.randomMap.sort(function(a,b) {return Math.random() - 0.5;});
     269        opts.randomIndex = 1;
     270        opts.startingSlide = opts.randomMap[1];
     271    }
     272    else if (opts.startingSlide >= els.length)
     273        opts.startingSlide = 0; // catch bogus input
     274    opts.currSlide = opts.startingSlide || 0;
     275    var first = opts.startingSlide;
     276
     277    // set position and zIndex on all the slides
     278    $slides.css({position: 'absolute', top:0, left:0}).hide().each(function(i) {
     279        var z;
     280        if (opts.backwards)
     281            z = first ? i <= first ? els.length + (i-first) : first-i : els.length-i;
     282        else
     283            z = first ? i >= first ? els.length - (i-first) : first-i : els.length-i;
     284        $(this).css('z-index', z)
     285    });
     286
     287    // make sure first slide is visible
     288    $(els[first]).css('opacity',1).show(); // opacity bit needed to handle restart use case
     289    removeFilter(els[first], opts);
     290
     291    // stretch slides
     292    if (opts.fit) {
     293        if (!opts.aspect) {
     294            if (opts.width)
     295                $slides.width(opts.width);
     296            if (opts.height && opts.height != 'auto')
     297                $slides.height(opts.height);
     298        } else {
     299            $slides.each(function(){
     300                var $slide = $(this);
     301                var ratio = (opts.aspect === true) ? $slide.width()/$slide.height() : opts.aspect;
     302                if( opts.width && $slide.width() != opts.width ) {
     303                    $slide.width( opts.width );
     304                    $slide.height( opts.width / ratio );
     305                }
     306
     307                if( opts.height && $slide.height() < opts.height ) {
     308                    $slide.height( opts.height );
     309                    $slide.width( opts.height * ratio );
     310                }
     311            });
     312        }
     313    }
     314
     315    if (opts.center && ((!opts.fit) || opts.aspect)) {
     316        $slides.each(function(){
     317            var $slide = $(this);
     318            $slide.css({
     319                "margin-left": opts.width ?
     320                    ((opts.width - $slide.width()) / 2) + "px" :
     321                    0,
     322                "margin-top": opts.height ?
     323                    ((opts.height - $slide.height()) / 2) + "px" :
     324                    0
     325            });
     326        });
     327    }
     328
     329    if (opts.center && !opts.fit && !opts.slideResize) {
     330        $slides.each(function(){
     331            var $slide = $(this);
     332            $slide.css({
     333                "margin-left": opts.width ? ((opts.width - $slide.width()) / 2) + "px" : 0,
     334                "margin-top": opts.height ? ((opts.height - $slide.height()) / 2) + "px" : 0
     335            });
     336        });
     337    }
     338       
     339    // stretch container
     340    var reshape = opts.containerResize && !$cont.innerHeight();
     341    if (reshape) { // do this only if container has no size http://tinyurl.com/da2oa9
     342        var maxw = 0, maxh = 0;
     343        for(var j=0; j < els.length; j++) {
     344            var $e = $(els[j]), e = $e[0], w = $e.outerWidth(), h = $e.outerHeight();
     345            if (!w) w = e.offsetWidth || e.width || $e.attr('width');
     346            if (!h) h = e.offsetHeight || e.height || $e.attr('height');
     347            maxw = w > maxw ? w : maxw;
     348            maxh = h > maxh ? h : maxh;
     349        }
     350        if (maxw > 0 && maxh > 0)
     351            $cont.css({width:maxw+'px',height:maxh+'px'});
     352    }
     353
     354    var pauseFlag = false;  // https://github.com/malsup/cycle/issues/44
     355    if (opts.pause)
     356        $cont.hover(
     357            function(){
     358                pauseFlag = true;
     359                this.cyclePause++;
     360                triggerPause(cont, true);
     361            },
     362            function(){
     363                pauseFlag && this.cyclePause--;
     364                triggerPause(cont, true);
     365            }
     366        );
     367
     368    if (supportMultiTransitions(opts) === false)
     369        return false;
     370
     371    // apparently a lot of people use image slideshows without height/width attributes on the images.
     372    // Cycle 2.50+ requires the sizing info for every slide; this block tries to deal with that.
     373    var requeue = false;
     374    options.requeueAttempts = options.requeueAttempts || 0;
     375    $slides.each(function() {
     376        // try to get height/width of each slide
     377        var $el = $(this);
     378        this.cycleH = (opts.fit && opts.height) ? opts.height : ($el.height() || this.offsetHeight || this.height || $el.attr('height') || 0);
     379        this.cycleW = (opts.fit && opts.width) ? opts.width : ($el.width() || this.offsetWidth || this.width || $el.attr('width') || 0);
     380
     381        if ( $el.is('img') ) {
     382            // sigh..  sniffing, hacking, shrugging...  this crappy hack tries to account for what browsers do when
     383            // an image is being downloaded and the markup did not include sizing info (height/width attributes);
     384            // there seems to be some "default" sizes used in this situation
     385            var loadingIE   = ($.browser.msie  && this.cycleW == 28 && this.cycleH == 30 && !this.complete);
     386            var loadingFF   = ($.browser.mozilla && this.cycleW == 34 && this.cycleH == 19 && !this.complete);
     387            var loadingOp   = ($.browser.opera && ((this.cycleW == 42 && this.cycleH == 19) || (this.cycleW == 37 && this.cycleH == 17)) && !this.complete);
     388            var loadingOther = (this.cycleH == 0 && this.cycleW == 0 && !this.complete);
     389            // don't requeue for images that are still loading but have a valid size
     390            if (loadingIE || loadingFF || loadingOp || loadingOther) {
     391                if (o.s && opts.requeueOnImageNotLoaded && ++options.requeueAttempts < 100) { // track retry count so we don't loop forever
     392                    log(options.requeueAttempts,' - img slide not loaded, requeuing slideshow: ', this.src, this.cycleW, this.cycleH);
     393                    setTimeout(function() {$(o.s,o.c).cycle(options)}, opts.requeueTimeout);
     394                    requeue = true;
     395                    return false; // break each loop
     396                }
     397                else {
     398                    log('could not determine size of image: '+this.src, this.cycleW, this.cycleH);
     399                }
     400            }
     401        }
     402        return true;
     403    });
     404
     405    if (requeue)
     406        return false;
     407
     408    opts.cssBefore = opts.cssBefore || {};
     409    opts.cssAfter = opts.cssAfter || {};
     410    opts.cssFirst = opts.cssFirst || {};
     411    opts.animIn = opts.animIn || {};
     412    opts.animOut = opts.animOut || {};
     413
     414    $slides.not(':eq('+first+')').css(opts.cssBefore);
     415    $($slides[first]).css(opts.cssFirst);
     416
     417    if (opts.timeout) {
     418        opts.timeout = parseInt(opts.timeout,10);
     419        // ensure that timeout and speed settings are sane
     420        if (opts.speed.constructor == String)
     421            opts.speed = $.fx.speeds[opts.speed] || parseInt(opts.speed,10);
     422        if (!opts.sync)
     423            opts.speed = opts.speed / 2;
     424       
     425        var buffer = opts.fx == 'none' ? 0 : opts.fx == 'shuffle' ? 500 : 250;
     426        while((opts.timeout - opts.speed) < buffer) // sanitize timeout
     427            opts.timeout += opts.speed;
     428    }
     429    if (opts.easing)
     430        opts.easeIn = opts.easeOut = opts.easing;
     431    if (!opts.speedIn)
     432        opts.speedIn = opts.speed;
     433    if (!opts.speedOut)
     434        opts.speedOut = opts.speed;
     435
     436    opts.slideCount = els.length;
     437    opts.currSlide = opts.lastSlide = first;
     438    if (opts.random) {
     439        if (++opts.randomIndex == els.length)
     440            opts.randomIndex = 0;
     441        opts.nextSlide = opts.randomMap[opts.randomIndex];
     442    }
     443    else if (opts.backwards)
     444        opts.nextSlide = opts.startingSlide == 0 ? (els.length-1) : opts.startingSlide-1;
     445    else
     446        opts.nextSlide = opts.startingSlide >= (els.length-1) ? 0 : opts.startingSlide+1;
     447
     448    // run transition init fn
     449    if (!opts.multiFx) {
     450        var init = $.fn.cycle.transitions[opts.fx];
     451        if ($.isFunction(init))
     452            init($cont, $slides, opts);
     453        else if (opts.fx != 'custom' && !opts.multiFx) {
     454            log('unknown transition: ' + opts.fx,'; slideshow terminating');
     455            return false;
     456        }
     457    }
     458
     459    // fire artificial events
     460    var e0 = $slides[first];
     461    if (!opts.skipInitializationCallbacks) {
     462        if (opts.before.length)
     463            opts.before[0].apply(e0, [e0, e0, opts, true]);
     464        if (opts.after.length)
     465            opts.after[0].apply(e0, [e0, e0, opts, true]);
     466    }
     467    if (opts.next)
     468        $(opts.next).bind(opts.prevNextEvent,function(){return advance(opts,1)});
     469    if (opts.prev)
     470        $(opts.prev).bind(opts.prevNextEvent,function(){return advance(opts,0)});
     471    if (opts.pager || opts.pagerAnchorBuilder)
     472        buildPager(els,opts);
     473
     474    exposeAddSlide(opts, els);
     475
     476    return opts;
     477};
     478
     479// save off original opts so we can restore after clearing state
     480function saveOriginalOpts(opts) {
     481    opts.original = { before: [], after: [] };
     482    opts.original.cssBefore = $.extend({}, opts.cssBefore);
     483    opts.original.cssAfter  = $.extend({}, opts.cssAfter);
     484    opts.original.animIn    = $.extend({}, opts.animIn);
     485    opts.original.animOut   = $.extend({}, opts.animOut);
     486    $.each(opts.before, function() { opts.original.before.push(this); });
     487    $.each(opts.after,  function() { opts.original.after.push(this); });
     488};
     489
     490function supportMultiTransitions(opts) {
     491    var i, tx, txs = $.fn.cycle.transitions;
     492    // look for multiple effects
     493    if (opts.fx.indexOf(',') > 0) {
     494        opts.multiFx = true;
     495        opts.fxs = opts.fx.replace(/\s*/g,'').split(',');
     496        // discard any bogus effect names
     497        for (i=0; i < opts.fxs.length; i++) {
     498            var fx = opts.fxs[i];
     499            tx = txs[fx];
     500            if (!tx || !txs.hasOwnProperty(fx) || !$.isFunction(tx)) {
     501                log('discarding unknown transition: ',fx);
     502                opts.fxs.splice(i,1);
     503                i--;
     504            }
     505        }
     506        // if we have an empty list then we threw everything away!
     507        if (!opts.fxs.length) {
     508            log('No valid transitions named; slideshow terminating.');
     509            return false;
     510        }
     511    }
     512    else if (opts.fx == 'all') {  // auto-gen the list of transitions
     513        opts.multiFx = true;
     514        opts.fxs = [];
     515        for (p in txs) {
     516            tx = txs[p];
     517            if (txs.hasOwnProperty(p) && $.isFunction(tx))
     518                opts.fxs.push(p);
     519        }
     520    }
     521    if (opts.multiFx && opts.randomizeEffects) {
     522        // munge the fxs array to make effect selection random
     523        var r1 = Math.floor(Math.random() * 20) + 30;
     524        for (i = 0; i < r1; i++) {
     525            var r2 = Math.floor(Math.random() * opts.fxs.length);
     526            opts.fxs.push(opts.fxs.splice(r2,1)[0]);
     527        }
     528        debug('randomized fx sequence: ',opts.fxs);
     529    }
     530    return true;
     531};
     532
     533// provide a mechanism for adding slides after the slideshow has started
     534function exposeAddSlide(opts, els) {
     535    opts.addSlide = function(newSlide, prepend) {
     536        var $s = $(newSlide), s = $s[0];
     537        if (!opts.autostopCount)
     538            opts.countdown++;
     539        els[prepend?'unshift':'push'](s);
     540        if (opts.els)
     541            opts.els[prepend?'unshift':'push'](s); // shuffle needs this
     542        opts.slideCount = els.length;
     543
     544        $s.css('position','absolute');
     545        $s[prepend?'prependTo':'appendTo'](opts.$cont);
     546
     547        if (prepend) {
     548            opts.currSlide++;
     549            opts.nextSlide++;
     550        }
     551
     552        if (!$.support.opacity && opts.cleartype && !opts.cleartypeNoBg)
     553            clearTypeFix($s);
     554
     555        if (opts.fit && opts.width)
     556            $s.width(opts.width);
     557        if (opts.fit && opts.height && opts.height != 'auto')
     558            $s.height(opts.height);
     559        s.cycleH = (opts.fit && opts.height) ? opts.height : $s.height();
     560        s.cycleW = (opts.fit && opts.width) ? opts.width : $s.width();
     561
     562        $s.css(opts.cssBefore);
     563
     564        if (opts.pager || opts.pagerAnchorBuilder)
     565            $.fn.cycle.createPagerAnchor(els.length-1, s, $(opts.pager), els, opts);
     566
     567        if ($.isFunction(opts.onAddSlide))
     568            opts.onAddSlide($s);
     569        else
     570            $s.hide(); // default behavior
     571    };
     572}
     573
     574// reset internal state; we do this on every pass in order to support multiple effects
     575$.fn.cycle.resetState = function(opts, fx) {
     576    fx = fx || opts.fx;
     577    opts.before = []; opts.after = [];
     578    opts.cssBefore = $.extend({}, opts.original.cssBefore);
     579    opts.cssAfter  = $.extend({}, opts.original.cssAfter);
     580    opts.animIn = $.extend({}, opts.original.animIn);
     581    opts.animOut   = $.extend({}, opts.original.animOut);
     582    opts.fxFn = null;
     583    $.each(opts.original.before, function() { opts.before.push(this); });
     584    $.each(opts.original.after,  function() { opts.after.push(this); });
     585
     586    // re-init
     587    var init = $.fn.cycle.transitions[fx];
     588    if ($.isFunction(init))
     589        init(opts.$cont, $(opts.elements), opts);
     590};
     591
     592// this is the main engine fn, it handles the timeouts, callbacks and slide index mgmt
     593function go(els, opts, manual, fwd) {
     594    // opts.busy is true if we're in the middle of an animation
     595    if (manual && opts.busy && opts.manualTrump) {
     596        // let manual transitions requests trump active ones
     597        debug('manualTrump in go(), stopping active transition');
     598        $(els).stop(true,true);
     599        opts.busy = 0;
     600    }
     601    // don't begin another timeout-based transition if there is one active
     602    if (opts.busy) {
     603        debug('transition active, ignoring new tx request');
     604        return;
     605    }
     606
     607    var p = opts.$cont[0], curr = els[opts.currSlide], next = els[opts.nextSlide];
     608
     609    // stop cycling if we have an outstanding stop request
     610    if (p.cycleStop != opts.stopCount || p.cycleTimeout === 0 && !manual)
     611        return;
     612
     613    // check to see if we should stop cycling based on autostop options
     614    if (!manual && !p.cyclePause && !opts.bounce &&
     615        ((opts.autostop && (--opts.countdown <= 0)) ||
     616        (opts.nowrap && !opts.random && opts.nextSlide < opts.currSlide))) {
     617        if (opts.end)
     618            opts.end(opts);
     619        return;
     620    }
     621
     622    // if slideshow is paused, only transition on a manual trigger
     623    var changed = false;
     624    if ((manual || !p.cyclePause) && (opts.nextSlide != opts.currSlide)) {
     625        changed = true;
     626        var fx = opts.fx;
     627        // keep trying to get the slide size if we don't have it yet
     628        curr.cycleH = curr.cycleH || $(curr).height();
     629        curr.cycleW = curr.cycleW || $(curr).width();
     630        next.cycleH = next.cycleH || $(next).height();
     631        next.cycleW = next.cycleW || $(next).width();
     632
     633        // support multiple transition types
     634        if (opts.multiFx) {
     635            if (fwd && (opts.lastFx == undefined || ++opts.lastFx >= opts.fxs.length))
     636                opts.lastFx = 0;
     637            else if (!fwd && (opts.lastFx == undefined || --opts.lastFx < 0))
     638                opts.lastFx = opts.fxs.length - 1;
     639            fx = opts.fxs[opts.lastFx];
     640        }
     641
     642        // one-time fx overrides apply to:  $('div').cycle(3,'zoom');
     643        if (opts.oneTimeFx) {
     644            fx = opts.oneTimeFx;
     645            opts.oneTimeFx = null;
     646        }
     647
     648        $.fn.cycle.resetState(opts, fx);
     649
     650        // run the before callbacks
     651        if (opts.before.length)
     652            $.each(opts.before, function(i,o) {
     653                if (p.cycleStop != opts.stopCount) return;
     654                o.apply(next, [curr, next, opts, fwd]);
     655            });
     656
     657        // stage the after callacks
     658        var after = function() {
     659            opts.busy = 0;
     660            $.each(opts.after, function(i,o) {
     661                if (p.cycleStop != opts.stopCount) return;
     662                o.apply(next, [curr, next, opts, fwd]);
     663            });
     664        };
     665
     666        debug('tx firing('+fx+'); currSlide: ' + opts.currSlide + '; nextSlide: ' + opts.nextSlide);
     667       
     668        // get ready to perform the transition
     669        opts.busy = 1;
     670        if (opts.fxFn) // fx function provided?
     671            opts.fxFn(curr, next, opts, after, fwd, manual && opts.fastOnEvent);
     672        else if ($.isFunction($.fn.cycle[opts.fx])) // fx plugin ?
     673            $.fn.cycle[opts.fx](curr, next, opts, after, fwd, manual && opts.fastOnEvent);
     674        else
     675            $.fn.cycle.custom(curr, next, opts, after, fwd, manual && opts.fastOnEvent);
     676    }
     677
     678    if (changed || opts.nextSlide == opts.currSlide) {
     679        // calculate the next slide
     680        opts.lastSlide = opts.currSlide;
     681        if (opts.random) {
     682            opts.currSlide = opts.nextSlide;
     683            if (++opts.randomIndex == els.length)
     684                opts.randomIndex = 0;
     685            opts.nextSlide = opts.randomMap[opts.randomIndex];
     686            if (opts.nextSlide == opts.currSlide)
     687                opts.nextSlide = (opts.currSlide == opts.slideCount - 1) ? 0 : opts.currSlide + 1;
     688        }
     689        else if (opts.backwards) {
     690            var roll = (opts.nextSlide - 1) < 0;
     691            if (roll && opts.bounce) {
     692                opts.backwards = !opts.backwards;
     693                opts.nextSlide = 1;
     694                opts.currSlide = 0;
     695            }
     696            else {
     697                opts.nextSlide = roll ? (els.length-1) : opts.nextSlide-1;
     698                opts.currSlide = roll ? 0 : opts.nextSlide+1;
     699            }
     700        }
     701        else { // sequence
     702            var roll = (opts.nextSlide + 1) == els.length;
     703            if (roll && opts.bounce) {
     704                opts.backwards = !opts.backwards;
     705                opts.nextSlide = els.length-2;
     706                opts.currSlide = els.length-1;
     707            }
     708            else {
     709                opts.nextSlide = roll ? 0 : opts.nextSlide+1;
     710                opts.currSlide = roll ? els.length-1 : opts.nextSlide-1;
     711            }
     712        }
     713    }
     714    if (changed && opts.pager)
     715        opts.updateActivePagerLink(opts.pager, opts.currSlide, opts.activePagerClass);
     716   
     717    // stage the next transition
     718    var ms = 0;
     719    if (opts.timeout && !opts.continuous)
     720        ms = getTimeout(els[opts.currSlide], els[opts.nextSlide], opts, fwd);
     721    else if (opts.continuous && p.cyclePause) // continuous shows work off an after callback, not this timer logic
     722        ms = 10;
     723    if (ms > 0)
     724        p.cycleTimeout = setTimeout(function(){ go(els, opts, 0, !opts.backwards) }, ms);
     725};
     726
     727// invoked after transition
     728$.fn.cycle.updateActivePagerLink = function(pager, currSlide, clsName) {
     729   $(pager).each(function() {
     730       $(this).children().removeClass(clsName).eq(currSlide).addClass(clsName);
     731   });
     732};
     733
     734// calculate timeout value for current transition
     735function getTimeout(curr, next, opts, fwd) {
     736    if (opts.timeoutFn) {
     737        // call user provided calc fn
     738        var t = opts.timeoutFn.call(curr,curr,next,opts,fwd);
     739        while (opts.fx != 'none' && (t - opts.speed) < 250) // sanitize timeout
     740            t += opts.speed;
     741        debug('calculated timeout: ' + t + '; speed: ' + opts.speed);
     742        if (t !== false)
     743            return t;
     744    }
     745    return opts.timeout;
     746};
     747
     748// expose next/prev function, caller must pass in state
     749$.fn.cycle.next = function(opts) { advance(opts,1); };
     750$.fn.cycle.prev = function(opts) { advance(opts,0);};
     751
     752// advance slide forward or back
     753function advance(opts, moveForward) {
     754    var val = moveForward ? 1 : -1;
     755    var els = opts.elements;
     756    var p = opts.$cont[0], timeout = p.cycleTimeout;
     757    if (timeout) {
     758        clearTimeout(timeout);
     759        p.cycleTimeout = 0;
     760    }
     761    if (opts.random && val < 0) {
     762        // move back to the previously display slide
     763        opts.randomIndex--;
     764        if (--opts.randomIndex == -2)
     765            opts.randomIndex = els.length-2;
     766        else if (opts.randomIndex == -1)
     767            opts.randomIndex = els.length-1;
     768        opts.nextSlide = opts.randomMap[opts.randomIndex];
     769    }
     770    else if (opts.random) {
     771        opts.nextSlide = opts.randomMap[opts.randomIndex];
     772    }
     773    else {
     774        opts.nextSlide = opts.currSlide + val;
     775        if (opts.nextSlide < 0) {
     776            if (opts.nowrap) return false;
     777            opts.nextSlide = els.length - 1;
     778        }
     779        else if (opts.nextSlide >= els.length) {
     780            if (opts.nowrap) return false;
     781            opts.nextSlide = 0;
     782        }
     783    }
     784
     785    var cb = opts.onPrevNextEvent || opts.prevNextClick; // prevNextClick is deprecated
     786    if ($.isFunction(cb))
     787        cb(val > 0, opts.nextSlide, els[opts.nextSlide]);
     788    go(els, opts, 1, moveForward);
     789    return false;
     790};
     791
     792function buildPager(els, opts) {
     793    var $p = $(opts.pager);
     794    $.each(els, function(i,o) {
     795        $.fn.cycle.createPagerAnchor(i,o,$p,els,opts);
     796    });
     797    opts.updateActivePagerLink(opts.pager, opts.startingSlide, opts.activePagerClass);
     798};
     799
     800$.fn.cycle.createPagerAnchor = function(i, el, $p, els, opts) {
     801    var a;
     802    if ($.isFunction(opts.pagerAnchorBuilder)) {
     803        a = opts.pagerAnchorBuilder(i,el);
     804        debug('pagerAnchorBuilder('+i+', el) returned: ' + a);
     805    }
     806    else
     807        a = '<a href="#">'+(i+1)+'</a>';
     808       
     809    if (!a)
     810        return;
     811    var $a = $(a);
     812    // don't reparent if anchor is in the dom
     813    if ($a.parents('body').length === 0) {
     814        var arr = [];
     815        if ($p.length > 1) {
     816            $p.each(function() {
     817                var $clone = $a.clone(true);
     818                $(this).append($clone);
     819                arr.push($clone[0]);
     820            });
     821            $a = $(arr);
     822        }
     823        else {
     824            $a.appendTo($p);
     825        }
     826    }
     827
     828    opts.pagerAnchors =  opts.pagerAnchors || [];
     829    opts.pagerAnchors.push($a);
     830   
     831    var pagerFn = function(e) {
     832        e.preventDefault();
     833        opts.nextSlide = i;
     834        var p = opts.$cont[0], timeout = p.cycleTimeout;
     835        if (timeout) {
     836            clearTimeout(timeout);
     837            p.cycleTimeout = 0;
     838        }
     839        var cb = opts.onPagerEvent || opts.pagerClick; // pagerClick is deprecated
     840        if ($.isFunction(cb))
     841            cb(opts.nextSlide, els[opts.nextSlide]);
     842        go(els,opts,1,opts.currSlide < i); // trigger the trans
     843//      return false; // <== allow bubble
     844    }
     845   
     846    if ( /mouseenter|mouseover/i.test(opts.pagerEvent) ) {
     847        $a.hover(pagerFn, function(){/* no-op */} );
     848    }
     849    else {
     850        $a.bind(opts.pagerEvent, pagerFn);
     851    }
     852   
     853    if ( ! /^click/.test(opts.pagerEvent) && !opts.allowPagerClickBubble)
     854        $a.bind('click.cycle', function(){return false;}); // suppress click
     855   
     856    var cont = opts.$cont[0];
     857    var pauseFlag = false; // https://github.com/malsup/cycle/issues/44
     858    if (opts.pauseOnPagerHover) {
     859        $a.hover(
     860            function() {
     861                pauseFlag = true;
     862                cont.cyclePause++;
     863                triggerPause(cont,true,true);
     864            }, function() {
     865                pauseFlag && cont.cyclePause--;
     866                triggerPause(cont,true,true);
     867            }
     868        );
     869    }
     870};
     871
     872// helper fn to calculate the number of slides between the current and the next
     873$.fn.cycle.hopsFromLast = function(opts, fwd) {
     874    var hops, l = opts.lastSlide, c = opts.currSlide;
     875    if (fwd)
     876        hops = c > l ? c - l : opts.slideCount - l;
     877    else
     878        hops = c < l ? l - c : l + opts.slideCount - c;
     879    return hops;
     880};
     881
     882// fix clearType problems in ie6 by setting an explicit bg color
     883// (otherwise text slides look horrible during a fade transition)
     884function clearTypeFix($slides) {
     885    debug('applying clearType background-color hack');
     886    function hex(s) {
     887        s = parseInt(s,10).toString(16);
     888        return s.length < 2 ? '0'+s : s;
     889    };
     890    function getBg(e) {
     891        for ( ; e && e.nodeName.toLowerCase() != 'html'; e = e.parentNode) {
     892            var v = $.css(e,'background-color');
     893            if (v && v.indexOf('rgb') >= 0 ) {
     894                var rgb = v.match(/\d+/g);
     895                return '#'+ hex(rgb[0]) + hex(rgb[1]) + hex(rgb[2]);
     896            }
     897            if (v && v != 'transparent')
     898                return v;
     899        }
     900        return '#ffffff';
     901    };
     902    $slides.each(function() { $(this).css('background-color', getBg(this)); });
     903};
     904
     905// reset common props before the next transition
     906$.fn.cycle.commonReset = function(curr,next,opts,w,h,rev) {
     907    $(opts.elements).not(curr).hide();
     908    if (typeof opts.cssBefore.opacity == 'undefined')
     909        opts.cssBefore.opacity = 1;
     910    opts.cssBefore.display = 'block';
     911    if (opts.slideResize && w !== false && next.cycleW > 0)
     912        opts.cssBefore.width = next.cycleW;
     913    if (opts.slideResize && h !== false && next.cycleH > 0)
     914        opts.cssBefore.height = next.cycleH;
     915    opts.cssAfter = opts.cssAfter || {};
     916    opts.cssAfter.display = 'none';
     917    $(curr).css('zIndex',opts.slideCount + (rev === true ? 1 : 0));
     918    $(next).css('zIndex',opts.slideCount + (rev === true ? 0 : 1));
     919};
     920
     921// the actual fn for effecting a transition
     922$.fn.cycle.custom = function(curr, next, opts, cb, fwd, speedOverride) {
     923    var $l = $(curr), $n = $(next);
     924    var speedIn = opts.speedIn, speedOut = opts.speedOut, easeIn = opts.easeIn, easeOut = opts.easeOut;
     925    $n.css(opts.cssBefore);
     926    if (speedOverride) {
     927        if (typeof speedOverride == 'number')
     928            speedIn = speedOut = speedOverride;
     929        else
     930            speedIn = speedOut = 1;
     931        easeIn = easeOut = null;
     932    }
     933    var fn = function() {
     934        $n.animate(opts.animIn, speedIn, easeIn, function() {
     935            cb();
     936        });
     937    };
     938    $l.animate(opts.animOut, speedOut, easeOut, function() {
     939        $l.css(opts.cssAfter);
     940        if (!opts.sync)
     941            fn();
     942    });
     943    if (opts.sync) fn();
     944};
     945
     946// transition definitions - only fade is defined here, transition pack defines the rest
     947$.fn.cycle.transitions = {
     948    fade: function($cont, $slides, opts) {
     949        $slides.not(':eq('+opts.currSlide+')').css('opacity',0);
     950        opts.before.push(function(curr,next,opts) {
     951            $.fn.cycle.commonReset(curr,next,opts);
     952            opts.cssBefore.opacity = 0;
     953        });
     954        opts.animIn    = { opacity: 1 };
     955        opts.animOut   = { opacity: 0 };
     956        opts.cssBefore = { top: 0, left: 0 };
     957    }
     958};
     959
     960$.fn.cycle.ver = function() { return ver; };
     961
     962// override these globally if you like (they are all optional)
     963$.fn.cycle.defaults = {
     964    activePagerClass: 'activeSlide', // class name used for the active pager link
     965    after:         null,  // transition callback (scope set to element that was shown):  function(currSlideElement, nextSlideElement, options, forwardFlag)
     966    allowPagerClickBubble: false, // allows or prevents click event on pager anchors from bubbling
     967    animIn:        null,  // properties that define how the slide animates in
     968    animOut:       null,  // properties that define how the slide animates out
     969    aspect:        false,  // preserve aspect ratio during fit resizing, cropping if necessary (must be used with fit option)
     970    autostop:      0,     // true to end slideshow after X transitions (where X == slide count)
     971    autostopCount: 0,     // number of transitions (optionally used with autostop to define X)
     972    backwards:     false, // true to start slideshow at last slide and move backwards through the stack
     973    before:        null,  // transition callback (scope set to element to be shown):     function(currSlideElement, nextSlideElement, options, forwardFlag)
     974    center:        null,  // set to true to have cycle add top/left margin to each slide (use with width and height options)
     975    cleartype:     !$.support.opacity,  // true if clearType corrections should be applied (for IE)
     976    cleartypeNoBg: false, // set to true to disable extra cleartype fixing (leave false to force background color setting on slides)
     977    containerResize: 1,   // resize container to fit largest slide
     978    continuous:    0,     // true to start next transition immediately after current one completes
     979    cssAfter:      null,  // properties that defined the state of the slide after transitioning out
     980    cssBefore:     null,  // properties that define the initial state of the slide before transitioning in
     981    delay:         0,     // additional delay (in ms) for first transition (hint: can be negative)
     982    easeIn:        null,  // easing for "in" transition
     983    easeOut:       null,  // easing for "out" transition
     984    easing:        null,  // easing method for both in and out transitions
     985    end:           null,  // callback invoked when the slideshow terminates (use with autostop or nowrap options): function(options)
     986    fastOnEvent:   0,     // force fast transitions when triggered manually (via pager or prev/next); value == time in ms
     987    fit:           0,     // force slides to fit container
     988    fx:           'fade', // name of transition effect (or comma separated names, ex: 'fade,scrollUp,shuffle')
     989    fxFn:          null,  // function used to control the transition: function(currSlideElement, nextSlideElement, options, afterCalback, forwardFlag)
     990    height:       'auto', // container height (if the 'fit' option is true, the slides will be set to this height as well)
     991    manualTrump:   true,  // causes manual transition to stop an active transition instead of being ignored
     992    metaAttr:     'cycle',// data- attribute that holds the option data for the slideshow
     993    next:          null,  // element, jQuery object, or jQuery selector string for the element to use as event trigger for next slide
     994    nowrap:        0,     // true to prevent slideshow from wrapping
     995    onPagerEvent:  null,  // callback fn for pager events: function(zeroBasedSlideIndex, slideElement)
     996    onPrevNextEvent: null,// callback fn for prev/next events: function(isNext, zeroBasedSlideIndex, slideElement)
     997    pager:         null,  // element, jQuery object, or jQuery selector string for the element to use as pager container
     998    pagerAnchorBuilder: null, // callback fn for building anchor links:  function(index, DOMelement)
     999    pagerEvent:   'click.cycle', // name of event which drives the pager navigation
     1000    pause:         0,     // true to enable "pause on hover"
     1001    pauseOnPagerHover: 0, // true to pause when hovering over pager link
     1002    prev:          null,  // element, jQuery object, or jQuery selector string for the element to use as event trigger for previous slide
     1003    prevNextEvent:'click.cycle',// event which drives the manual transition to the previous or next slide
     1004    random:        0,     // true for random, false for sequence (not applicable to shuffle fx)
     1005    randomizeEffects: 1,  // valid when multiple effects are used; true to make the effect sequence random
     1006    requeueOnImageNotLoaded: true, // requeue the slideshow if any image slides are not yet loaded
     1007    requeueTimeout: 250,  // ms delay for requeue
     1008    rev:           0,     // causes animations to transition in reverse (for effects that support it such as scrollHorz/scrollVert/shuffle)
     1009    shuffle:       null,  // coords for shuffle animation, ex: { top:15, left: 200 }
     1010    skipInitializationCallbacks: false, // set to true to disable the first before/after callback that occurs prior to any transition
     1011    slideExpr:     null,  // expression for selecting slides (if something other than all children is required)
     1012    slideResize:   1,     // force slide width/height to fixed size before every transition
     1013    speed:         1000,  // speed of the transition (any valid fx speed value)
     1014    speedIn:       null,  // speed of the 'in' transition
     1015    speedOut:      null,  // speed of the 'out' transition
     1016    startingSlide: 0,     // zero-based index of the first slide to be displayed
     1017    sync:          1,     // true if in/out transitions should occur simultaneously
     1018    timeout:       4000,  // milliseconds between slide transitions (0 to disable auto advance)
     1019    timeoutFn:     null,  // callback for determining per-slide timeout value:  function(currSlideElement, nextSlideElement, options, forwardFlag)
     1020    updateActivePagerLink: null, // callback fn invoked to update the active pager link (adds/removes activePagerClass style)
     1021    width:         null   // container width (if the 'fit' option is true, the slides will be set to this width as well)
     1022};
     1023
     1024})(jQuery);
     1025
     1026
     1027/*!
    121028 * jQuery Cycle Plugin Transition Definitions
    131029 * This script is a plugin for the jQuery Cycle Plugin
     
    191035 * http://www.gnu.org/licenses/gpl.html
    201036 */
    21 (function($){$.fn.cycle.transitions.none=function($cont,$slides,opts){opts.fxFn=function(curr,next,opts,after){$(next).show();$(curr).hide();after();};};$.fn.cycle.transitions.fadeout=function($cont,$slides,opts){$slides.not(":eq("+opts.currSlide+")").css({display:"block",opacity:1});opts.before.push(function(curr,next,opts,w,h,rev){$(curr).css("zIndex",opts.slideCount+(!rev===true?1:0));$(next).css("zIndex",opts.slideCount+(!rev===true?0:1));});opts.animIn={opacity:1};opts.animOut={opacity:0};opts.cssBefore={opacity:1,display:"block"};opts.cssAfter={zIndex:0};};$.fn.cycle.transitions.scrollUp=function($cont,$slides,opts){$cont.css("overflow","hidden");opts.before.push($.fn.cycle.commonReset);var h=$cont.height();opts.cssBefore={top:h,left:0};opts.cssFirst={top:0};opts.animIn={top:0};opts.animOut={top:-h};};$.fn.cycle.transitions.scrollDown=function($cont,$slides,opts){$cont.css("overflow","hidden");opts.before.push($.fn.cycle.commonReset);var h=$cont.height();opts.cssFirst={top:0};opts.cssBefore={top:-h,left:0};opts.animIn={top:0};opts.animOut={top:h};};$.fn.cycle.transitions.scrollLeft=function($cont,$slides,opts){$cont.css("overflow","hidden");opts.before.push($.fn.cycle.commonReset);var w=$cont.width();opts.cssFirst={left:0};opts.cssBefore={left:w,top:0};opts.animIn={left:0};opts.animOut={left:0-w};};$.fn.cycle.transitions.scrollRight=function($cont,$slides,opts){$cont.css("overflow","hidden");opts.before.push($.fn.cycle.commonReset);var w=$cont.width();opts.cssFirst={left:0};opts.cssBefore={left:-w,top:0};opts.animIn={left:0};opts.animOut={left:w};};$.fn.cycle.transitions.scrollHorz=function($cont,$slides,opts){$cont.css("overflow","hidden").width();opts.before.push(function(curr,next,opts,fwd){if(opts.rev){fwd=!fwd;}$.fn.cycle.commonReset(curr,next,opts);opts.cssBefore.left=fwd?(next.cycleW-1):(1-next.cycleW);opts.animOut.left=fwd?-curr.cycleW:curr.cycleW;});opts.cssFirst={left:0};opts.cssBefore={top:0};opts.animIn={left:0};opts.animOut={top:0};};$.fn.cycle.transitions.scrollVert=function($cont,$slides,opts){$cont.css("overflow","hidden");opts.before.push(function(curr,next,opts,fwd){if(opts.rev){fwd=!fwd;}$.fn.cycle.commonReset(curr,next,opts);opts.cssBefore.top=fwd?(1-next.cycleH):(next.cycleH-1);opts.animOut.top=fwd?curr.cycleH:-curr.cycleH;});opts.cssFirst={top:0};opts.cssBefore={left:0};opts.animIn={top:0};opts.animOut={left:0};};$.fn.cycle.transitions.slideX=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$(opts.elements).not(curr).hide();$.fn.cycle.commonReset(curr,next,opts,false,true);opts.animIn.width=next.cycleW;});opts.cssBefore={left:0,top:0,width:0};opts.animIn={width:"show"};opts.animOut={width:0};};$.fn.cycle.transitions.slideY=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$(opts.elements).not(curr).hide();$.fn.cycle.commonReset(curr,next,opts,true,false);opts.animIn.height=next.cycleH;});opts.cssBefore={left:0,top:0,height:0};opts.animIn={height:"show"};opts.animOut={height:0};};$.fn.cycle.transitions.shuffle=function($cont,$slides,opts){var i,w=$cont.css("overflow","visible").width();$slides.css({left:0,top:0});opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,true,true,true);});if(!opts.speedAdjusted){opts.speed=opts.speed/2;opts.speedAdjusted=true;}opts.random=0;opts.shuffle=opts.shuffle||{left:-w,top:15};opts.els=[];for(i=0;i<$slides.length;i++){opts.els.push($slides[i]);}for(i=0;i<opts.currSlide;i++){opts.els.push(opts.els.shift());}opts.fxFn=function(curr,next,opts,cb,fwd){if(opts.rev){fwd=!fwd;}var $el=fwd?$(curr):$(next);$(next).css(opts.cssBefore);var count=opts.slideCount;$el.animate(opts.shuffle,opts.speedIn,opts.easeIn,function(){var hops=$.fn.cycle.hopsFromLast(opts,fwd);for(var k=0;k<hops;k++){fwd?opts.els.push(opts.els.shift()):opts.els.unshift(opts.els.pop());}if(fwd){for(var i=0,len=opts.els.length;i<len;i++){$(opts.els[i]).css("z-index",len-i+count);}}else{var z=$(curr).css("z-index");$el.css("z-index",parseInt(z)+1+count);}$el.animate({left:0,top:0},opts.speedOut,opts.easeOut,function(){$(fwd?this:curr).hide();if(cb){cb();}});});};opts.cssBefore={display:"block",opacity:1,top:0,left:0};};$.fn.cycle.transitions.turnUp=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,true,false);opts.cssBefore.top=next.cycleH;opts.animIn.height=next.cycleH;opts.animOut.width=next.cycleW;});opts.cssFirst={top:0};opts.cssBefore={left:0,height:0};opts.animIn={top:0};opts.animOut={height:0};};$.fn.cycle.transitions.turnDown=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,true,false);opts.animIn.height=next.cycleH;opts.animOut.top=curr.cycleH;});opts.cssFirst={top:0};opts.cssBefore={left:0,top:0,height:0};opts.animOut={height:0};};$.fn.cycle.transitions.turnLeft=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,false,true);opts.cssBefore.left=next.cycleW;opts.animIn.width=next.cycleW;});opts.cssBefore={top:0,width:0};opts.animIn={left:0};opts.animOut={width:0};};$.fn.cycle.transitions.turnRight=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,false,true);opts.animIn.width=next.cycleW;opts.animOut.left=curr.cycleW;});opts.cssBefore={top:0,left:0,width:0};opts.animIn={left:0};opts.animOut={width:0};};$.fn.cycle.transitions.zoom=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,false,false,true);opts.cssBefore.top=next.cycleH/2;opts.cssBefore.left=next.cycleW/2;opts.animIn={top:0,left:0,width:next.cycleW,height:next.cycleH};opts.animOut={width:0,height:0,top:curr.cycleH/2,left:curr.cycleW/2};});opts.cssFirst={top:0,left:0};opts.cssBefore={width:0,height:0};};$.fn.cycle.transitions.fadeZoom=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,false,false);opts.cssBefore.left=next.cycleW/2;opts.cssBefore.top=next.cycleH/2;opts.animIn={top:0,left:0,width:next.cycleW,height:next.cycleH};});opts.cssBefore={width:0,height:0};opts.animOut={opacity:0};};$.fn.cycle.transitions.blindX=function($cont,$slides,opts){var w=$cont.css("overflow","hidden").width();opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts);opts.animIn.width=next.cycleW;opts.animOut.left=curr.cycleW;});opts.cssBefore={left:w,top:0};opts.animIn={left:0};opts.animOut={left:w};};$.fn.cycle.transitions.blindY=function($cont,$slides,opts){var h=$cont.css("overflow","hidden").height();opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts);opts.animIn.height=next.cycleH;opts.animOut.top=curr.cycleH;});opts.cssBefore={top:h,left:0};opts.animIn={top:0};opts.animOut={top:h};};$.fn.cycle.transitions.blindZ=function($cont,$slides,opts){var h=$cont.css("overflow","hidden").height();var w=$cont.width();opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts);opts.animIn.height=next.cycleH;opts.animOut.top=curr.cycleH;});opts.cssBefore={top:h,left:w};opts.animIn={top:0,left:0};opts.animOut={top:h,left:w};};$.fn.cycle.transitions.growX=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,false,true);opts.cssBefore.left=this.cycleW/2;opts.animIn={left:0,width:this.cycleW};opts.animOut={left:0};});opts.cssBefore={width:0,top:0};};$.fn.cycle.transitions.growY=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,true,false);opts.cssBefore.top=this.cycleH/2;opts.animIn={top:0,height:this.cycleH};opts.animOut={top:0};});opts.cssBefore={height:0,left:0};};$.fn.cycle.transitions.curtainX=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,false,true,true);opts.cssBefore.left=next.cycleW/2;opts.animIn={left:0,width:this.cycleW};opts.animOut={left:curr.cycleW/2,width:0};});opts.cssBefore={top:0,width:0};};$.fn.cycle.transitions.curtainY=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,true,false,true);opts.cssBefore.top=next.cycleH/2;opts.animIn={top:0,height:next.cycleH};opts.animOut={top:curr.cycleH/2,height:0};});opts.cssBefore={left:0,height:0};};$.fn.cycle.transitions.cover=function($cont,$slides,opts){var d=opts.direction||"left";var w=$cont.css("overflow","hidden").width();var h=$cont.height();opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts);if(d=="right"){opts.cssBefore.left=-w;}else{if(d=="up"){opts.cssBefore.top=h;}else{if(d=="down"){opts.cssBefore.top=-h;}else{opts.cssBefore.left=w;}}}});opts.animIn={left:0,top:0};opts.animOut={opacity:1};opts.cssBefore={top:0,left:0};};$.fn.cycle.transitions.uncover=function($cont,$slides,opts){var d=opts.direction||"left";var w=$cont.css("overflow","hidden").width();var h=$cont.height();opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,true,true,true);if(d=="right"){opts.animOut.left=w;}else{if(d=="up"){opts.animOut.top=-h;}else{if(d=="down"){opts.animOut.top=h;}else{opts.animOut.left=-w;}}}});opts.animIn={left:0,top:0};opts.animOut={opacity:1};opts.cssBefore={top:0,left:0};};$.fn.cycle.transitions.toss=function($cont,$slides,opts){var w=$cont.css("overflow","visible").width();var h=$cont.height();opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,true,true,true);if(!opts.animOut.left&&!opts.animOut.top){opts.animOut={left:w*2,top:-h/2,opacity:0};}else{opts.animOut.opacity=0;}});opts.cssBefore={left:0,top:0};opts.animIn={left:0};};$.fn.cycle.transitions.wipe=function($cont,$slides,opts){var w=$cont.css("overflow","hidden").width();var h=$cont.height();opts.cssBefore=opts.cssBefore||{};var clip;if(opts.clip){if(/l2r/.test(opts.clip)){clip="rect(0px 0px "+h+"px 0px)";}else{if(/r2l/.test(opts.clip)){clip="rect(0px "+w+"px "+h+"px "+w+"px)";}else{if(/t2b/.test(opts.clip)){clip="rect(0px "+w+"px 0px 0px)";}else{if(/b2t/.test(opts.clip)){clip="rect("+h+"px "+w+"px "+h+"px 0px)";}else{if(/zoom/.test(opts.clip)){var top=parseInt(h/2);var left=parseInt(w/2);clip="rect("+top+"px "+left+"px "+top+"px "+left+"px)";}}}}}}opts.cssBefore.clip=opts.cssBefore.clip||clip||"rect(0px 0px 0px 0px)";var d=opts.cssBefore.clip.match(/(\d+)/g);var t=parseInt(d[0]),r=parseInt(d[1]),b=parseInt(d[2]),l=parseInt(d[3]);opts.before.push(function(curr,next,opts){if(curr==next){return;}var $curr=$(curr),$next=$(next);$.fn.cycle.commonReset(curr,next,opts,true,true,false);opts.cssAfter.display="block";var step=1,count=parseInt((opts.speedIn/13))-1;(function f(){var tt=t?t-parseInt(step*(t/count)):0;var ll=l?l-parseInt(step*(l/count)):0;var bb=b<h?b+parseInt(step*((h-b)/count||1)):h;var rr=r<w?r+parseInt(step*((w-r)/count||1)):w;$next.css({clip:"rect("+tt+"px "+rr+"px "+bb+"px "+ll+"px)"});(step++<=count)?setTimeout(f,13):$curr.css("display","none");})();});opts.cssBefore={display:"block",opacity:1,top:0,left:0};opts.animIn={left:0};opts.animOut={left:0};};})(jQuery);
     1037(function($) {
     1038
     1039//
     1040// These functions define slide initialization and properties for the named
     1041// transitions. To save file size feel free to remove any of these that you
     1042// don't need.
     1043//
     1044$.fn.cycle.transitions.none = function($cont, $slides, opts) {
     1045    opts.fxFn = function(curr,next,opts,after){
     1046        $(next).show();
     1047        $(curr).hide();
     1048        after();
     1049    };
     1050};
     1051
     1052// not a cross-fade, fadeout only fades out the top slide
     1053$.fn.cycle.transitions.fadeout = function($cont, $slides, opts) {
     1054    $slides.not(':eq('+opts.currSlide+')').css({ display: 'block', 'opacity': 1 });
     1055    opts.before.push(function(curr,next,opts,w,h,rev) {
     1056        $(curr).css('zIndex',opts.slideCount + (!rev === true ? 1 : 0));
     1057        $(next).css('zIndex',opts.slideCount + (!rev === true ? 0 : 1));
     1058    });
     1059    opts.animIn.opacity = 1;
     1060    opts.animOut.opacity = 0;
     1061    opts.cssBefore.opacity = 1;
     1062    opts.cssBefore.display = 'block';
     1063    opts.cssAfter.zIndex = 0;
     1064};
     1065
     1066// scrollUp/Down/Left/Right
     1067$.fn.cycle.transitions.scrollUp = function($cont, $slides, opts) {
     1068    $cont.css('overflow','hidden');
     1069    opts.before.push($.fn.cycle.commonReset);
     1070    var h = $cont.height();
     1071    opts.cssBefore.top = h;
     1072    opts.cssBefore.left = 0;
     1073    opts.cssFirst.top = 0;
     1074    opts.animIn.top = 0;
     1075    opts.animOut.top = -h;
     1076};
     1077$.fn.cycle.transitions.scrollDown = function($cont, $slides, opts) {
     1078    $cont.css('overflow','hidden');
     1079    opts.before.push($.fn.cycle.commonReset);
     1080    var h = $cont.height();
     1081    opts.cssFirst.top = 0;
     1082    opts.cssBefore.top = -h;
     1083    opts.cssBefore.left = 0;
     1084    opts.animIn.top = 0;
     1085    opts.animOut.top = h;
     1086};
     1087$.fn.cycle.transitions.scrollLeft = function($cont, $slides, opts) {
     1088    $cont.css('overflow','hidden');
     1089    opts.before.push($.fn.cycle.commonReset);
     1090    var w = $cont.width();
     1091    opts.cssFirst.left = 0;
     1092    opts.cssBefore.left = w;
     1093    opts.cssBefore.top = 0;
     1094    opts.animIn.left = 0;
     1095    opts.animOut.left = 0-w;
     1096};
     1097$.fn.cycle.transitions.scrollRight = function($cont, $slides, opts) {
     1098    $cont.css('overflow','hidden');
     1099    opts.before.push($.fn.cycle.commonReset);
     1100    var w = $cont.width();
     1101    opts.cssFirst.left = 0;
     1102    opts.cssBefore.left = -w;
     1103    opts.cssBefore.top = 0;
     1104    opts.animIn.left = 0;
     1105    opts.animOut.left = w;
     1106};
     1107$.fn.cycle.transitions.scrollHorz = function($cont, $slides, opts) {
     1108    $cont.css('overflow','hidden').width();
     1109    opts.before.push(function(curr, next, opts, fwd) {
     1110        if (opts.rev)
     1111            fwd = !fwd;
     1112        $.fn.cycle.commonReset(curr,next,opts);
     1113        opts.cssBefore.left = fwd ? (next.cycleW-1) : (1-next.cycleW);
     1114        opts.animOut.left = fwd ? -curr.cycleW : curr.cycleW;
     1115    });
     1116    opts.cssFirst.left = 0;
     1117    opts.cssBefore.top = 0;
     1118    opts.animIn.left = 0;
     1119    opts.animOut.top = 0;
     1120};
     1121$.fn.cycle.transitions.scrollVert = function($cont, $slides, opts) {
     1122    $cont.css('overflow','hidden');
     1123    opts.before.push(function(curr, next, opts, fwd) {
     1124        if (opts.rev)
     1125            fwd = !fwd;
     1126        $.fn.cycle.commonReset(curr,next,opts);
     1127        opts.cssBefore.top = fwd ? (1-next.cycleH) : (next.cycleH-1);
     1128        opts.animOut.top = fwd ? curr.cycleH : -curr.cycleH;
     1129    });
     1130    opts.cssFirst.top = 0;
     1131    opts.cssBefore.left = 0;
     1132    opts.animIn.top = 0;
     1133    opts.animOut.left = 0;
     1134};
     1135
     1136// slideX/slideY
     1137$.fn.cycle.transitions.slideX = function($cont, $slides, opts) {
     1138    opts.before.push(function(curr, next, opts) {
     1139        $(opts.elements).not(curr).hide();
     1140        $.fn.cycle.commonReset(curr,next,opts,false,true);
     1141        opts.animIn.width = next.cycleW;
     1142    });
     1143    opts.cssBefore.left = 0;
     1144    opts.cssBefore.top = 0;
     1145    opts.cssBefore.width = 0;
     1146    opts.animIn.width = 'show';
     1147    opts.animOut.width = 0;
     1148};
     1149$.fn.cycle.transitions.slideY = function($cont, $slides, opts) {
     1150    opts.before.push(function(curr, next, opts) {
     1151        $(opts.elements).not(curr).hide();
     1152        $.fn.cycle.commonReset(curr,next,opts,true,false);
     1153        opts.animIn.height = next.cycleH;
     1154    });
     1155    opts.cssBefore.left = 0;
     1156    opts.cssBefore.top = 0;
     1157    opts.cssBefore.height = 0;
     1158    opts.animIn.height = 'show';
     1159    opts.animOut.height = 0;
     1160};
     1161
     1162// shuffle
     1163$.fn.cycle.transitions.shuffle = function($cont, $slides, opts) {
     1164    var i, w = $cont.css('overflow', 'visible').width();
     1165    $slides.css({left: 0, top: 0});
     1166    opts.before.push(function(curr,next,opts) {
     1167        $.fn.cycle.commonReset(curr,next,opts,true,true,true);
     1168    });
     1169    // only adjust speed once!
     1170    if (!opts.speedAdjusted) {
     1171        opts.speed = opts.speed / 2; // shuffle has 2 transitions
     1172        opts.speedAdjusted = true;
     1173    }
     1174    opts.random = 0;
     1175    opts.shuffle = opts.shuffle || {left:-w, top:15};
     1176    opts.els = [];
     1177    for (i=0; i < $slides.length; i++)
     1178        opts.els.push($slides[i]);
     1179
     1180    for (i=0; i < opts.currSlide; i++)
     1181        opts.els.push(opts.els.shift());
     1182
     1183    // custom transition fn (hat tip to Benjamin Sterling for this bit of sweetness!)
     1184    opts.fxFn = function(curr, next, opts, cb, fwd) {
     1185        if (opts.rev)
     1186            fwd = !fwd;
     1187        var $el = fwd ? $(curr) : $(next);
     1188        $(next).css(opts.cssBefore);
     1189        var count = opts.slideCount;
     1190        $el.animate(opts.shuffle, opts.speedIn, opts.easeIn, function() {
     1191            var hops = $.fn.cycle.hopsFromLast(opts, fwd);
     1192            for (var k=0; k < hops; k++)
     1193                fwd ? opts.els.push(opts.els.shift()) : opts.els.unshift(opts.els.pop());
     1194            if (fwd) {
     1195                for (var i=0, len=opts.els.length; i < len; i++)
     1196                    $(opts.els[i]).css('z-index', len-i+count);
     1197            }
     1198            else {
     1199                var z = $(curr).css('z-index');
     1200                $el.css('z-index', parseInt(z,10)+1+count);
     1201            }
     1202            $el.animate({left:0, top:0}, opts.speedOut, opts.easeOut, function() {
     1203                $(fwd ? this : curr).hide();
     1204                if (cb) cb();
     1205            });
     1206        });
     1207    };
     1208    $.extend(opts.cssBefore, { display: 'block', opacity: 1, top: 0, left: 0 });
     1209};
     1210
     1211// turnUp/Down/Left/Right
     1212$.fn.cycle.transitions.turnUp = function($cont, $slides, opts) {
     1213    opts.before.push(function(curr, next, opts) {
     1214        $.fn.cycle.commonReset(curr,next,opts,true,false);
     1215        opts.cssBefore.top = next.cycleH;
     1216        opts.animIn.height = next.cycleH;
     1217        opts.animOut.width = next.cycleW;
     1218    });
     1219    opts.cssFirst.top = 0;
     1220    opts.cssBefore.left = 0;
     1221    opts.cssBefore.height = 0;
     1222    opts.animIn.top = 0;
     1223    opts.animOut.height = 0;
     1224};
     1225$.fn.cycle.transitions.turnDown = function($cont, $slides, opts) {
     1226    opts.before.push(function(curr, next, opts) {
     1227        $.fn.cycle.commonReset(curr,next,opts,true,false);
     1228        opts.animIn.height = next.cycleH;
     1229        opts.animOut.top   = curr.cycleH;
     1230    });
     1231    opts.cssFirst.top = 0;
     1232    opts.cssBefore.left = 0;
     1233    opts.cssBefore.top = 0;
     1234    opts.cssBefore.height = 0;
     1235    opts.animOut.height = 0;
     1236};
     1237$.fn.cycle.transitions.turnLeft = function($cont, $slides, opts) {
     1238    opts.before.push(function(curr, next, opts) {
     1239        $.fn.cycle.commonReset(curr,next,opts,false,true);
     1240        opts.cssBefore.left = next.cycleW;
     1241        opts.animIn.width = next.cycleW;
     1242    });
     1243    opts.cssBefore.top = 0;
     1244    opts.cssBefore.width = 0;
     1245    opts.animIn.left = 0;
     1246    opts.animOut.width = 0;
     1247};
     1248$.fn.cycle.transitions.turnRight = function($cont, $slides, opts) {
     1249    opts.before.push(function(curr, next, opts) {
     1250        $.fn.cycle.commonReset(curr,next,opts,false,true);
     1251        opts.animIn.width = next.cycleW;
     1252        opts.animOut.left = curr.cycleW;
     1253    });
     1254    $.extend(opts.cssBefore, { top: 0, left: 0, width: 0 });
     1255    opts.animIn.left = 0;
     1256    opts.animOut.width = 0;
     1257};
     1258
     1259// zoom
     1260$.fn.cycle.transitions.zoom = function($cont, $slides, opts) {
     1261    opts.before.push(function(curr, next, opts) {
     1262        $.fn.cycle.commonReset(curr,next,opts,false,false,true);
     1263        opts.cssBefore.top = next.cycleH/2;
     1264        opts.cssBefore.left = next.cycleW/2;
     1265        $.extend(opts.animIn, { top: 0, left: 0, width: next.cycleW, height: next.cycleH });
     1266        $.extend(opts.animOut, { width: 0, height: 0, top: curr.cycleH/2, left: curr.cycleW/2 });
     1267    });
     1268    opts.cssFirst.top = 0;
     1269    opts.cssFirst.left = 0;
     1270    opts.cssBefore.width = 0;
     1271    opts.cssBefore.height = 0;
     1272};
     1273
     1274// fadeZoom
     1275$.fn.cycle.transitions.fadeZoom = function($cont, $slides, opts) {
     1276    opts.before.push(function(curr, next, opts) {
     1277        $.fn.cycle.commonReset(curr,next,opts,false,false);
     1278        opts.cssBefore.left = next.cycleW/2;
     1279        opts.cssBefore.top = next.cycleH/2;
     1280        $.extend(opts.animIn, { top: 0, left: 0, width: next.cycleW, height: next.cycleH });
     1281    });
     1282    opts.cssBefore.width = 0;
     1283    opts.cssBefore.height = 0;
     1284    opts.animOut.opacity = 0;
     1285};
     1286
     1287// blindX
     1288$.fn.cycle.transitions.blindX = function($cont, $slides, opts) {
     1289    var w = $cont.css('overflow','hidden').width();
     1290    opts.before.push(function(curr, next, opts) {
     1291        $.fn.cycle.commonReset(curr,next,opts);
     1292        opts.animIn.width = next.cycleW;
     1293        opts.animOut.left   = curr.cycleW;
     1294    });
     1295    opts.cssBefore.left = w;
     1296    opts.cssBefore.top = 0;
     1297    opts.animIn.left = 0;
     1298    opts.animOut.left = w;
     1299};
     1300// blindY
     1301$.fn.cycle.transitions.blindY = function($cont, $slides, opts) {
     1302    var h = $cont.css('overflow','hidden').height();
     1303    opts.before.push(function(curr, next, opts) {
     1304        $.fn.cycle.commonReset(curr,next,opts);
     1305        opts.animIn.height = next.cycleH;
     1306        opts.animOut.top   = curr.cycleH;
     1307    });
     1308    opts.cssBefore.top = h;
     1309    opts.cssBefore.left = 0;
     1310    opts.animIn.top = 0;
     1311    opts.animOut.top = h;
     1312};
     1313// blindZ
     1314$.fn.cycle.transitions.blindZ = function($cont, $slides, opts) {
     1315    var h = $cont.css('overflow','hidden').height();
     1316    var w = $cont.width();
     1317    opts.before.push(function(curr, next, opts) {
     1318        $.fn.cycle.commonReset(curr,next,opts);
     1319        opts.animIn.height = next.cycleH;
     1320        opts.animOut.top   = curr.cycleH;
     1321    });
     1322    opts.cssBefore.top = h;
     1323    opts.cssBefore.left = w;
     1324    opts.animIn.top = 0;
     1325    opts.animIn.left = 0;
     1326    opts.animOut.top = h;
     1327    opts.animOut.left = w;
     1328};
     1329
     1330// growX - grow horizontally from centered 0 width
     1331$.fn.cycle.transitions.growX = function($cont, $slides, opts) {
     1332    opts.before.push(function(curr, next, opts) {
     1333        $.fn.cycle.commonReset(curr,next,opts,false,true);
     1334        opts.cssBefore.left = this.cycleW/2;
     1335        opts.animIn.left = 0;
     1336        opts.animIn.width = this.cycleW;
     1337        opts.animOut.left = 0;
     1338    });
     1339    opts.cssBefore.top = 0;
     1340    opts.cssBefore.width = 0;
     1341};
     1342// growY - grow vertically from centered 0 height
     1343$.fn.cycle.transitions.growY = function($cont, $slides, opts) {
     1344    opts.before.push(function(curr, next, opts) {
     1345        $.fn.cycle.commonReset(curr,next,opts,true,false);
     1346        opts.cssBefore.top = this.cycleH/2;
     1347        opts.animIn.top = 0;
     1348        opts.animIn.height = this.cycleH;
     1349        opts.animOut.top = 0;
     1350    });
     1351    opts.cssBefore.height = 0;
     1352    opts.cssBefore.left = 0;
     1353};
     1354
     1355// curtainX - squeeze in both edges horizontally
     1356$.fn.cycle.transitions.curtainX = function($cont, $slides, opts) {
     1357    opts.before.push(function(curr, next, opts) {
     1358        $.fn.cycle.commonReset(curr,next,opts,false,true,true);
     1359        opts.cssBefore.left = next.cycleW/2;
     1360        opts.animIn.left = 0;
     1361        opts.animIn.width = this.cycleW;
     1362        opts.animOut.left = curr.cycleW/2;
     1363        opts.animOut.width = 0;
     1364    });
     1365    opts.cssBefore.top = 0;
     1366    opts.cssBefore.width = 0;
     1367};
     1368// curtainY - squeeze in both edges vertically
     1369$.fn.cycle.transitions.curtainY = function($cont, $slides, opts) {
     1370    opts.before.push(function(curr, next, opts) {
     1371        $.fn.cycle.commonReset(curr,next,opts,true,false,true);
     1372        opts.cssBefore.top = next.cycleH/2;
     1373        opts.animIn.top = 0;
     1374        opts.animIn.height = next.cycleH;
     1375        opts.animOut.top = curr.cycleH/2;
     1376        opts.animOut.height = 0;
     1377    });
     1378    opts.cssBefore.height = 0;
     1379    opts.cssBefore.left = 0;
     1380};
     1381
     1382// cover - curr slide covered by next slide
     1383$.fn.cycle.transitions.cover = function($cont, $slides, opts) {
     1384    var d = opts.direction || 'left';
     1385    var w = $cont.css('overflow','hidden').width();
     1386    var h = $cont.height();
     1387    opts.before.push(function(curr, next, opts) {
     1388        $.fn.cycle.commonReset(curr,next,opts);
     1389        if (d == 'right')
     1390            opts.cssBefore.left = -w;
     1391        else if (d == 'up')
     1392            opts.cssBefore.top = h;
     1393        else if (d == 'down')
     1394            opts.cssBefore.top = -h;
     1395        else
     1396            opts.cssBefore.left = w;
     1397    });
     1398    opts.animIn.left = 0;
     1399    opts.animIn.top = 0;
     1400    opts.cssBefore.top = 0;
     1401    opts.cssBefore.left = 0;
     1402};
     1403
     1404// uncover - curr slide moves off next slide
     1405$.fn.cycle.transitions.uncover = function($cont, $slides, opts) {
     1406    var d = opts.direction || 'left';
     1407    var w = $cont.css('overflow','hidden').width();
     1408    var h = $cont.height();
     1409    opts.before.push(function(curr, next, opts) {
     1410        $.fn.cycle.commonReset(curr,next,opts,true,true,true);
     1411        if (d == 'right')
     1412            opts.animOut.left = w;
     1413        else if (d == 'up')
     1414            opts.animOut.top = -h;
     1415        else if (d == 'down')
     1416            opts.animOut.top = h;
     1417        else
     1418            opts.animOut.left = -w;
     1419    });
     1420    opts.animIn.left = 0;
     1421    opts.animIn.top = 0;
     1422    opts.cssBefore.top = 0;
     1423    opts.cssBefore.left = 0;
     1424};
     1425
     1426// toss - move top slide and fade away
     1427$.fn.cycle.transitions.toss = function($cont, $slides, opts) {
     1428    var w = $cont.css('overflow','visible').width();
     1429    var h = $cont.height();
     1430    opts.before.push(function(curr, next, opts) {
     1431        $.fn.cycle.commonReset(curr,next,opts,true,true,true);
     1432        // provide default toss settings if animOut not provided
     1433        if (!opts.animOut.left && !opts.animOut.top)
     1434            $.extend(opts.animOut, { left: w*2, top: -h/2, opacity: 0 });
     1435        else
     1436            opts.animOut.opacity = 0;
     1437    });
     1438    opts.cssBefore.left = 0;
     1439    opts.cssBefore.top = 0;
     1440    opts.animIn.left = 0;
     1441};
     1442
     1443// wipe - clip animation
     1444$.fn.cycle.transitions.wipe = function($cont, $slides, opts) {
     1445    var w = $cont.css('overflow','hidden').width();
     1446    var h = $cont.height();
     1447    opts.cssBefore = opts.cssBefore || {};
     1448    var clip;
     1449    if (opts.clip) {
     1450        if (/l2r/.test(opts.clip))
     1451            clip = 'rect(0px 0px '+h+'px 0px)';
     1452        else if (/r2l/.test(opts.clip))
     1453            clip = 'rect(0px '+w+'px '+h+'px '+w+'px)';
     1454        else if (/t2b/.test(opts.clip))
     1455            clip = 'rect(0px '+w+'px 0px 0px)';
     1456        else if (/b2t/.test(opts.clip))
     1457            clip = 'rect('+h+'px '+w+'px '+h+'px 0px)';
     1458        else if (/zoom/.test(opts.clip)) {
     1459            var top = parseInt(h/2,10);
     1460            var left = parseInt(w/2,10);
     1461            clip = 'rect('+top+'px '+left+'px '+top+'px '+left+'px)';
     1462        }
     1463    }
     1464
     1465    opts.cssBefore.clip = opts.cssBefore.clip || clip || 'rect(0px 0px 0px 0px)';
     1466
     1467    var d = opts.cssBefore.clip.match(/(\d+)/g);
     1468    var t = parseInt(d[0],10), r = parseInt(d[1],10), b = parseInt(d[2],10), l = parseInt(d[3],10);
     1469
     1470    opts.before.push(function(curr, next, opts) {
     1471        if (curr == next) return;
     1472        var $curr = $(curr), $next = $(next);
     1473        $.fn.cycle.commonReset(curr,next,opts,true,true,false);
     1474        opts.cssAfter.display = 'block';
     1475
     1476        var step = 1, count = parseInt((opts.speedIn / 13),10) - 1;
     1477        (function f() {
     1478            var tt = t ? t - parseInt(step * (t/count),10) : 0;
     1479            var ll = l ? l - parseInt(step * (l/count),10) : 0;
     1480            var bb = b < h ? b + parseInt(step * ((h-b)/count || 1),10) : h;
     1481            var rr = r < w ? r + parseInt(step * ((w-r)/count || 1),10) : w;
     1482            $next.css({ clip: 'rect('+tt+'px '+rr+'px '+bb+'px '+ll+'px)' });
     1483            (step++ <= count) ? setTimeout(f, 13) : $curr.css('display', 'none');
     1484        })();
     1485    });
     1486    $.extend(opts.cssBefore, { display: 'block', opacity: 1, top: 0, left: 0 });
     1487    opts.animIn    = { left: 0 };
     1488    opts.animOut   = { left: 0 };
     1489};
     1490
     1491})(jQuery);
  • sdac-post-slideshows/trunk/readme.txt

    r386382 r434828  
    33Contributors: jenz
    44Requires at least: 2.8
    5 Tested up to: 3.1
    6 Stable tag: 1.1.2
     5Tested up to: 3.2.1
     6Stable tag: 1.1.3
    77Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=4761649
    88
     
    4848
    4949== Changelog ==
     50= 1.1.3 =
     51* (September 7, 2011)
     52* Fixed an incorrect height setting
     53
    5054= 1.1.2 =
    5155* (May 18, 2011)
  • sdac-post-slideshows/trunk/sdac-post_slideshows.php

    r386382 r434828  
    66Author: Jennifer Zelazny/SDAC Inc.
    77Author URI: http://www.sandboxdev.com
    8 Version: 1.1.2
     8Version: 1.1.3
    99---------------------------------------------------
    1010Released under the GPL license
     
    365365        foreach ( $wp_query->posts as $post ) {
    366366            if ( preg_match("#\[post-slideshow[^\]]*\]#is", $post->post_content ) ) {
    367                 wp_enqueue_script( 'jquery' );
     367                wp_enqueue_script( 'jquery' );
    368368                wp_enqueue_script( 'jquery-cycle', plugins_url( 'js/jquery.cycle.min.js', __FILE__ ) );
    369369                add_action( 'wp_head', 'sdac_ps_wp_head' );
     
    378378    // Add in CSS Overrides (if any)
    379379    echo '
    380         <!-- Slideshow CSS -->
     380        <!-- Start Slideshow CSS -->
    381381        <style type="text/css">
    382382            .sdac_ps_nav {margin:10px 0 10px 0;}
     
    385385            .sdac_ps_nav a:focus {outline: none;}
    386386        </style>
     387        <!-- End Slideshow CSS -->
    387388        <script type="text/javascript">var sdac_post_slideshows = new Array();</script>
    388389        ';
     
    420421    // Add in JS for Cycle
    421422    $content .= '
    422         <!-- Slideshow JS -->
     423        <!-- Start Slideshow JS -->
    423424        <script type="text/javascript">
    424425            jQuery(document).ready(function($) {
     
    435436            });
    436437        </script>
     438        <!-- End Slideshow JS -->
    437439        ';
    438440    $returned_slideshow_js = true;
     
    492494            $slide_image_style .= 'width:300px;';
    493495        }
    494         if ( get_post_meta( $post_id, 'sdac_ps_image_width_override', true ) ) {
    495             $slide_image_style .= 'height:'.absint( get_post_meta( $post_id, 'sdac_ps_image_width_override', true ) ).'px;';
     496        if ( get_post_meta( $post_id, 'sdac_ps_image_height_override', true ) ) {
     497            $slide_image_style .= 'height:'.absint( get_post_meta( $post_id, 'sdac_ps_image_height_override', true ) ).'px;';
    496498        } else {
    497499            $slide_image_style .= 'height:300px;';
Note: See TracChangeset for help on using the changeset viewer.