Team:Marburg/Template:Header

From 2013.igem.org

(Difference between revisions)
m
Line 285: Line 285:
#header-navigation ul :hover ul :hover ul :hover ul ul {left:-9999px;}
#header-navigation ul :hover ul :hover ul :hover ul ul {left:-9999px;}
-
/*
+
#####
-
    these are just the default styles used in the Cycle2 demo pages. 
+
-
    you can use these styles or any others that you wish.
+
-
*/
+
 +
body { padding-bottom: 20px }
 +
#main { background: #fff; margin: auto; padding: 20px; max-width: 1200px }
 +
#main h1 { padding:0; margin-top: 20px }
 +
#main h2 { text-align: left }
 +
#header { background-color: #eee; font-weight: normal; margin:0; padding:10px; border-bottom: 1px solid #ddd }
 +
#logo { display: none }
-
/* set border-box so that percents can be used for width, padding, etc (personal preference) */
+
table { margin: auto; border-collapse: separate; border-spacing: 20px }
-
.cycle-slideshow, .cycle-slideshow * { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; }
+
td { vertical-align: top; text-align:center; width: 235px }
 +
hr { margin-top: 20px; }
 +
pre { text-align: left; overflow: visible }
 +
code { background-color: #ffc }
 +
pre code { background-color: #eee }
-
.cycle-slideshow { width: 45%; min-width: 200px; max-width: 500px; margin: 10px auto; padding: 0; position: relative;
+
.pics { height: 232px; width: 232px; padding:0; margin:0; overflow: hidden }
-
    background: url(http://malsup.github.com/images/spinner.gif) 50% 50% no-repeat;
+
.pics img { height: 200px; width: 200px; padding: 15px; border: 1px solid #ccc; background-color: #eee; top:0; left:0 }
-
 
+
.pics img {
-
}
+
-moz-border-radius: 10px; -webkit-border-radius: 10px;
-
 
+
-
/* slideshow images (for most of the demos, these are the actual "slides") */
+
-
.cycle-slideshow img {  
+
-
    /*
+
-
    some of these styles will be set by the plugin (by default) but setting them here
+
-
    helps avoid flash-of-unstyled-content
+
-
    */
+
-
    position: absolute; top: 0; left: 0;
+
-
    width: 100%; padding: 0; display: block;
+
}
}
 +
#s6 { width: 300px; height: 230px; border: 1px solid #ddd; background-color: #eee; }
 +
#s6 div { width: 270px; height: 200px; padding: 15px; color: #333; text-align: left; font-size: 16px; }
 +
#s6 div img { float: left; margin: 0 10px 10px 0; width: 100px; height: 100px; padding: 3px; background: #fff }
-
/* in case script does not load */
+
#s7 { width: 230px; height: 230px; border: 1px solid #ddd; background-color: #eee; }
-
.cycle-slideshow img:first-child {
+
#s7 div { width: 200px; height: 200px; padding: 15px; color: #333; text-align: left; font-size: 16px; overflow: hidden }
-
    position: static; z-index: 100;
+
-
}
+
-
/* pager */
+
#s6 div, #s7 div { top: 0; left: 0 }
-
.cycle-pager {
+
#big { width: 500px; text-align: left }
-
    text-align: center; width: 100%; z-index: 500; position: absolute; top: 10px; overflow: hidden;
+
-
}
+
-
.cycle-pager span {
+
-
    font-family: arial; font-size: 50px; width: 16px; height: 16px;
+
-
    display: inline-block; color: #ddd; cursor: pointer;
+
-
}
+
-
.cycle-pager span.cycle-pager-active { color: #D69746;}
+
-
.cycle-pager > * { cursor: pointer;}
+
-
 
+
-
 
+
-
/* caption */
+
-
.cycle-caption { position: absolute; color: white; bottom: 15px; right: 15px; z-index: 700; }
+
-
 
+
-
 
+
-
/* overlay */
+
-
.cycle-overlay {
+
-
    font-family: tahoma, arial;
+
-
    position: absolute; bottom: 0; width: 100%; z-index: 600;
+
-
    background: black; color: white; padding: 15px; opacity: .5;
+
-
}
+
-
 
+
-
 
+
-
/* prev / next links */
+
-
.cycle-prev, .cycle-next { position: absolute; top: 0; width: 30%; opacity: 0; filter: alpha(opacity=0); z-index: 800; height: 100%; cursor: pointer; }
+
-
.cycle-prev { left: 0;  background: url(http://malsup.github.com/images/left.png) 50% 50% no-repeat;}
+
-
.cycle-next { right: 0; background: url(http://malsup.github.com/images/right.png) 50% 50% no-repeat;}
+
-
.cycle-prev:hover, .cycle-next:hover { opacity: .7; filter: alpha(opacity=70) }
+
-
 
+
-
.disabled { opacity: .5; filter:alpha(opacity=50); }
+
-
 
+
-
 
+
-
/* display paused text on top of paused slideshow */
+
-
.cycle-paused:after {
+
-
    content: 'Paused'; color: white; background: black; padding: 10px;
+
-
    z-index: 500; position: absolute; top: 10px; right: 10px;
+
-
    border-radius: 10px;
+
-
    opacity: .5; filter: alpha(opacity=50);
+
-
}
+
-
 
+
-
/*
+
-
    media queries
+
-
    some style overrides to make things more pleasant on mobile devices
+
-
*/
+
-
 
+
-
@media only screen and (max-width: 480px), only screen and (max-device-width: 480px) {
+
-
    .cycle-slideshow { width: 200px;}
+
-
    .cycle-overlay { padding: 4px }
+
-
    .cycle-caption { bottom: 4px; right: 4px }
+
-
}
+
 +
td a { margin: 5px }
 +
.nav { margin: 5px 0 }
 +
#nav a, #s7 strong { margin: 0 5px; padding: 3px 5px; border: 1px solid #ccc; background: #fc0; text-decoration: none }
 +
#nav a.activeSlide { background: #ea0 }
 +
#nav a:focus { outline: none; }
 +
#output { text-align: left; }
</style>
</style>
<script>
<script>
-
/*
+
/*!
-
* jQuery Cycle2; build: v20130909
+
* jQuery Cycle Plugin (with Transition Definitions)
-
* http://jquery.malsup.com/cycle2/
+
* Examples and documentation at: http://jquery.malsup.com/cycle/
-
* Copyright (c) 2013 M. Alsup; Dual licensed: MIT/GPL
+
* Copyright (c) 2007-2013 M. Alsup
-
*/
+
* Version: 3.0.3 (11-JUL-2013)
-
 
+
* Dual licensed under the MIT and GPL licenses.
-
/*! core engine; version: 20130909 */
+
* http://jquery.malsup.com/license.html
-
;(function($) {
+
* Requires: jQuery v1.7.1 or later
 +
*/
 +
;(function($, undefined) {
"use strict";
"use strict";
-
var version = '20130725';
+
var ver = '3.0.3';
-
$.fn.cycle = function( options ) {
+
function debug(s) {
-
    // fix mistakes with the ready state
+
if ($.fn.cycle.debug)
-
    var o;
+
log(s);
-
    if ( this.length === 0 && !$.isReady ) {
+
}
-
        o = { s: this.selector, c: this.context };
+
function log() {
-
        $.fn.cycle.log('requeuing slideshow (dom not ready)');
+
/*global console */
-
        $(function() {
+
if (window.console && console.log)
-
            $( o.s, o.c ).cycle(options);
+
console.log('[cycle] ' + Array.prototype.join.call(arguments,' '));
-
        });
+
}
-
        return this;
+
$.expr[':'].paused = function(el) {
-
    }
+
return el.cyclePause;
 +
};
-
    return this.each(function() {
 
-
        var data, opts, shortName, val;
 
-
        var container = $(this);
 
-
        var log = $.fn.cycle.log;
 
-
        if ( container.data('cycle.opts') )
+
// the options arg can be...
-
            return; // already initialized
+
//  a number  - indicates an immediate transition should occur to the given slide index
 +
//  a string  - 'pause', 'resume', 'toggle', 'next', 'prev', 'stop', 'destroy' or the name of a transition effect (ie, 'fade', 'zoom', etc)
 +
//  an object - properties to control the slideshow
 +
//
 +
// the arg2 arg can be...
 +
//  the name of an fx (only used in conjunction with a numeric value for 'options')
 +
//  the value true (only used in first arg == 'resume') and indicates
 +
// that the resume should occur immediately (not wait for next timeout)
-
        if ( container.data('cycle-log') === false ||
+
$.fn.cycle = function(options, arg2) {
-
            ( options && options.log === false ) ||
+
var o = { s: this.selector, c: this.context };
-
            ( opts && opts.log === false) ) {
+
-
            log = $.noop;
+
-
        }
+
-
        log('--c2 init--');
+
// in 1.3+ we can fix mistakes with the ready state
-
        data = container.data();
+
if (this.length === 0 && options != 'stop') {
-
        for (var p in data) {
+
if (!$.isReady && o.s) {
-
            // allow props to be accessed sans 'cycle' prefix and log the overrides
+
log('DOM not ready, queuing slideshow');
-
            if (data.hasOwnProperty(p) && /^cycle[A-Z]+/.test(p) ) {
+
$(function() {
-
                val = data[p];
+
$(o.s,o.c).cycle(options,arg2);
-
                shortName = p.match(/^cycle(.*)/)[1].replace(/^[A-Z]/, lowerCase);
+
});
-
                log(shortName+':', val, '('+typeof val +')');
+
return this;
-
                data[shortName] = val;
+
}
-
            }
+
// is your DOM ready?  http://docs.jquery.com/Tutorials:Introducing_$(document).ready()
-
        }
+
log('terminating; zero elements found by selector' + ($.isReady ? '' : ' (DOM not ready)'));
 +
return this;
 +
}
-
        opts = $.extend( {}, $.fn.cycle.defaults, data, options || {});
+
// iterate the matched nodeset
 +
return this.each(function() {
 +
var opts = handleArguments(this, options, arg2);
 +
if (opts === false)
 +
return;
-
        opts.timeoutId = 0;
+
opts.updateActivePagerLink = opts.updateActivePagerLink || $.fn.cycle.updateActivePagerLink;
-
        opts.paused = opts.paused || false; // #57
+
-
        opts.container = container;
+
// stop existing slideshow for this container (if there is one)
-
        opts._maxZ = opts.maxZ;
+
if (this.cycleTimeout)
 +
clearTimeout(this.cycleTimeout);
 +
this.cycleTimeout = this.cyclePause = 0;
 +
this.cycleStop = 0; // issue #108
-
        opts.API = $.extend ( { _container: container }, $.fn.cycle.API );
+
var $cont = $(this);
-
        opts.API.log = log;
+
var $slides = opts.slideExpr ? $(opts.slideExpr, this) : $cont.children();
-
        opts.API.trigger = function( eventName, args ) {
+
var els = $slides.get();
-
            opts.container.trigger( eventName, args );
+
-
            return opts.API;
+
-
        };
+
-
        container.data( 'cycle.opts', opts );
+
if (els.length < 2) {
-
        container.data( 'cycle.API', opts.API );
+
log('terminating; too few slides: ' + els.length);
 +
return;
 +
}
-
        // opportunity for plugins to modify opts and API
+
var opts2 = buildOptions($cont, $slides, els, opts, o);
-
        opts.API.trigger('cycle-bootstrap', [ opts, opts.API ]);
+
if (opts2 === false)
 +
return;
-
        opts.API.addInitialSlides();
+
var startTime = opts2.continuous ? 10 : getTimeout(els[opts2.currSlide], els[opts2.nextSlide], opts2, !opts2.backwards);
-
        opts.API.preInitSlideshow();
+
-
        if ( opts.slides.length )
+
// if it's an auto slideshow, kick it off
-
            opts.API.initSlideshow();
+
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);
 +
}
 +
});
};
};
-
$.fn.cycle.API = {
+
function triggerPause(cont, byHover, onPager) {
-
    opts: function() {
+
var opts = $(cont).data('cycle.opts');
-
        return this._container.data( 'cycle.opts' );
+
if (!opts)
-
    },
+
return;
-
    addInitialSlides: function() {
+
var paused = !!cont.cyclePause;
-
        var opts = this.opts();
+
if (paused && opts.paused)
-
        var slides = opts.slides;
+
opts.paused(cont, opts, byHover, onPager);
-
        opts.slideCount = 0;
+
else if (!paused && opts.resumed)
-
        opts.slides = $(); // empty set
+
opts.resumed(cont, opts, byHover, onPager);
-
       
+
}
-
        // add slides that already exist
+
-
        slides = slides.jquery ? slides : opts.container.find( slides );
+
-
        if ( opts.random ) {
+
// process the args that were passed to the plugin fn
-
            slides.sort(function() {return Math.random() - 0.5;});
+
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++; // callbacks look for change
 +
if (cont.cycleTimeout)
 +
clearTimeout(cont.cycleTimeout);
 +
cont.cycleTimeout = 0;
 +
if (opts.elements)
 +
$(opts.elements).stop();
 +
$(cont).removeData('cycle.opts');
 +
if (options == 'destroy')
 +
destroy(cont, opts);
 +
return false;
 +
case 'toggle':
 +
cont.cyclePause = (cont.cyclePause === 1) ? 0 : 1;
 +
checkInstantResume(cont.cyclePause, arg2, cont);
 +
triggerPause(cont);
 +
return false;
 +
case 'pause':
 +
cont.cyclePause = 1;
 +
triggerPause(cont);
 +
return false;
 +
case 'resume':
 +
cont.cyclePause = 0;
 +
checkInstantResume(false, arg2, cont);
 +
triggerPause(cont);
 +
return false;
 +
case 'prev':
 +
case 'next':
 +
opts = $(cont).data('cycle.opts');
 +
if (!opts) {
 +
log('options not found, "prev/next" ignored');
 +
return false;
 +
}
 +
if (typeof arg2 == 'string')
 +
opts.oneTimeFx = arg2;
 +
$.fn.cycle[options](opts);
 +
return false;
 +
default:
 +
options = { fx: options };
 +
}
 +
return options;
 +
}
 +
else if (options.constructor == Number) {
 +
// go to the requested slide
 +
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) { // resume now!
 +
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);
 +
}
 +
}
 +
}
-
        opts.API.add( slides );
+
function removeFilter(el, opts) {
-
    },
+
if (!$.support.opacity && opts.cleartype && el.style.filter) {
 +
try { el.style.removeAttribute('filter'); }
 +
catch(smother) {} // handle old opera versions
 +
}
 +
}
-
    preInitSlideshow: function() {
+
// unbind event handlers
-
        var opts = this.opts();
+
function destroy(cont, opts) {
-
        opts.API.trigger('cycle-pre-initialize', [ opts ]);
+
if (opts.next)
-
        var tx = $.fn.cycle.transitions[opts.fx];
+
$(opts.next).unbind(opts.prevNextEvent);
-
        if (tx && $.isFunction(tx.preInit))
+
if (opts.prev)
-
            tx.preInit( opts );
+
$(opts.prev).unbind(opts.prevNextEvent);
-
        opts._preInitialized = true;
+
-
    },
+
if (opts.pager || opts.pagerAnchorBuilder)
 +
$.each(opts.pagerAnchors || [], function() {
 +
this.unbind().remove();
 +
});
 +
opts.pagerAnchors = null;
 +
$(cont).unbind('mouseenter.cycle mouseleave.cycle');
 +
if (opts.destroy) // callback
 +
opts.destroy(opts);
 +
}
-
    postInitSlideshow: function() {
+
// one-time initialization
-
        var opts = this.opts();
+
function buildOptions($cont, $slides, els, options, o) {
-
        opts.API.trigger('cycle-post-initialize', [ opts ]);
+
var startingSlideSpecified;
-
        var tx = $.fn.cycle.transitions[opts.fx];
+
// support metadata plugin (v1.0 and v2.0)
-
        if (tx && $.isFunction(tx.postInit))
+
var opts = $.extend({}, $.fn.cycle.defaults, options || {}, $.metadata ? $cont.metadata() : $.meta ? $cont.data() : {});
-
            tx.postInit( opts );
+
var meta = $.isFunction($cont.data) ? $cont.data(opts.metaAttr) : null;
-
    },
+
if (meta)
 +
opts = $.extend(opts, meta);
 +
if (opts.autostop)
 +
opts.countdown = opts.autostopCount || els.length;
-
    initSlideshow: function() {
+
var cont = $cont[0];
-
        var opts = this.opts();
+
$cont.data('cycle.opts', opts);
-
        var pauseObj = opts.container;
+
opts.$cont = $cont;
-
        var slideOpts;
+
opts.stopCount = cont.cycleStop;
-
        opts.API.calcFirstSlide();
+
opts.elements = els;
 +
opts.before = opts.before ? [opts.before] : [];
 +
opts.after = opts.after ? [opts.after] : [];
-
        if ( opts.container.css('position') == 'static' )
+
// push some after callbacks
-
            opts.container.css('position', 'relative');
+
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); });
-
        $(opts.slides[opts.currSlide]).css('opacity',1).show();
+
saveOriginalOpts(opts);
-
        opts.API.stackSlides( opts.slides[opts.currSlide], opts.slides[opts.nextSlide], !opts.reverse );
+
-
        if ( opts.pauseOnHover ) {
+
// clearType corrections
-
            // allow pauseOnHover to specify an element
+
if (!$.support.opacity && opts.cleartype && !opts.cleartypeNoBg)
-
            if ( opts.pauseOnHover !== true )
+
clearTypeFix($slides);
-
                pauseObj = $( opts.pauseOnHover );
+
-
            pauseObj.hover(
+
// container requires non-static position so that slides can be position within
-
                function(){ opts.API.pause( true ); },
+
if ($cont.css('position') == 'static')
-
                function(){ opts.API.resume( true ); }
+
$cont.css('position', 'relative');
-
            );
+
if (opts.width)
-
        }
+
$cont.width(opts.width);
 +
if (opts.height && opts.height != 'auto')
 +
$cont.height(opts.height);
-
        // stage initial transition
+
if (opts.startingSlide !== undefined) {
-
        if ( opts.timeout ) {
+
opts.startingSlide = parseInt(opts.startingSlide,10);
-
            slideOpts = opts.API.getSlideOpts( opts.nextSlide );
+
if (opts.startingSlide >= els.length || opts.startSlide < 0)
-
            opts.API.queueTransition( slideOpts, slideOpts.timeout + opts.delay );
+
opts.startingSlide = 0; // catch bogus input
-
        }
+
else
 +
startingSlideSpecified = true;
 +
}
 +
else if (opts.backwards)
 +
opts.startingSlide = els.length - 1;
 +
else
 +
opts.startingSlide = 0;
-
        opts._initialized = true;
+
// if random, mix up the slide array
-
        opts.API.updateView( true );
+
if (opts.random) {
-
        opts.API.trigger('cycle-initialized', [ opts ]);
+
opts.randomMap = [];
-
        opts.API.postInitSlideshow();
+
for (var i = 0; i < els.length; i++)
-
    },
+
opts.randomMap.push(i);
 +
opts.randomMap.sort(function(a,b) {return Math.random() - 0.5;});
 +
if (startingSlideSpecified) {
 +
// try to find the specified starting slide and if found set start slide index in the map accordingly
 +
for ( var cnt = 0; cnt < els.length; cnt++ ) {
 +
if ( opts.startingSlide == opts.randomMap[cnt] ) {
 +
opts.randomIndex = cnt;
 +
}
 +
}
 +
}
 +
else {
 +
opts.randomIndex = 1;
 +
opts.startingSlide = opts.randomMap[1];
 +
}
 +
}
 +
else if (opts.startingSlide >= els.length)
 +
opts.startingSlide = 0; // catch bogus input
 +
opts.currSlide = opts.startingSlide || 0;
 +
var first = opts.startingSlide;
-
    pause: function( hover ) {
+
// set position and zIndex on all the slides
-
        var opts = this.opts(),
+
$slides.css({position: 'absolute', top:0, left:0}).hide().each(function(i) {
-
            slideOpts = opts.API.getSlideOpts(),
+
var z;
-
            alreadyPaused = opts.hoverPaused || opts.paused;
+
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);
 +
});
-
        if ( hover )
+
// make sure first slide is visible
-
            opts.hoverPaused = true;  
+
$(els[first]).css('opacity',1).show(); // opacity bit needed to handle restart use case
-
        else
+
removeFilter(els[first], opts);
-
            opts.paused = true;
+
-
        if ( ! alreadyPaused ) {
+
// stretch slides
-
            opts.container.addClass('cycle-paused');
+
if (opts.fit) {
-
            opts.API.trigger('cycle-paused', [ opts ]).log('cycle-paused');
+
if (!opts.aspect) {
 +
        if (opts.width)
 +
            $slides.width(opts.width);
 +
        if (opts.height && opts.height != 'auto')
 +
            $slides.height(opts.height);
 +
} else {
 +
$slides.each(function(){
 +
var $slide = $(this);
 +
var ratio = (opts.aspect === true) ? $slide.width()/$slide.height() : opts.aspect;
 +
if( opts.width && $slide.width() != opts.width ) {
 +
$slide.width( opts.width );
 +
$slide.height( opts.width / ratio );
 +
}
-
            if ( slideOpts.timeout ) {
+
if( opts.height && $slide.height() < opts.height ) {
-
                clearTimeout( opts.timeoutId );
+
$slide.height( opts.height );
-
                opts.timeoutId = 0;
+
$slide.width( opts.height * ratio );
-
               
+
}
-
                // determine how much time is left for the current slide
+
});
-
                opts._remainingTimeout -= ( $.now() - opts._lastQueue );
+
}
-
                if ( opts._remainingTimeout < 0 || isNaN(opts._remainingTimeout) )
+
}
-
                    opts._remainingTimeout = undefined;
+
-
            }
+
-
        }
+
-
    },
+
-
    resume: function( hover ) {
+
if (opts.center && ((!opts.fit) || opts.aspect)) {
-
        var opts = this.opts(),
+
$slides.each(function(){
-
            alreadyResumed = !opts.hoverPaused && !opts.paused,
+
var $slide = $(this);
-
            remaining;
+
$slide.css({
 +
"margin-left": opts.width ?
 +
((opts.width - $slide.width()) / 2) + "px" :
 +
0,
 +
"margin-top": opts.height ?
 +
((opts.height - $slide.height()) / 2) + "px" :
 +
0
 +
});
 +
});
 +
}
-
        if ( hover )
+
if (opts.center && !opts.fit && !opts.slideResize) {
-
            opts.hoverPaused = false;  
+
$slides.each(function(){
-
        else
+
var $slide = $(this);
-
            opts.paused = false;
+
$slide.css({
 +
"margin-left": opts.width ? ((opts.width - $slide.width()) / 2) + "px" : 0,
 +
"margin-top": opts.height ? ((opts.height - $slide.height()) / 2) + "px" : 0
 +
});
 +
});
 +
}
 +
 +
// stretch container
 +
var reshape = (opts.containerResize || opts.containerResizeHeight) && $cont.innerHeight() < 1;
 +
if (reshape) { // do this only if container has no size http://tinyurl.com/da2oa9
 +
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 (opts.containerResize && maxw > 0 && maxh > 0)
 +
$cont.css({width:maxw+'px',height:maxh+'px'});
 +
if (opts.containerResizeHeight && maxh > 0)
 +
$cont.css({height:maxh+'px'});
 +
}
-
   
+
var pauseFlag = false; // https://github.com/malsup/cycle/issues/44
-
        if ( ! alreadyResumed ) {
+
if (opts.pause)
-
            opts.container.removeClass('cycle-paused');
+
$cont.bind('mouseenter.cycle', function(){
-
            // #gh-230; if an animation is in progress then don't queue a new transition; it will
+
pauseFlag = true;
-
            // happen naturally
+
this.cyclePause++;
-
            if ( opts.slides.filter(':animated').length === 0 )
+
triggerPause(cont, true);
-
                opts.API.queueTransition( opts.API.getSlideOpts(), opts._remainingTimeout );
+
}).bind('mouseleave.cycle', function(){
-
            opts.API.trigger('cycle-resumed', [ opts, opts._remainingTimeout ] ).log('cycle-resumed');
+
if (pauseFlag)
-
        }
+
this.cyclePause--;
-
    },
+
triggerPause(cont, true);
 +
});
-
    add: function( slides, prepend ) {
+
if (supportMultiTransitions(opts) === false)
-
        var opts = this.opts();
+
return false;
-
        var oldSlideCount = opts.slideCount;
+
-
        var startSlideshow = false;
+
-
        var len;
+
-
        if ( $.type(slides) == 'string')
+
// apparently a lot of people use image slideshows without height/width attributes on the images.
-
            slides = $.trim( slides );
+
// Cycle 2.50+ requires the sizing info for every slide; this block tries to deal with that.
 +
var requeue = false;
 +
options.requeueAttempts = options.requeueAttempts || 0;
 +
$slides.each(function() {
 +
// try to get height/width of each slide
 +
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);
-
        $( slides ).each(function(i) {
+
if ( $el.is('img') ) {
-
            var slideOpts;
+
var loading = (this.cycleH === 0 && this.cycleW === 0 && !this.complete);
-
            var slide = $(this);
+
// don't requeue for images that are still loading but have a valid size
 +
if (loading) {
 +
if (o.s && opts.requeueOnImageNotLoaded && ++options.requeueAttempts < 100) { // track retry count so we don't loop forever
 +
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; // break each loop
 +
}
 +
else {
 +
log('could not determine size of image: '+this.src, this.cycleW, this.cycleH);
 +
}
 +
}
 +
}
 +
return true;
 +
});
-
            if ( prepend )
+
if (requeue)
-
                opts.container.prepend( slide );
+
return false;
-
            else
+
-
                opts.container.append( slide );
+
-
            opts.slideCount++;
+
opts.cssBefore = opts.cssBefore || {};
-
            slideOpts = opts.API.buildSlideOpts( slide );
+
opts.cssAfter = opts.cssAfter || {};
 +
opts.cssFirst = opts.cssFirst || {};
 +
opts.animIn = opts.animIn || {};
 +
opts.animOut = opts.animOut || {};
-
            if ( prepend )
+
$slides.not(':eq('+first+')').css(opts.cssBefore);
-
                opts.slides = $( slide ).add( opts.slides );
+
$($slides[first]).css(opts.cssFirst);
-
            else
+
-
                opts.slides = opts.slides.add( slide );
+
-
            opts.API.initSlide( slideOpts, slide, --opts._maxZ );
+
if (opts.timeout) {
 +
opts.timeout = parseInt(opts.timeout,10);
 +
// ensure that timeout and speed settings are sane
 +
if (opts.speed.constructor == String)
 +
opts.speed = $.fx.speeds[opts.speed] || parseInt(opts.speed,10);
 +
if (!opts.sync)
 +
opts.speed = opts.speed / 2;
 +
 +
var buffer = opts.fx == 'none' ? 0 : opts.fx == 'shuffle' ? 500 : 250;
 +
while((opts.timeout - opts.speed) < buffer) // sanitize timeout
 +
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;
-
            slide.data('cycle.opts', slideOpts);
+
opts.slideCount = els.length;
-
            opts.API.trigger('cycle-slide-added', [ opts, slideOpts, slide ]);
+
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;
-
        opts.API.updateView( true );
+
// run transition init fn
 +
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;
 +
}
 +
}
-
        startSlideshow = opts._preInitialized && (oldSlideCount < 2 && opts.slideCount >= 1);
+
// fire artificial events
-
        if ( startSlideshow ) {
+
var e0 = $slides[first];
-
            if ( !opts._initialized )
+
if (!opts.skipInitializationCallbacks) {
-
                opts.API.initSlideshow();
+
if (opts.before.length)
-
            else if ( opts.timeout ) {
+
opts.before[0].apply(e0, [e0, e0, opts, true]);
-
                len = opts.slides.length;
+
if (opts.after.length)
-
                opts.nextSlide = opts.reverse ? len - 1 : 1;
+
opts.after[0].apply(e0, [e0, e0, opts, true]);
-
                if ( !opts.timeoutId ) {
+
}
-
                    opts.API.queueTransition( opts );
+
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);
-
    calcFirstSlide: function() {
+
exposeAddSlide(opts, els);
-
        var opts = this.opts();
+
-
        var firstSlideIndex;
+
-
        firstSlideIndex = parseInt( opts.startingSlide || 0, 10 );
+
-
        if (firstSlideIndex >= opts.slides.length || firstSlideIndex < 0)
+
-
            firstSlideIndex = 0;
+
-
        opts.currSlide = firstSlideIndex;
+
return opts;
-
        if ( opts.reverse ) {
+
}
-
            opts.nextSlide = firstSlideIndex - 1;
+
-
            if (opts.nextSlide < 0)
+
-
                opts.nextSlide = opts.slides.length - 1;
+
-
        }
+
-
        else {
+
-
            opts.nextSlide = firstSlideIndex + 1;
+
-
            if (opts.nextSlide == opts.slides.length)
+
-
                opts.nextSlide = 0;
+
-
        }
+
-
    },
+
-
    calcNextSlide: function() {
+
// save off original opts so we can restore after clearing state
-
        var opts = this.opts();
+
function saveOriginalOpts(opts) {
-
        var roll;
+
opts.original = { before: [], after: [] };
-
        if ( opts.reverse ) {
+
opts.original.cssBefore = $.extend({}, opts.cssBefore);
-
            roll = (opts.nextSlide - 1) < 0;
+
opts.original.cssAfter  = $.extend({}, opts.cssAfter);
-
            opts.nextSlide = roll ? opts.slideCount - 1 : opts.nextSlide-1;
+
opts.original.animIn = $.extend({}, opts.animIn);
-
            opts.currSlide = roll ? 0 : opts.nextSlide+1;
+
opts.original.animOut  = $.extend({}, opts.animOut);
-
        }
+
$.each(opts.before, function() { opts.original.before.push(this); });
-
        else {
+
$.each(opts.after,  function() { opts.original.after.push(this); });
-
            roll = (opts.nextSlide + 1) == opts.slides.length;
+
}
-
            opts.nextSlide = roll ? 0 : opts.nextSlide+1;
+
-
            opts.currSlide = roll ? opts.slides.length-1 : opts.nextSlide-1;
+
-
        }
+
-
    },
+
-
    calcTx: function( slideOpts, manual ) {
+
function supportMultiTransitions(opts) {
-
        var opts = slideOpts;
+
var i, tx, txs = $.fn.cycle.transitions;
-
        var tx;
+
// look for multiple effects
-
        if ( manual && opts.manualFx )
+
if (opts.fx.indexOf(',') > 0) {
-
            tx = $.fn.cycle.transitions[opts.manualFx];
+
opts.multiFx = true;
-
        if ( !tx )
+
opts.fxs = opts.fx.replace(/\s*/g,'').split(',');
-
            tx = $.fn.cycle.transitions[opts.fx];
+
// discard any bogus effect names
 +
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 we have an empty list then we threw everything away!
 +
if (!opts.fxs.length) {
 +
log('No valid transitions named; slideshow terminating.');
 +
return false;
 +
}
 +
}
 +
else if (opts.fx == 'all') {  // auto-gen the list of transitions
 +
opts.multiFx = true;
 +
opts.fxs = [];
 +
for (var p in txs) {
 +
if (txs.hasOwnProperty(p)) {
 +
tx = txs[p];
 +
if (txs.hasOwnProperty(p) && $.isFunction(tx))
 +
opts.fxs.push(p);
 +
}
 +
}
 +
}
 +
if (opts.multiFx && opts.randomizeEffects) {
 +
// munge the fxs array to make effect selection random
 +
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;
 +
}
-
        if (!tx) {
+
// provide a mechanism for adding slides after the slideshow has started
-
            tx = $.fn.cycle.transitions.fade;
+
function exposeAddSlide(opts, els) {
-
            opts.API.log('Transition "' + opts.fx + '" not found.  Using fade.');
+
opts.addSlide = function(newSlide, prepend) {
-
        }
+
var $s = $(newSlide), s = $s[0];
-
        return tx;
+
if (!opts.autostopCount)
-
    },
+
opts.countdown++;
 +
els[prepend?'unshift':'push'](s);
 +
if (opts.els)
 +
opts.els[prepend?'unshift':'push'](s); // shuffle needs this
 +
opts.slideCount = els.length;
-
    prepareTx: function( manual, fwd ) {
+
// add the slide to the random map and resort
-
        var opts = this.opts();
+
if (opts.random) {
-
        var after, curr, next, slideOpts, tx;
+
opts.randomMap.push(opts.slideCount-1);
 +
opts.randomMap.sort(function(a,b) {return Math.random() - 0.5;});
 +
}
-
        if ( opts.slideCount < 2 ) {
+
$s.css('position','absolute');
-
            opts.timeoutId = 0;
+
$s[prepend?'prependTo':'appendTo'](opts.$cont);
-
            return;
+
-
        }
+
-
        if ( manual && ( !opts.busy || opts.manualTrump ) ) {
+
-
            opts.API.stopTransition();
+
-
            opts.busy = false;
+
-
            clearTimeout(opts.timeoutId);
+
-
            opts.timeoutId = 0;
+
-
        }
+
-
        if ( opts.busy )
+
-
            return;
+
-
        if ( opts.timeoutId === 0 && !manual )
+
-
            return;
+
-
        curr = opts.slides[opts.currSlide];
+
if (prepend) {
-
        next = opts.slides[opts.nextSlide];
+
opts.currSlide++;
-
        slideOpts = opts.API.getSlideOpts( opts.nextSlide );
+
opts.nextSlide++;
-
        tx = opts.API.calcTx( slideOpts, manual );
+
}
-
        opts._tx = tx;
+
if (!$.support.opacity && opts.cleartype && !opts.cleartypeNoBg)
 +
clearTypeFix($s);
-
        if ( manual && slideOpts.manualSpeed !== undefined )
+
if (opts.fit && opts.width)
-
            slideOpts.speed = slideOpts.manualSpeed;
+
$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();
-
        // if ( opts.nextSlide === opts.currSlide )
+
$s.css(opts.cssBefore);
-
        //    opts.API.calcNextSlide();
+
-
        // ensure that:
+
if (opts.pager || opts.pagerAnchorBuilder)
-
        //      1. advancing to a different slide
+
$.fn.cycle.createPagerAnchor(els.length-1, s, $(opts.pager), els, opts);
-
        //      2. this is either a manual event (prev/next, pager, cmd) or
+
-
        //              a timer event and slideshow is not paused
+
-
        if ( opts.nextSlide != opts.currSlide &&
+
-
            (manual || (!opts.paused && !opts.hoverPaused && opts.timeout) )) { // #62
+
-
            opts.API.trigger('cycle-before', [ slideOpts, curr, next, fwd ]);
+
if ($.isFunction(opts.onAddSlide))
-
            if ( tx.before )
+
opts.onAddSlide($s);
-
                tx.before( slideOpts, curr, next, fwd );
+
else
 +
$s.hide(); // default behavior
 +
};
 +
}
-
            after = function() {
+
// reset internal state; we do this on every pass in order to support multiple effects
-
                opts.busy = false;
+
$.fn.cycle.resetState = function(opts, fx) {
-
                // #76; bail if slideshow has been destroyed
+
fx = fx || opts.fx;
-
                if (! opts.container.data( 'cycle.opts' ) )
+
opts.before = []; opts.after = [];
-
                    return;
+
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); });
-
                if (tx.after)
+
// re-init
-
                    tx.after( slideOpts, curr, next, fwd );
+
var init = $.fn.cycle.transitions[fx];
-
                opts.API.trigger('cycle-after', [ slideOpts, curr, next, fwd ]);
+
if ($.isFunction(init))
-
                opts.API.queueTransition( slideOpts);
+
init(opts.$cont, $(opts.elements), opts);
-
                opts.API.updateView( true );
+
};
-
            };
+
-
            opts.busy = true;
+
// this is the main engine fn, it handles the timeouts, callbacks and slide index mgmt
-
            if (tx.transition)
+
function go(els, opts, manual, fwd) {
-
                tx.transition(slideOpts, curr, next, fwd, after);
+
var p = opts.$cont[0], curr = els[opts.currSlide], next = els[opts.nextSlide];
-
            else
+
-
                opts.API.doTransition( slideOpts, curr, next, fwd, after);
+
-
            opts.API.calcNextSlide();
+
// opts.busy is true if we're in the middle of an animation
-
            opts.API.updateView();
+
if (manual && opts.busy && opts.manualTrump) {
-
        } else {
+
// let manual transitions requests trump active ones
-
            opts.API.queueTransition( slideOpts );
+
debug('manualTrump in go(), stopping active transition');
-
        }
+
$(els).stop(true,true);
-
    },
+
opts.busy = 0;
 +
clearTimeout(p.cycleTimeout);
 +
}
-
    // perform the actual animation
+
// don't begin another timeout-based transition if there is one active
-
    doTransition: function( slideOpts, currEl, nextEl, fwd, callback) {
+
if (opts.busy) {
-
        var opts = slideOpts;
+
debug('transition active, ignoring new tx request');
-
        var curr = $(currEl), next = $(nextEl);
+
return;
-
        var fn = function() {
+
}
-
            // make sure animIn has something so that callback doesn't trigger immediately
+
-
            next.animate(opts.animIn || { opacity: 1}, opts.speed, opts.easeIn || opts.easing, callback);
+
-
        };
+
-
        next.css(opts.cssBefore || {});
 
-
        curr.animate(opts.animOut || {}, opts.speed, opts.easeOut || opts.easing, function() {
 
-
            curr.css(opts.cssAfter || {});
 
-
            if (!opts.sync) {
 
-
                fn();
 
-
            }
 
-
        });
 
-
        if (opts.sync) {
 
-
            fn();
 
-
        }
 
-
    },
 
-
    queueTransition: function( slideOpts, specificTimeout ) {
+
// stop cycling if we have an outstanding stop request
-
        var opts = this.opts();
+
if (p.cycleStop != opts.stopCount || p.cycleTimeout === 0 && !manual)
-
        var timeout = specificTimeout !== undefined ? specificTimeout : slideOpts.timeout;
+
return;
-
        if (opts.nextSlide === 0 && --opts.loop === 0) {
+
-
            opts.API.log('terminating; loop=0');
+
-
            opts.timeout = 0;
+
-
            if ( timeout ) {
+
-
                setTimeout(function() {
+
-
                    opts.API.trigger('cycle-finished', [ opts ]);
+
-
                }, timeout);
+
-
            }
+
-
            else {
+
-
                opts.API.trigger('cycle-finished', [ opts ]);
+
-
            }
+
-
            // reset nextSlide
+
-
            opts.nextSlide = opts.currSlide;
+
-
            return;
+
-
        }
+
-
        if ( timeout ) {
+
-
            opts._lastQueue = $.now();
+
-
            if ( specificTimeout === undefined )
+
-
                opts._remainingTimeout = slideOpts.timeout;
+
-
            if ( !opts.paused && ! opts.hoverPaused ) {
+
// check to see if we should stop cycling based on autostop options
-
                opts.timeoutId = setTimeout(function() {
+
if (!manual && !p.cyclePause && !opts.bounce &&
-
                    opts.API.prepareTx( false, !opts.reverse );
+
((opts.autostop && (--opts.countdown <= 0)) ||
-
                }, timeout );
+
(opts.nowrap && !opts.random && opts.nextSlide < opts.currSlide))) {
-
            }
+
if (opts.end)
-
        }
+
opts.end(opts);
-
    },
+
return;
 +
}
-
    stopTransition: function() {
+
// if slideshow is paused, only transition on a manual trigger
-
        var opts = this.opts();
+
var changed = false;
-
        if ( opts.slides.filter(':animated').length ) {
+
if ((manual || !p.cyclePause) && (opts.nextSlide != opts.currSlide)) {
-
            opts.slides.stop(false, true);
+
changed = true;
-
            opts.API.trigger('cycle-transition-stopped', [ opts ]);
+
var fx = opts.fx;
-
        }
+
// keep trying to get the slide size if we don't have it yet
 +
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._tx && opts._tx.stopTransition )
+
// support multiple transition types
-
            opts._tx.stopTransition( opts );
+
if (opts.multiFx) {
-
    },
+
if (fwd && (opts.lastFx === undefined || ++opts.lastFx >= opts.fxs.length))
 +
opts.lastFx = 0;
 +
else if (!fwd && (opts.lastFx === undefined || --opts.lastFx < 0))
 +
opts.lastFx = opts.fxs.length - 1;
 +
fx = opts.fxs[opts.lastFx];
 +
}
-
    // advance slide forward or back
+
// one-time fx overrides apply to: $('div').cycle(3,'zoom');
-
    advanceSlide: function( val ) {
+
if (opts.oneTimeFx) {
-
        var opts = this.opts();
+
fx = opts.oneTimeFx;
-
        clearTimeout(opts.timeoutId);
+
opts.oneTimeFx = null;
-
        opts.timeoutId = 0;
+
}
-
        opts.nextSlide = opts.currSlide + val;
+
-
       
+
-
        if (opts.nextSlide < 0)
+
-
            opts.nextSlide = opts.slides.length - 1;
+
-
        else if (opts.nextSlide >= opts.slides.length)
+
-
            opts.nextSlide = 0;
+
-
        opts.API.prepareTx( true, val >= 0 );
+
$.fn.cycle.resetState(opts, fx);
-
        return false;
+
-
    },
+
-
    buildSlideOpts: function( slide ) {
+
// run the before callbacks
-
        var opts = this.opts();
+
if (opts.before.length)
-
        var val, shortName;
+
$.each(opts.before, function(i,o) {
-
        var slideOpts = slide.data() || {};
+
if (p.cycleStop != opts.stopCount) return;
-
        for (var p in slideOpts) {
+
o.apply(next, [curr, next, opts, fwd]);
-
            // allow props to be accessed sans 'cycle' prefix and log the overrides
+
});
-
            if (slideOpts.hasOwnProperty(p) && /^cycle[A-Z]+/.test(p) ) {
+
-
                val = slideOpts[p];
+
-
                shortName = p.match(/^cycle(.*)/)[1].replace(/^[A-Z]/, lowerCase);
+
-
                opts.API.log('['+(opts.slideCount-1)+']', shortName+':', val, '('+typeof val +')');
+
-
                slideOpts[shortName] = val;
+
-
            }
+
-
        }
+
-
        slideOpts = $.extend( {}, $.fn.cycle.defaults, opts, slideOpts );
+
// stage the after callacks
-
        slideOpts.slideNum = opts.slideCount;
+
var after = function() {
 +
opts.busy = 0;
 +
$.each(opts.after, function(i,o) {
 +
if (p.cycleStop != opts.stopCount) return;
 +
o.apply(next, [curr, next, opts, fwd]);
 +
});
 +
if (!p.cycleStop) {
 +
// queue next transition
 +
queueNext();
 +
}
 +
};
-
        try {
+
debug('tx firing('+fx+'); currSlide: ' + opts.currSlide + '; nextSlide: ' + opts.nextSlide);
-
            // these props should always be read from the master state object
+
-
            delete slideOpts.API;
+
// get ready to perform the transition
-
            delete slideOpts.slideCount;
+
opts.busy = 1;
-
            delete slideOpts.currSlide;
+
if (opts.fxFn) // fx function provided?
-
            delete slideOpts.nextSlide;
+
opts.fxFn(curr, next, opts, after, fwd, manual && opts.fastOnEvent);
-
            delete slideOpts.slides;
+
else if ($.isFunction($.fn.cycle[opts.fx])) // fx plugin ?
-
        } catch(e) {
+
$.fn.cycle[opts.fx](curr, next, opts, after, fwd, manual && opts.fastOnEvent);
-
            // no op
+
else
-
        }
+
$.fn.cycle.custom(curr, next, opts, after, fwd, manual && opts.fastOnEvent);
-
        return slideOpts;
+
}
-
    },
+
else {
 +
queueNext();
 +
}
-
    getSlideOpts: function( index ) {
+
if (changed || opts.nextSlide == opts.currSlide) {
-
        var opts = this.opts();
+
// calculate the next slide
-
        if ( index === undefined )
+
var roll;
-
            index = opts.currSlide;
+
opts.lastSlide = opts.currSlide;
-
 
+
if (opts.random) {
-
        var slide = opts.slides[index];
+
opts.currSlide = opts.nextSlide;
-
        var slideOpts = $(slide).data('cycle.opts');
+
if (++opts.randomIndex == els.length) {
-
        return $.extend( {}, opts, slideOpts );
+
opts.randomIndex = 0;
-
    },
+
opts.randomMap.sort(function(a,b) {return Math.random() - 0.5;});
-
   
+
}
-
    initSlide: function( slideOpts, slide, suggestedZindex ) {
+
opts.nextSlide = opts.randomMap[opts.randomIndex];
-
        var opts = this.opts();
+
if (opts.nextSlide == opts.currSlide)
-
        slide.css( slideOpts.slideCss || {} );
+
opts.nextSlide = (opts.currSlide == opts.slideCount - 1) ? 0 : opts.currSlide + 1;
-
        if ( suggestedZindex > 0 )
+
}
-
            slide.css( 'zIndex', suggestedZindex );
+
else if (opts.backwards) {
-
 
+
roll = (opts.nextSlide - 1) < 0;
-
        // ensure that speed settings are sane
+
if (roll && opts.bounce) {
-
        if ( isNaN( slideOpts.speed ) )
+
opts.backwards = !opts.backwards;
-
            slideOpts.speed = $.fx.speeds[slideOpts.speed] || $.fx.speeds._default;
+
opts.nextSlide = 1;
-
        if ( !slideOpts.sync )
+
opts.currSlide = 0;
-
            slideOpts.speed = slideOpts.speed / 2;
+
}
-
 
+
else {
-
        slide.addClass( opts.slideClass );
+
opts.nextSlide = roll ? (els.length-1) : opts.nextSlide-1;
-
    },
+
opts.currSlide = roll ? 0 : opts.nextSlide+1;
-
 
+
}
-
    updateView: function( isAfter, isDuring ) {
+
}
-
        var opts = this.opts();
+
else { // sequence
-
        if ( !opts._initialized )
+
roll = (opts.nextSlide + 1) == els.length;
-
            return;
+
if (roll && opts.bounce) {
-
        var slideOpts = opts.API.getSlideOpts();
+
opts.backwards = !opts.backwards;
-
        var currSlide = opts.slides[ opts.currSlide ];
+
opts.nextSlide = els.length-2;
-
 
+
opts.currSlide = els.length-1;
-
        if ( ! isAfter && isDuring !== true ) {
+
}
-
            opts.API.trigger('cycle-update-view-before', [ opts, slideOpts, currSlide ]);
+
else {
-
            if ( opts.updateView < 0 )
+
opts.nextSlide = roll ? 0 : opts.nextSlide+1;
-
                return;
+
opts.currSlide = roll ? els.length-1 : opts.nextSlide-1;
-
        }
+
}
-
 
+
}
-
        if ( opts.slideActiveClass ) {
+
}
-
            opts.slides.removeClass( opts.slideActiveClass )
+
if (changed && opts.pager)
-
                .eq( opts.currSlide ).addClass( opts.slideActiveClass );
+
opts.updateActivePagerLink(opts.pager, opts.currSlide, opts.activePagerClass);
-
        }
+
-
 
+
function queueNext() {
-
        if ( isAfter && opts.hideNonActive )
+
// stage the next transition
-
            opts.slides.filter( ':not(.' + opts.slideActiveClass + ')' ).hide();
+
var ms = 0, timeout = opts.timeout;
-
 
+
if (opts.timeout && !opts.continuous) {
-
        opts.API.trigger('cycle-update-view', [ opts, slideOpts, currSlide, isAfter ]);
+
ms = getTimeout(els[opts.currSlide], els[opts.nextSlide], opts, fwd);
-
       
+
        if (opts.fx == 'shuffle')
-
        if ( isAfter )
+
             ms -= opts.speedOut;
-
            opts.API.trigger('cycle-update-view-after', [ opts, slideOpts, currSlide ]);
+
      }
-
    },
+
else if (opts.continuous && p.cyclePause) // continuous shows work off an after callback, not this timer logic
-
 
+
ms = 10;
-
    getComponent: function( name ) {
+
if (ms > 0)
-
        var opts = this.opts();
+
p.cycleTimeout = setTimeout(function(){ go(els, opts, 0, !opts.backwards); }, ms);
-
        var selector = opts[name];
+
}
-
        if (typeof selector === 'string') {
+
}
-
            // if selector is a child, sibling combinator, adjancent selector then use find, otherwise query full dom
+
-
            return (/^\s*[\>|\+|~]/).test( selector ) ? opts.container.find( selector ) : $( selector );
+
-
        }
+
-
        if (selector.jquery)
+
-
            return selector;
+
-
       
+
-
        return $(selector);
+
-
    },
+
-
 
+
-
    stackSlides: function( curr, next, fwd ) {
+
-
        var opts = this.opts();
+
-
        if ( !curr ) {
+
-
            curr = opts.slides[opts.currSlide];
+
-
            next = opts.slides[opts.nextSlide];
+
-
            fwd = !opts.reverse;
+
-
        }
+
-
 
+
-
        // reset the zIndex for the common case:
+
-
        // curr slide on top,  next slide beneath, and the rest in order to be shown
+
-
        $(curr).css('zIndex', opts.maxZ);
+
-
 
+
-
        var i;
+
-
        var z = opts.maxZ - 2;
+
-
        var len = opts.slideCount;
+
-
        if (fwd) {
+
-
            for ( i = opts.currSlide + 1; i < len; i++ )
+
-
                $( opts.slides[i] ).css( 'zIndex', z-- );
+
-
            for ( i = 0; i < opts.currSlide; i++ )
+
-
                $( opts.slides[i] ).css( 'zIndex', z-- );
+
-
        }
+
-
        else {
+
-
             for ( i = opts.currSlide - 1; i >= 0; i-- )
+
-
                $( opts.slides[i] ).css( 'zIndex', z-- );
+
-
            for ( i = len - 1; i > opts.currSlide; i-- )
+
-
                $( opts.slides[i] ).css( 'zIndex', z-- );
+
-
        }
+
-
 
+
-
        $(next).css('zIndex', opts.maxZ - 1);
+
-
    },
+
-
 
+
-
    getSlideIndex: function( el ) {
+
-
        return this.opts().slides.index( el );
+
-
    }
+
-
 
+
-
}; // API
+
-
// default logger
+
// invoked after transition
-
$.fn.cycle.log = function log() {
+
$.fn.cycle.updateActivePagerLink = function(pager, currSlide, clsName) {
-
    /*global console:true */
+
  $(pager).each(function() {
-
    if (window.console && console.log)
+
      $(this).children().removeClass(clsName).eq(currSlide).addClass(clsName);
-
        console.log('[cycle2] ' + Array.prototype.join.call(arguments, ' ') );
+
  });
};
};
-
$.fn.cycle.version = function() { return 'Cycle2: ' + version; };
+
// calculate timeout value for current transition
-
 
+
function getTimeout(curr, next, opts, fwd) {
-
// helper functions
+
if (opts.timeoutFn) {
-
 
+
// call user provided calc fn
-
function lowerCase(s) {
+
var t = opts.timeoutFn.call(curr,curr,next,opts,fwd);
-
    return (s || '').toLowerCase();
+
while (opts.fx != 'none' && (t - opts.speed) < 250) // sanitize timeout
 +
t += opts.speed;
 +
debug('calculated timeout: ' + t + '; speed: ' + opts.speed);
 +
if (t !== false)
 +
return t;
 +
}
 +
return opts.timeout;
}
}
-
// expose transition object
+
// expose next/prev function, caller must pass in state
-
$.fn.cycle.transitions = {
+
$.fn.cycle.next = function(opts) { advance(opts,1); };
-
    custom: {
+
$.fn.cycle.prev = function(opts) { advance(opts,0);};
-
    },
+
-
    none: {
+
-
        before: function( opts, curr, next, fwd ) {
+
-
            opts.API.stackSlides( next, curr, fwd );
+
-
            opts.cssBefore = { opacity: 1, display: 'block' };
+
-
        }
+
-
    },
+
-
    fade: {
+
-
        before: function( opts, curr, next, fwd ) {
+
-
            var css = opts.API.getSlideOpts( opts.nextSlide ).slideCss || {};
+
-
            opts.API.stackSlides( curr, next, fwd );
+
-
            opts.cssBefore = $.extend(css, { opacity: 0, display: 'block' });
+
-
            opts.animIn = { opacity: 1 };
+
-
            opts.animOut = { opacity: 0 };
+
-
        }
+
-
    },
+
-
    fadeout: {
+
-
        before: function( opts , curr, next, fwd ) {
+
-
            var css = opts.API.getSlideOpts( opts.nextSlide ).slideCss || {};
+
-
            opts.API.stackSlides( curr, next, fwd );
+
-
            opts.cssBefore = $.extend(css, { opacity: 1, display: 'block' });
+
-
            opts.animOut = { opacity: 0 };
+
-
        }
+
-
    },
+
-
    scrollHorz: {
+
-
        before: function( opts, curr, next, fwd ) {
+
-
            opts.API.stackSlides( curr, next, fwd );
+
-
            var w = opts.container.css('overflow','hidden').width();
+
-
            opts.cssBefore = { left: fwd ? w : - w, top: 0, opacity: 1, display: 'block' };
+
-
            opts.cssAfter = { zIndex: opts._maxZ - 2, left: 0 };
+
-
            opts.animIn = { left: 0 };
+
-
            opts.animOut = { left: fwd ? -w : w };
+
-
        }
+
-
    }
+
-
};
+
-
// @see: http://jquery.malsup.com/cycle2/api
+
// advance slide forward or back
-
$.fn.cycle.defaults = {
+
function advance(opts, moveForward) {
-
    allowWrap:        true,
+
var val = moveForward ? 1 : -1;
-
    autoSelector:    '.cycle-slideshow[data-cycle-auto-init!=false]',
+
var els = opts.elements;
-
    delay:            0,
+
var p = opts.$cont[0], timeout = p.cycleTimeout;
-
    easing:          null,
+
if (timeout) {
-
    fx:              'fade',
+
clearTimeout(timeout);
-
    hideNonActive:    true,
+
p.cycleTimeout = 0;
-
    loop:            0,
+
}
-
    manualFx:        undefined,
+
if (opts.random && val < 0) {
-
    manualSpeed:      undefined,
+
// move back to the previously display slide
-
    manualTrump:      true,
+
opts.randomIndex--;
-
    maxZ:            100,
+
if (--opts.randomIndex == -2)
-
    pauseOnHover:    false,
+
opts.randomIndex = els.length-2;
-
    reverse:          false,
+
else if (opts.randomIndex == -1)
-
    slideActiveClass: 'cycle-slide-active',
+
opts.randomIndex = els.length-1;
-
    slideClass:      'cycle-slide',
+
opts.nextSlide = opts.randomMap[opts.randomIndex];
-
    slideCss:        { position: 'absolute', top: 0, left: 0 },
+
}
-
    slides:          '> img',
+
else if (opts.random) {
-
    speed:            500,
+
opts.nextSlide = opts.randomMap[opts.randomIndex];
-
    startingSlide:    0,
+
}
-
    sync:            true,
+
else {
-
    timeout:          4000,
+
opts.nextSlide = opts.currSlide + val;
-
    updateView:      -1
+
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;
 +
}
 +
}
-
// automatically find and run slideshows
+
var cb = opts.onPrevNextEvent || opts.prevNextClick; // prevNextClick is deprecated
-
$(document).ready(function() {
+
if ($.isFunction(cb))
-
    $( $.fn.cycle.defaults.autoSelector ).cycle();
+
cb(val > 0, opts.nextSlide, els[opts.nextSlide]);
-
});
+
go(els, opts, 1, moveForward);
-
 
+
return false;
-
})(jQuery);
+
-
 
+
-
/*! Cycle2 autoheight plugin; Copyright (c) M.Alsup, 2012; version: 20130304 */
+
-
(function($) {
+
-
"use strict";
+
-
 
+
-
$.extend($.fn.cycle.defaults, {
+
-
    autoHeight: 0 // setting this option to false disables autoHeight logic
+
-
});   
+
-
 
+
-
$(document).on( 'cycle-initialized', function( e, opts ) {
+
-
    var autoHeight = opts.autoHeight;
+
-
    var t = $.type( autoHeight );
+
-
    var resizeThrottle = null;
+
-
    var ratio;
+
-
 
+
-
    if ( t !== 'string' && t !== 'number' )
+
-
        return;
+
-
 
+
-
    // bind events
+
-
    opts.container.on( 'cycle-slide-added cycle-slide-removed', initAutoHeight );
+
-
    opts.container.on( 'cycle-destroyed', onDestroy );
+
-
 
+
-
    if ( autoHeight == 'container' ) {
+
-
        opts.container.on( 'cycle-before', onBefore );
+
-
    }
+
-
    else if ( t === 'string' && /\d+\:\d+/.test( autoHeight ) ) {
+
-
        // use ratio
+
-
        ratio = autoHeight.match(/(\d+)\:(\d+)/);
+
-
        ratio = ratio[1] / ratio[2];
+
-
        opts._autoHeightRatio = ratio;
+
-
    }
+
-
 
+
-
    // if autoHeight is a number then we don't need to recalculate the sentinel
+
-
    // index on resize
+
-
    if ( t !== 'number' ) {
+
-
        // bind unique resize handler per slideshow (so it can be 'off-ed' in onDestroy)
+
-
        opts._autoHeightOnResize = function () {
+
-
            clearTimeout( resizeThrottle );
+
-
            resizeThrottle = setTimeout( onResize, 50 );
+
-
        };
+
-
 
+
-
        $(window).on( 'resize orientationchange', opts._autoHeightOnResize );
+
-
    }
+
-
 
+
-
    setTimeout( onResize, 30 );
+
-
 
+
-
    function onResize() {
+
-
        initAutoHeight( e, opts );
+
-
    }
+
-
});
+
-
 
+
-
function initAutoHeight( e, opts ) {
+
-
    var clone, height, sentinelIndex;
+
-
    var autoHeight = opts.autoHeight;
+
-
 
+
-
    if ( autoHeight == 'container' ) {
+
-
        height = $( opts.slides[ opts.currSlide ] ).outerHeight();
+
-
        opts.container.height( height );
+
-
    }
+
-
    else if ( opts._autoHeightRatio ) {
+
-
        opts.container.height( opts.container.width() / opts._autoHeightRatio );
+
-
    }
+
-
    else if ( autoHeight === 'calc' || ( $.type( autoHeight ) == 'number' && autoHeight >= 0 ) ) {
+
-
        if ( autoHeight === 'calc' )
+
-
            sentinelIndex = calcSentinelIndex( e, opts );
+
-
        else if ( autoHeight >= opts.slides.length )
+
-
            sentinelIndex = 0;
+
-
        else
+
-
            sentinelIndex = autoHeight;
+
-
 
+
-
        // only recreate sentinel if index is different
+
-
        if ( sentinelIndex == opts._sentinelIndex )
+
-
            return;
+
-
 
+
-
        opts._sentinelIndex = sentinelIndex;
+
-
        if ( opts._sentinel )
+
-
            opts._sentinel.remove();
+
-
 
+
-
        // clone existing slide as sentinel
+
-
        clone = $( opts.slides[ sentinelIndex ].cloneNode(true) );
+
-
       
+
-
        // #50; remove special attributes from cloned content
+
-
        clone.removeAttr( 'id name rel' ).find( '[id],[name],[rel]' ).removeAttr( 'id name rel' );
+
-
 
+
-
        clone.css({
+
-
            position: 'static',
+
-
            visibility: 'hidden',
+
-
            display: 'block'
+
-
        }).prependTo( opts.container ).addClass('cycle-sentinel cycle-slide').removeClass('cycle-slide-active');
+
-
        clone.find( '*' ).css( 'visibility', 'hidden' );
+
-
 
+
-
        opts._sentinel = clone;
+
-
    }
+
-
}   
+
-
 
+
-
function calcSentinelIndex( e, opts ) {
+
-
    var index = 0, max = -1;
+
-
 
+
-
    // calculate tallest slide index
+
-
    opts.slides.each(function(i) {
+
-
        var h = $(this).height();
+
-
        if ( h > max ) {
+
-
            max = h;
+
-
            index = i;
+
-
        }
+
-
    });
+
-
    return index;
+
}
}
-
function onBefore( e, opts, outgoing, incoming, forward ) {
+
function buildPager(els, opts) {
-
    var h = $(incoming).outerHeight();
+
var $p = $(opts.pager);
-
    var duration = opts.sync ? opts.speed / 2 : opts.speed;
+
$.each(els, function(i,o) {
-
    opts.container.animate( { height: h }, duration );
+
$.fn.cycle.createPagerAnchor(i,o,$p,els,opts);
 +
});
 +
opts.updateActivePagerLink(opts.pager, opts.startingSlide, opts.activePagerClass);
}
}
-
function onDestroy( e, opts ) {
+
$.fn.cycle.createPagerAnchor = function(i, el, $p, els, opts) {
-
    if ( opts._autoHeightOnResize ) {
+
var a;
-
        $(window).off( 'resize orientationchange', opts._autoHeightOnResize );
+
if ($.isFunction(opts.pagerAnchorBuilder)) {
-
        opts._autoHeightOnResize = null;
+
a = opts.pagerAnchorBuilder(i,el);
-
    }
+
debug('pagerAnchorBuilder('+i+', el) returned: ' + a);
-
    opts.container.off( 'cycle-slide-added cycle-slide-removed', initAutoHeight );
+
}
-
    opts.container.off( 'cycle-destroyed', onDestroy );
+
else
-
    opts.container.off( 'cycle-before', onBefore );
+
a = '<a href="#">'+(i+1)+'</a>';
 +
 +
if (!a)
 +
return;
 +
var $a = $(a);
 +
// don't reparent if anchor is in the dom
 +
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);
 +
}
 +
}
-
    if ( opts._sentinel ) {
+
opts.pagerAnchors =  opts.pagerAnchors || [];
-
        opts._sentinel.remove();
+
opts.pagerAnchors.push($a);
-
        opts._sentinel = null;
+
-
    }
+
var pagerFn = 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; // pagerClick is deprecated
 +
if ($.isFunction(cb))
 +
cb(opts.nextSlide, els[opts.nextSlide]);
 +
go(els,opts,1,opts.currSlide < i); // trigger the trans
 +
// return false; // <== allow bubble
 +
};
 +
 +
if ( /mouseenter|mouseover/i.test(opts.pagerEvent) ) {
 +
$a.hover(pagerFn, function(){/* no-op */} );
 +
}
 +
else {
 +
$a.bind(opts.pagerEvent, pagerFn);
 +
}
 +
 +
if ( ! /^click/.test(opts.pagerEvent) && !opts.allowPagerClickBubble)
 +
$a.bind('click.cycle', function(){return false;}); // suppress click
 +
 +
var cont = opts.$cont[0];
 +
var pauseFlag = false; // https://github.com/malsup/cycle/issues/44
 +
if (opts.pauseOnPagerHover) {
 +
$a.hover(
 +
function() {
 +
pauseFlag = true;
 +
cont.cyclePause++;
 +
triggerPause(cont,true,true);
 +
}, function() {
 +
if (pauseFlag)
 +
cont.cyclePause--;
 +
triggerPause(cont,true,true);
 +
}  
 +
);
 +
}
 +
};
-
})(jQuery);
+
// helper fn to calculate the number of slides between the current and the next
-
 
+
$.fn.cycle.hopsFromLast = function(opts, fwd) {
-
/*! caption plugin for Cycle2;  version: 20130306 */
+
var hops, l = opts.lastSlide, c = opts.currSlide;
-
(function($) {
+
if (fwd)
-
"use strict";
+
hops = c > l ? c - l : opts.slideCount - l;
-
 
+
else
-
$.extend($.fn.cycle.defaults, {
+
hops = c < l ? l - c : l + opts.slideCount - c;
-
    caption:          '> .cycle-caption',
+
return hops;
-
    captionTemplate:  '{{slideNum}} / {{slideCount}}',
+
-
    overlay:          '> .cycle-overlay',
+
-
    overlayTemplate:  '<div>{{title}}</div><div>{{desc}}</div>',
+
-
    captionModule:    'caption'
+
-
});   
+
-
 
+
-
$(document).on( 'cycle-update-view', function( e, opts, slideOpts, currSlide ) {
+
-
    if ( opts.captionModule !== 'caption' )
+
-
        return;
+
-
    var el;
+
-
    $.each(['caption','overlay'], function() {
+
-
        var name = this;
+
-
        var template = slideOpts[name+'Template'];
+
-
        var el = opts.API.getComponent( name );
+
-
        if( el.length && template ) {
+
-
            el.html( opts.API.tmpl( template, slideOpts, opts, currSlide ) );
+
-
            el.show();
+
-
        }
+
-
        else {
+
-
            el.hide();
+
-
        }
+
-
    });
+
-
});
+
-
 
+
-
$(document).on( 'cycle-destroyed', function( e, opts ) {
+
-
    var el;
+
-
    $.each(['caption','overlay'], function() {
+
-
        var name = this, template = opts[name+'Template'];
+
-
        if ( opts[name] && template ) {
+
-
            el = opts.API.getComponent( 'caption' );
+
-
            el.empty();
+
-
        }
+
-
    });
+
-
});
+
-
 
+
-
})(jQuery);
+
-
 
+
-
/*! command plugin for Cycle2;  version: 20130707 */
+
-
(function($) {
+
-
"use strict";
+
-
 
+
-
var c2 = $.fn.cycle;
+
-
 
+
-
$.fn.cycle = function( options ) {
+
-
    var cmd, cmdFn, opts;
+
-
    var args = $.makeArray( arguments );
+
-
 
+
-
    if ( $.type( options ) == 'number' ) {
+
-
        return this.cycle( 'goto', options );
+
-
    }
+
-
 
+
-
    if ( $.type( options ) == 'string' ) {
+
-
        return this.each(function() {
+
-
            var cmdArgs;
+
-
            cmd = options;
+
-
            opts = $(this).data('cycle.opts');
+
-
 
+
-
            if ( opts === undefined ) {
+
-
                c2.log('slideshow must be initialized before sending commands; "' + cmd + '" ignored');
+
-
                return;
+
-
            }
+
-
            else {
+
-
                cmd = cmd == 'goto' ? 'jump' : cmd; // issue #3; change 'goto' to 'jump' internally
+
-
                cmdFn = opts.API[ cmd ];
+
-
                if ( $.isFunction( cmdFn )) {
+
-
                    cmdArgs = $.makeArray( args );
+
-
                    cmdArgs.shift();
+
-
                    return cmdFn.apply( opts.API, cmdArgs );
+
-
                }
+
-
                else {
+
-
                    c2.log( 'unknown command: ', cmd );
+
-
                }
+
-
            }
+
-
        });
+
-
    }
+
-
    else {
+
-
        return c2.apply( this, arguments );
+
-
    }
+
};
};
-
// copy props
+
// fix clearType problems in ie6 by setting an explicit bg color
-
$.extend( $.fn.cycle, c2 );
+
// (otherwise text slides look horrible during a fade transition)
-
 
+
function clearTypeFix($slides) {
-
$.extend( c2.API, {
+
debug('applying clearType background-color hack');
-
    next: function() {
+
function hex(s) {
-
        var opts = this.opts();
+
s = parseInt(s,10).toString(16);
-
        if ( opts.busy && ! opts.manualTrump )
+
return s.length < 2 ? '0'+s : s;
-
            return;
+
}
-
       
+
function getBg(e) {
-
        var count = opts.reverse ? -1 : 1;
+
for ( ; e && e.nodeName.toLowerCase() != 'html'; e = e.parentNode) {
-
        if ( opts.allowWrap === false && ( opts.currSlide + count ) >= opts.slideCount )
+
var v = $.css(e,'background-color');
-
            return;
+
if (v && v.indexOf('rgb') >= 0 ) {
-
 
+
var rgb = v.match(/\d+/g);
-
        opts.API.advanceSlide( count );
+
return '#'+ hex(rgb[0]) + hex(rgb[1]) + hex(rgb[2]);
-
        opts.API.trigger('cycle-next', [ opts ]).log('cycle-next');
+
}
-
    },
+
if (v && v != 'transparent')
-
 
+
return v;
-
    prev: function() {
+
}
-
        var opts = this.opts();
+
return '#ffffff';
-
        if ( opts.busy && ! opts.manualTrump )
+
}
-
            return;
+
$slides.each(function() { $(this).css('background-color', getBg(this)); });
-
        var count = opts.reverse ? 1 : -1;
+
-
        if ( opts.allowWrap === false && ( opts.currSlide + count ) < 0 )
+
-
            return;
+
-
 
+
-
        opts.API.advanceSlide( count );
+
-
        opts.API.trigger('cycle-prev', [ opts ]).log('cycle-prev');
+
-
    },
+
-
 
+
-
    destroy: function() {
+
-
        this.stop(); //#204
+
-
 
+
-
        var opts = this.opts();
+
-
        var clean = $.isFunction( $._data ) ? $._data : $.noop;  // hack for #184 and #201
+
-
        clearTimeout(opts.timeoutId);
+
-
        opts.timeoutId = 0;
+
-
        opts.API.stop();
+
-
        opts.API.trigger( 'cycle-destroyed', [ opts ] ).log('cycle-destroyed');
+
-
        opts.container.removeData();
+
-
        clean( opts.container[0], 'parsedAttrs', false );
+
-
 
+
-
        // #75; remove inline styles
+
-
        if ( ! opts.retainStylesOnDestroy ) {
+
-
            opts.container.removeAttr( 'style' );
+
-
            opts.slides.removeAttr( 'style' );
+
-
            opts.slides.removeClass( opts.slideActiveClass );
+
-
        }
+
-
        opts.slides.each(function() {
+
-
            $(this).removeData();
+
-
            clean( this, 'parsedAttrs', false );
+
-
        });
+
-
    },
+
-
 
+
-
    jump: function( index ) {
+
-
        // go to the requested slide
+
-
        var fwd;
+
-
        var opts = this.opts();
+
-
        if ( opts.busy && ! opts.manualTrump )
+
-
            return;
+
-
        var num = parseInt( index, 10 );
+
-
        if (isNaN(num) || num < 0 || num >= opts.slides.length) {
+
-
            opts.API.log('goto: invalid slide index: ' + num);
+
-
            return;
+
-
        }
+
-
        if (num == opts.currSlide) {
+
-
            opts.API.log('goto: skipping, already on slide', num);
+
-
            return;
+
-
        }
+
-
        opts.nextSlide = num;
+
-
        clearTimeout(opts.timeoutId);
+
-
        opts.timeoutId = 0;
+
-
        opts.API.log('goto: ', num, ' (zero-index)');
+
-
        fwd = opts.currSlide < opts.nextSlide;
+
-
        opts.API.prepareTx( true, fwd );
+
-
    },
+
-
 
+
-
    stop: function() {
+
-
        var opts = this.opts();
+
-
        var pauseObj = opts.container;
+
-
        clearTimeout(opts.timeoutId);
+
-
        opts.timeoutId = 0;
+
-
        opts.API.stopTransition();
+
-
        if ( opts.pauseOnHover ) {
+
-
            if ( opts.pauseOnHover !== true )
+
-
                pauseObj = $( opts.pauseOnHover );
+
-
            pauseObj.off('mouseenter mouseleave');
+
-
        }
+
-
        opts.API.trigger('cycle-stopped', [ opts ]).log('cycle-stopped');
+
-
    },
+
-
 
+
-
    reinit: function() {
+
-
        var opts = this.opts();
+
-
        opts.API.destroy();
+
-
        opts.container.cycle();
+
-
    },
+
-
 
+
-
    remove: function( index ) {
+
-
        var opts = this.opts();
+
-
        var slide, slideToRemove, slides = [], slideNum = 1;
+
-
        for ( var i=0; i < opts.slides.length; i++ ) {
+
-
            slide = opts.slides[i];
+
-
            if ( i == index ) {
+
-
                slideToRemove = slide;
+
-
            }
+
-
            else {
+
-
                slides.push( slide );
+
-
                $( slide ).data('cycle.opts').slideNum = slideNum;
+
-
                slideNum++;
+
-
            }
+
-
        }
+
-
        if ( slideToRemove ) {
+
-
            opts.slides = $( slides );
+
-
            opts.slideCount--;
+
-
            $( slideToRemove ).remove();
+
-
            if (index == opts.currSlide)
+
-
                opts.API.advanceSlide( 1 );
+
-
            else if ( index < opts.currSlide )
+
-
                opts.currSlide--;
+
-
            else
+
-
                opts.currSlide++;
+
-
 
+
-
            opts.API.trigger('cycle-slide-removed', [ opts, index, slideToRemove ]).log('cycle-slide-removed');
+
-
            opts.API.updateView();
+
-
        }
+
-
    }
+
-
 
+
-
});
+
-
 
+
-
// listen for clicks on elements with data-cycle-cmd attribute
+
-
$(document).on('click.cycle', '[data-cycle-cmd]', function(e) {
+
-
    // issue cycle command
+
-
    e.preventDefault();
+
-
    var el = $(this);
+
-
    var command = el.data('cycle-cmd');
+
-
    var context = el.data('cycle-context') || '.cycle-slideshow';
+
-
    $(context).cycle(command, el.data('cycle-arg'));
+
-
});
+
-
 
+
-
 
+
-
})(jQuery);
+
-
 
+
-
/*! hash plugin for Cycle2;  version: 20130905 */
+
-
(function($) {
+
-
"use strict";
+
-
 
+
-
$(document).on( 'cycle-pre-initialize', function( e, opts ) {
+
-
    onHashChange( opts, true );
+
-
 
+
-
    opts._onHashChange = function() {
+
-
        onHashChange( opts, false );
+
-
    };
+
-
 
+
-
    $( window ).on( 'hashchange', opts._onHashChange);
+
-
});
+
-
 
+
-
$(document).on( 'cycle-update-view', function( e, opts, slideOpts ) {
+
-
    if ( slideOpts.hash && ( '#' + slideOpts.hash ) != window.location.hash ) {
+
-
        opts._hashFence = true;
+
-
        window.location.hash = slideOpts.hash;
+
-
    }
+
-
});
+
-
 
+
-
$(document).on( 'cycle-destroyed', function( e, opts) {
+
-
    if ( opts._onHashChange ) {
+
-
        $( window ).off( 'hashchange', opts._onHashChange );
+
-
    }
+
-
});
+
-
 
+
-
function onHashChange( opts, setStartingSlide ) {
+
-
    var hash;
+
-
    if ( opts._hashFence ) {
+
-
        opts._hashFence = false;
+
-
        return;
+
-
    }
+
-
   
+
-
    hash = window.location.hash.substring(1);
+
-
 
+
-
    opts.slides.each(function(i) {
+
-
        if ( $(this).data( 'cycle-hash' ) == hash ) {
+
-
            if ( setStartingSlide === true ) {
+
-
                opts.startingSlide = i;
+
-
            }
+
-
            else {
+
-
                var fwd = opts.currSlide < i;
+
-
                opts.nextSlide = i;
+
-
                opts.API.prepareTx( true, fwd );
+
-
            }
+
-
            return false;
+
-
        }
+
-
    });
+
}
}
-
})(jQuery);
+
// reset common props before the next transition
 +
$.fn.cycle.commonReset = function(curr,next,opts,w,h,rev) {
 +
$(opts.elements).not(curr).hide();
 +
if (typeof opts.cssBefore.opacity == 'undefined')
 +
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));
 +
};
-
/*! loader plugin for Cycle2; version: 20130307 */
+
// the actual fn for effecting a transition
-
(function($) {
+
$.fn.cycle.custom = function(curr, next, opts, cb, fwd, speedOverride) {
-
"use strict";
+
var $l = $(curr), $n = $(next);
 +
var speedIn = opts.speedIn, speedOut = opts.speedOut, easeIn = opts.easeIn, easeOut = opts.easeOut, animInDelay = opts.animInDelay, animOutDelay = opts.animOutDelay;
 +
$n.css(opts.cssBefore);
 +
if (speedOverride) {
 +
if (typeof speedOverride == 'number')
 +
speedIn = speedOut = speedOverride;
 +
else
 +
speedIn = speedOut = 1;
 +
easeIn = easeOut = null;
 +
}
 +
var fn = function() {
 +
$n.delay(animInDelay).animate(opts.animIn, speedIn, easeIn, function() {
 +
cb();
 +
});
 +
};
 +
$l.delay(animOutDelay).animate(opts.animOut, speedOut, easeOut, function() {
 +
$l.css(opts.cssAfter);
 +
if (!opts.sync)
 +
fn();
 +
});
 +
if (opts.sync) fn();
 +
};
-
$.extend($.fn.cycle.defaults, {
+
// transition definitions - only fade is defined here, transition pack defines the rest
-
    loader: false
+
$.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 };
 +
}
 +
};
-
$(document).on( 'cycle-bootstrap', function( e, opts ) {
+
$.fn.cycle.ver = function() { return ver; };
-
    var addFn;
+
-
    if ( !opts.loader )
+
// override these globally if you like (they are all optional)
-
        return;
+
$.fn.cycle.defaults = {
-
 
+
    activePagerClass: 'activeSlide', // class name used for the active pager link
-
    // override API.add for this slideshow
+
    after:            null,    // transition callback (scope set to element that was shown):  function(currSlideElement, nextSlideElement, options, forwardFlag)
-
    addFn = opts.API.add;
+
    allowPagerClickBubble: false, // allows or prevents click event on pager anchors from bubbling
-
    opts.API.add = add;
+
    animIn:          null,    // properties that define how the slide animates in
-
 
+
    animInDelay:      0,        // allows delay before next slide transitions in
-
    function add( slides, prepend ) {
+
    animOut:         null,    // properties that define how the slide animates out
-
        var slideArr = [];
+
    animOutDelay:    0,       // allows delay before current slide transitions out
-
        if ( $.type( slides ) == 'string' )
+
    aspect:           false,    // preserve aspect ratio during fit resizing, cropping if necessary (must be used with fit option)
-
            slides = $.trim( slides );
+
    autostop:         0,        // true to end slideshow after X transitions (where X == slide count)
-
        else if ( $.type( slides) === 'array' ) {
+
    autostopCount:    0,        // number of transitions (optionally used with autostop to define X)
-
            for (var i=0; i < slides.length; i++ )
+
    backwards:        false,    // true to start slideshow at last slide and move backwards through the stack
-
                slides[i] = $(slides[i])[0];
+
    before:           null,     // transition callback (scope set to element to be shown):    function(currSlideElement, nextSlideElement, options, forwardFlag)
-
        }
+
    center:          null,    // set to true to have cycle add top/left margin to each slide (use with width and height options)
-
 
+
    cleartype:        !$.support.opacity,  // true if clearType corrections should be applied (for IE)
-
        slides = $( slides );
+
    cleartypeNoBg:    false,    // set to true to disable extra cleartype fixing (leave false to force background color setting on slides)
-
        var slideCount = slides.length;
+
    containerResize:  1,       // resize container to fit largest slide
-
 
+
    containerResizeHeight:  0, // resize containers height to fit the largest slide but leave the width dynamic
-
        if ( ! slideCount )
+
    continuous:      0,       // true to start next transition immediately after current one completes
-
            return;
+
    cssAfter:         null,    // properties that defined the state of the slide after transitioning out
-
 
+
    cssBefore:        null,    // properties that define the initial state of the slide before transitioning in
-
        slides.hide().appendTo('body').each(function(i) { // appendTo fixes #56
+
    delay:            0,       // additional delay (in ms) for first transition (hint: can be negative)
-
            var count = 0;
+
     easeIn:          null,    // easing for "in" transition
-
            var slide = $(this);
+
     easeOut:         null,     // easing for "out" transition
-
            var images = slide.is('img') ? slide : slide.find('img');
+
     easing:           null,     // easing method for both in and out transitions
-
            slide.data('index', i);
+
     end:             null,    // callback invoked when the slideshow terminates (use with autostop or nowrap options): function(options)
-
            // allow some images to be marked as unimportant (and filter out images w/o src value)
+
    fastOnEvent:      0,       // force fast transitions when triggered manually (via pager or prev/next); value == time in ms
-
            images = images.filter(':not(.cycle-loader-ignore)').filter(':not([src=""])');
+
     fit:              0,        // force slides to fit container
-
            if ( ! images.length ) {
+
     fx:              'fade',   // name of transition effect (or comma separated names, ex: 'fade,scrollUp,shuffle')
-
                --slideCount;
+
     fxFn:            null,    // function used to control the transition: function(currSlideElement, nextSlideElement, options, afterCalback, forwardFlag)
-
                slideArr.push( slide );
+
     height:          'auto',   // container height (if the 'fit' option is true, the slides will be set to this height as well)
-
                return;
+
    manualTrump:      true,    // causes manual transition to stop an active transition instead of being ignored
-
            }
+
    metaAttr:         'cycle', // data- attribute that holds the option data for the slideshow
-
 
+
    next:            null,     // element, jQuery object, or jQuery selector string for the element to use as event trigger for next slide
-
            count = images.length;
+
     nowrap:          0,        // true to prevent slideshow from wrapping
-
            images.each(function() {
+
     onPagerEvent:    null,    // callback fn for pager events: function(zeroBasedSlideIndex, slideElement)
-
                // add images that are already loaded
+
     onPrevNextEvent:  null,     // callback fn for prev/next events: function(isNext, zeroBasedSlideIndex, slideElement)
-
                if ( this.complete ) {
+
     pager:            null,     // element, jQuery object, or jQuery selector string for the element to use as pager container
-
                    imageLoaded();
+
     pagerAnchorBuilder: null,  // callback fn for building anchor links:  function(index, DOMelement)
-
                }
+
     pagerEvent:      'click.cycle', // name of event which drives the pager navigation
-
                else {
+
     pause:            0,        // true to enable "pause on hover"
-
                    $(this).load(function() {
+
    pauseOnPagerHover: 0,      // true to pause when hovering over pager link
-
                        imageLoaded();
+
    prev:             null,     // element, jQuery object, or jQuery selector string for the element to use as event trigger for previous slide
-
                    }).error(function() {
+
    prevNextEvent:    'click.cycle',// event which drives the manual transition to the previous or next slide
-
                        if ( --count === 0 ) {
+
    random:          0,        // true for random, false for sequence (not applicable to shuffle fx)
-
                            // ignore this slide
+
    randomizeEffects: 1,        // valid when multiple effects are used; true to make the effect sequence random
-
                            opts.API.log('slide skipped; img not loaded:', this.src);
+
    requeueOnImageNotLoaded: true, // requeue the slideshow if any image slides are not yet loaded
-
                            if ( --slideCount === 0 && opts.loader == 'wait') {
+
    requeueTimeout:  250,     // ms delay for requeue
-
                                addFn.apply( opts.API, [ slideArr, prepend ] );
+
    rev:              0,        // causes animations to transition in reverse (for effects that support it such as scrollHorz/scrollVert/shuffle)
-
                            }
+
    shuffle:          null,    // coords for shuffle animation, ex: { top:15, left: 200 }
-
                        }
+
     skipInitializationCallbacks: false, // set to true to disable the first before/after callback that occurs prior to any transition
-
                    });
+
     slideExpr:        null,    // expression for selecting slides (if something other than all children is required)
-
                }
+
     slideResize:      1,        // force slide width/height to fixed size before every transition
-
            });
+
     speed:            1000,    // speed of the transition (any valid fx speed value)
-
 
+
     speedIn:          null,     // speed of the 'in' transition
-
            function imageLoaded() {
+
     speedOut:         null,    // speed of the 'out' transition
-
                if ( --count === 0 ) {
+
    startingSlide:    undefined,// zero-based index of the first slide to be displayed
-
                    --slideCount;
+
     sync:            1,        // true if in/out transitions should occur simultaneously
-
                    addSlide( slide );
+
     timeout:          4000,    // milliseconds between slide transitions (0 to disable auto advance)
-
                }
+
     timeoutFn:        null,    // callback for determining per-slide timeout value:  function(currSlideElement, nextSlideElement, options, forwardFlag)
-
            }
+
     updateActivePagerLink: null,// callback fn invoked to update the active pager link (adds/removes activePagerClass style)
-
        });
+
    width:            null      // container width (if the 'fit' option is true, the slides will be set to this width as well)
-
 
+
};
-
        if ( slideCount )
+
-
            opts.container.addClass('cycle-loading');
+
-
       
+
-
 
+
-
        function addSlide( slide ) {
+
-
            var curr;
+
-
            if ( opts.loader == 'wait' ) {
+
-
                slideArr.push( slide );
+
-
                if ( slideCount === 0 ) {
+
-
                    // #59; sort slides into original markup order
+
-
                    slideArr.sort( sorter );
+
-
                    addFn.apply( opts.API, [ slideArr, prepend ] );
+
-
                    opts.container.removeClass('cycle-loading');
+
-
                }
+
-
            }
+
-
            else {
+
-
                curr = $(opts.slides[opts.currSlide]);
+
-
                addFn.apply( opts.API, [ slide, prepend ] );
+
-
                curr.show();
+
-
                opts.container.removeClass('cycle-loading');
+
-
            }
+
-
         }
+
-
 
+
-
        function sorter(a, b) {
+
-
            return a.data('index') - b.data('index');
+
-
        }
+
-
     }
+
-
});
+
-
 
+
-
})(jQuery);
+
-
 
+
-
/*! pager plugin for Cycle2;  version: 20130525 */
+
-
(function($) {
+
-
"use strict";
+
-
 
+
-
$.extend($.fn.cycle.defaults, {
+
-
     pager:           '> .cycle-pager',
+
-
     pagerActiveClass: 'cycle-pager-active',
+
-
     pagerEvent:       'click.cycle',
+
-
     pagerTemplate:    '<span>&bull;</span>'
+
-
});   
+
-
 
+
-
$(document).on( 'cycle-bootstrap', function( e, opts, API ) {
+
-
     // add method to API
+
-
     API.buildPagerLink = buildPagerLink;
+
-
});
+
-
 
+
-
$(document).on( 'cycle-slide-added', function( e, opts, slideOpts, slideAdded ) {
+
-
     if ( opts.pager ) {
+
-
        opts.API.buildPagerLink ( opts, slideOpts, slideAdded );
+
-
        opts.API.page = page;
+
-
     }
+
-
});
+
-
 
+
-
$(document).on( 'cycle-slide-removed', function( e, opts, index, slideRemoved ) {
+
-
    if ( opts.pager ) {
+
-
        var pagers = opts.API.getComponent( 'pager' );
+
-
        pagers.each(function() {
+
-
            var pager = $(this);
+
-
            $( pager.children()[index] ).remove();
+
-
         });
+
-
    }
+
-
});
+
-
 
+
-
$(document).on( 'cycle-update-view', function( e, opts, slideOpts ) {
+
-
     var pagers;
+
-
 
+
-
     if ( opts.pager ) {
+
-
        pagers = opts.API.getComponent( 'pager' );
+
-
        pagers.each(function() {
+
-
          $(this).children().removeClass( opts.pagerActiveClass )
+
-
            .eq( opts.currSlide ).addClass( opts.pagerActiveClass );
+
-
        });
+
-
     }
+
-
});
+
-
 
+
-
$(document).on( 'cycle-destroyed', function( e, opts ) {
+
-
     var pager = opts.API.getComponent( 'pager' );
+
-
 
+
-
     if ( pager ) {
+
-
        pager.children().off( opts.pagerEvent ); // #202
+
-
        if ( opts.pagerTemplate )
+
-
            pager.empty();
+
-
     }
+
-
});
+
-
 
+
-
function buildPagerLink( opts, slideOpts, slide ) {
+
-
     var pagerLink;
+
-
    var pagers = opts.API.getComponent( 'pager' );
+
-
     pagers.each(function() {
+
-
        var pager = $(this);
+
-
        if ( slideOpts.pagerTemplate ) {
+
-
             var markup = opts.API.tmpl( slideOpts.pagerTemplate, slideOpts, opts, slide[0] );
+
-
            pagerLink = $( markup ).appendTo( pager );
+
-
        }
+
-
        else {
+
-
            pagerLink = pager.children().eq( opts.slideCount - 1 );
+
-
        }
+
-
        pagerLink.on( opts.pagerEvent, function(e) {
+
-
            e.preventDefault();
+
-
            opts.API.page( pager, e.currentTarget);
+
-
        });
+
-
     });
+
-
}
+
-
 
+
-
function page( pager, target ) {
+
-
     /*jshint validthis:true */
+
-
     var opts = this.opts();
+
-
     if ( opts.busy && ! opts.manualTrump )
+
-
        return;
+
-
 
+
-
     var index = pager.children().index( target );
+
-
     var nextSlide = index;
+
-
     var fwd = opts.currSlide < nextSlide;
+
-
     if (opts.currSlide == nextSlide) {
+
-
         return; // no op, clicked pager for the currently displayed slide
+
-
     }
+
-
     opts.nextSlide = nextSlide;
+
-
     opts.API.prepareTx( true, fwd );
+
-
     opts.API.trigger('cycle-pager-activated', [opts, pager, target ]);
+
-
}
+
})(jQuery);
})(jQuery);
-
/*! prevnext plugin for Cycle2; version: 20130709 */
+
/*!
 +
* jQuery Cycle Plugin Transition Definitions
 +
* This script is a plugin for the jQuery Cycle Plugin
 +
  * Examples and documentation at: http://malsup.com/jquery/cycle/
 +
* Copyright (c) 2007-2010 M. Alsup
 +
* Version: 2.73
 +
* Dual licensed under the MIT and GPL licenses:
 +
* http://www.opensource.org/licenses/mit-license.php
 +
* http://www.gnu.org/licenses/gpl.html
 +
*/
(function($) {
(function($) {
"use strict";
"use strict";
-
$.extend($.fn.cycle.defaults, {
+
//
-
    next:          '> .cycle-next',
+
// These functions define slide initialization and properties for the named
-
    nextEvent:      'click.cycle',
+
// transitions. To save file size feel free to remove any of these that you
-
    disabledClass:  'disabled',
+
// don't need.
-
    prev:          '> .cycle-prev',
+
//
-
    prevEvent:      'click.cycle',
+
$.fn.cycle.transitions.none = function($cont, $slides, opts) {
-
    swipe:          false
+
opts.fxFn = function(curr,next,opts,after){
-
});
+
$(next).show();
 +
$(curr).hide();
 +
after();
 +
};
 +
};
-
$(document).on( 'cycle-initialized', function( e, opts ) {
+
// not a cross-fade, fadeout only fades out the top slide
-
    opts.API.getComponent( 'next' ).on( opts.nextEvent, function(e) {
+
$.fn.cycle.transitions.fadeout = function($cont, $slides, opts) {
-
        e.preventDefault();
+
$slides.not(':eq('+opts.currSlide+')').css({ display: 'block', 'opacity': 1 });
-
        opts.API.next();
+
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;
 +
opts.cssBefore.display = 'block';
 +
opts.cssAfter.zIndex = 0;
 +
};
-
    opts.API.getComponent( 'prev' ).on( opts.prevEvent, function(e) {
+
// scrollUp/Down/Left/Right
-
        e.preventDefault();
+
$.fn.cycle.transitions.scrollUp = function($cont, $slides, opts) {
-
        opts.API.prev();
+
$cont.css('overflow','hidden');
-
    });
+
opts.before.push($.fn.cycle.commonReset);
 +
var h = $cont.height();
 +
opts.cssBefore.top = h;
 +
opts.cssBefore.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;
 +
opts.cssBefore.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;
 +
opts.cssBefore.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;
 +
opts.cssBefore.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;
 +
};
-
    if ( opts.swipe ) {
+
// slideX/slideY
-
        var nextEvent = opts.swipeVert ? 'swipeUp.cycle' : 'swipeLeft.cycle swipeleft.cycle';
+
$.fn.cycle.transitions.slideX = function($cont, $slides, opts) {
-
        var prevEvent = opts.swipeVert ? 'swipeDown.cycle' : 'swipeRight.cycle swiperight.cycle';
+
opts.before.push(function(curr, next, opts) {
-
        opts.container.on( nextEvent, function(e) {
+
$(opts.elements).not(curr).hide();
-
            opts.API.next();
+
$.fn.cycle.commonReset(curr,next,opts,false,true);
-
        });
+
opts.animIn.width = next.cycleW;
-
        opts.container.on( prevEvent, function() {
+
});
-
            opts.API.prev();
+
opts.cssBefore.left = 0;
-
        });
+
opts.cssBefore.top = 0;
-
    }
+
opts.cssBefore.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;
 +
opts.cssBefore.top = 0;
 +
opts.cssBefore.height = 0;
 +
opts.animIn.height = 'show';
 +
opts.animOut.height = 0;
 +
};
-
$(document).on( 'cycle-update-view', function( e, opts, slideOpts, currSlide ) {
+
// shuffle
-
    if ( opts.allowWrap )
+
$.fn.cycle.transitions.shuffle = function($cont, $slides, opts) {
-
        return;
+
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);
 +
});
 +
// only adjust speed once!
 +
if (!opts.speedAdjusted) {
 +
opts.speed = opts.speed / 2; // shuffle has 2 transitions
 +
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]);
-
    var cls = opts.disabledClass;
+
for (i=0; i < opts.currSlide; i++)
-
    var next = opts.API.getComponent( 'next' );
+
opts.els.push(opts.els.shift());
-
    var prev = opts.API.getComponent( 'prev' );
+
-
    var prevBoundry = opts._prevBoundry || 0;
+
-
    var nextBoundry = (opts._nextBoundry !== undefined)?opts._nextBoundry:opts.slideCount - 1;
+
-
    if ( opts.currSlide == nextBoundry )
+
// custom transition fn (hat tip to Benjamin Sterling for this bit of sweetness!)
-
        next.addClass( cls ).prop( 'disabled', true );
+
opts.fxFn = function(curr, next, opts, cb, fwd) {
-
    else
+
if (opts.rev)
-
        next.removeClass( cls ).prop( 'disabled', false );
+
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++) {
 +
if (fwd)
 +
opts.els.push(opts.els.shift());
 +
else
 +
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,10)+1+count);
 +
}
 +
$el.animate({left:0, top:0}, opts.speedOut, opts.easeOut, function() {
 +
$(fwd ? this : curr).hide();
 +
if (cb) cb();
 +
});
 +
});
 +
};
 +
$.extend(opts.cssBefore, { display: 'block', opacity: 1, top: 0, left: 0 });
 +
};
-
    if ( opts.currSlide === prevBoundry )
+
// turnUp/Down/Left/Right
-
        prev.addClass( cls ).prop( 'disabled', true );
+
$.fn.cycle.transitions.turnUp = function($cont, $slides, opts) {
-
    else
+
opts.before.push(function(curr, next, opts) {
-
        prev.removeClass( cls ).prop( 'disabled', false );
+
$.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;
 +
opts.cssBefore.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;
 +
opts.cssBefore.top = 0;
 +
opts.cssBefore.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;
 +
opts.cssBefore.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;
 +
});
 +
$.extend(opts.cssBefore, { top: 0, left: 0, width: 0 });
 +
opts.animIn.left = 0;
 +
opts.animOut.width = 0;
 +
};
 +
// zoom
 +
$.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;
 +
$.extend(opts.animIn, { top: 0, left: 0, width: next.cycleW, height: next.cycleH });
 +
$.extend(opts.animOut, { width: 0, height: 0, top: curr.cycleH/2, left: curr.cycleW/2 });
 +
});
 +
opts.cssFirst.top = 0;
 +
opts.cssFirst.left = 0;
 +
opts.cssBefore.width = 0;
 +
opts.cssBefore.height = 0;
 +
};
-
$(document).on( 'cycle-destroyed', function( e, opts ) {
+
// fadeZoom
-
    opts.API.getComponent( 'prev' ).off( opts.nextEvent );
+
$.fn.cycle.transitions.fadeZoom = function($cont, $slides, opts) {
-
    opts.API.getComponent( 'next' ).off( opts.prevEvent );
+
opts.before.push(function(curr, next, opts) {
-
    opts.container.off( 'swipeleft.cycle swiperight.cycle swipeLeft.cycle swipeRight.cycle swipeUp.cycle swipeDown.cycle' );
+
$.fn.cycle.commonReset(curr,next,opts,false,false);
-
});
+
opts.cssBefore.left = next.cycleW/2;
 +
opts.cssBefore.top = next.cycleH/2;
 +
$.extend(opts.animIn, { top: 0, left: 0, width: next.cycleW, height: next.cycleH });
 +
});
 +
opts.cssBefore.width = 0;
 +
opts.cssBefore.height = 0;
 +
opts.animOut.opacity = 0;
 +
};
-
})(jQuery);
+
// blindX
 +
$.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;
 +
opts.cssBefore.top = 0;
 +
opts.animIn.left = 0;
 +
opts.animOut.left = w;
 +
};
 +
// blindY
 +
$.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;
 +
opts.cssBefore.left = 0;
 +
opts.animIn.top = 0;
 +
opts.animOut.top = h;
 +
};
 +
// blindZ
 +
$.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;
 +
opts.cssBefore.left = w;
 +
opts.animIn.top = 0;
 +
opts.animIn.left = 0;
 +
opts.animOut.top = h;
 +
opts.animOut.left = w;
 +
};
-
/*! progressive loader plugin for Cycle2;  version: 20130315 */
+
// growX - grow horizontally from centered 0 width
-
(function($) {
+
$.fn.cycle.transitions.growX = function($cont, $slides, opts) {
-
"use strict";
+
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;
 +
opts.animIn.width = this.cycleW;
 +
opts.animOut.left = 0;
 +
});
 +
opts.cssBefore.top = 0;
 +
opts.cssBefore.width = 0;
 +
};
 +
// growY - grow vertically from centered 0 height
 +
$.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;
 +
opts.animIn.height = this.cycleH;
 +
opts.animOut.top = 0;
 +
});
 +
opts.cssBefore.height = 0;
 +
opts.cssBefore.left = 0;
 +
};
-
$.extend($.fn.cycle.defaults, {
+
// curtainX - squeeze in both edges horizontally
-
    progressive: false
+
$.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;
 +
opts.animIn.width = this.cycleW;
 +
opts.animOut.left = curr.cycleW/2;
 +
opts.animOut.width = 0;
 +
});
 +
opts.cssBefore.top = 0;
 +
opts.cssBefore.width = 0;
 +
};
 +
// curtainY - squeeze in both edges vertically
 +
$.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;
 +
opts.animIn.height = next.cycleH;
 +
opts.animOut.top = curr.cycleH/2;
 +
opts.animOut.height = 0;
 +
});
 +
opts.cssBefore.height = 0;
 +
opts.cssBefore.left = 0;
 +
};
-
$(document).on( 'cycle-pre-initialize', function( e, opts ) {
+
// cover - curr slide covered by next slide
-
    if ( !opts.progressive )
+
$.fn.cycle.transitions.cover = function($cont, $slides, opts) {
-
        return;
+
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);
 +
opts.cssAfter.display = '';
 +
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;
 +
opts.animIn.top = 0;
 +
opts.cssBefore.top = 0;
 +
opts.cssBefore.left = 0;
 +
};
-
    var API = opts.API;
+
// uncover - curr slide moves off next slide
-
    var nextFn = API.next;
+
$.fn.cycle.transitions.uncover = function($cont, $slides, opts) {
-
    var prevFn = API.prev;
+
var d = opts.direction || 'left';
-
    var prepareTxFn = API.prepareTx;
+
var w = $cont.css('overflow','hidden').width();
-
    var type = $.type( opts.progressive );
+
var h = $cont.height();
-
    var slides, scriptEl;
+
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;
 +
opts.animIn.top = 0;
 +
opts.cssBefore.top = 0;
 +
opts.cssBefore.left = 0;
 +
};
-
    if ( type == 'array' ) {
+
// toss - move top slide and fade away
-
        slides = opts.progressive;
+
$.fn.cycle.transitions.toss = function($cont, $slides, opts) {
-
    }
+
var w = $cont.css('overflow','visible').width();
-
    else if ($.isFunction( opts.progressive ) ) {
+
var h = $cont.height();
-
        slides = opts.progressive( opts );
+
opts.before.push(function(curr, next, opts) {
-
    }
+
$.fn.cycle.commonReset(curr,next,opts,true,true,true);
-
    else if ( type == 'string' ) {
+
// provide default toss settings if animOut not provided
-
        scriptEl = $( opts.progressive );
+
if (!opts.animOut.left && !opts.animOut.top)
-
        slides = $.trim( scriptEl.html() );
+
$.extend(opts.animOut, { left: w*2, top: -h/2, opacity: 0 });
-
        if ( !slides )
+
else
-
            return;
+
opts.animOut.opacity = 0;
-
        // is it json array?
+
});
-
        if ( /^(\[)/.test( slides ) ) {
+
opts.cssBefore.left = 0;
-
            try {
+
opts.cssBefore.top = 0;
-
                slides = $.parseJSON( slides );
+
opts.animIn.left = 0;
-
            }
+
};
-
            catch(err) {
+
-
                API.log( 'error parsing progressive slides', err );
+
-
                return;
+
-
            }
+
-
        }
+
-
        else {
+
-
            // plain text, split on delimeter
+
-
            slides = slides.split( new RegExp( scriptEl.data('cycle-split') || '\n') );
+
-
           
+
-
            // #95; look for empty slide
+
-
            if ( ! slides[ slides.length - 1 ] )
+
-
                slides.pop();
+
-
        }
+
-
    }
+
 +
// wipe - clip animation
 +
$.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,10);
 +
var left = parseInt(w/2,10);
 +
clip = 'rect('+top+'px '+left+'px '+top+'px '+left+'px)';
 +
}
 +
}
 +
opts.cssBefore.clip = opts.cssBefore.clip || clip || 'rect(0px 0px 0px 0px)';
-
    if ( prepareTxFn ) {
+
var d = opts.cssBefore.clip.match(/(\d+)/g);
-
        API.prepareTx = function( manual, fwd ) {
+
var t = parseInt(d[0],10), r = parseInt(d[1],10), b = parseInt(d[2],10), l = parseInt(d[3],10);
-
            var index, slide;
+
-
            if ( manual || slides.length === 0 ) {
+
opts.before.push(function(curr, next, opts) {
-
                prepareTxFn.apply( opts.API, [ manual, fwd ] );
+
if (curr == next) return;
-
                return;
+
var $curr = $(curr), $next = $(next);
-
            }
+
$.fn.cycle.commonReset(curr,next,opts,true,true,false);
 +
opts.cssAfter.display = 'block';
-
            if ( fwd && opts.currSlide == ( opts.slideCount-1) ) {
+
var step = 1, count = parseInt((opts.speedIn / 13),10) - 1;
-
                slide = slides[ 0 ];
+
(function f() {
-
                slides = slides.slice( 1 );
+
var tt = t ? t - parseInt(step * (t/count),10) : 0;
-
                opts.container.one('cycle-slide-added', function(e, opts ) {
+
var ll = l ? l - parseInt(step * (l/count),10) : 0;
-
                    setTimeout(function() {
+
var bb = b < h ? b + parseInt(step * ((h-b)/count || 1),10) : h;
-
                        opts.API.advanceSlide( 1 );
+
var rr = r < w ? r + parseInt(step * ((w-r)/count || 1),10) : w;
-
                    },50);
+
$next.css({ clip: 'rect('+tt+'px '+rr+'px '+bb+'px '+ll+'px)' });
-
                });
+
(step++ <= count) ? setTimeout(f, 13) : $curr.css('display', 'none');
-
                opts.API.add( slide );
+
})();
-
            }
+
});
-
            else if ( !fwd && opts.currSlide === 0 ) {
+
$.extend(opts.cssBefore, { display: 'block', opacity: 1, top: 0, left: 0 });
-
                index = slides.length-1;
+
opts.animIn   = { left: 0 };
-
                slide = slides[ index ];
+
opts.animOut  = { left: 0 };
-
                slides = slides.slice( 0, index );
+
};
-
                opts.container.one('cycle-slide-added', function(e, opts ) {
+
-
                    setTimeout(function() {
+
-
                        opts.currSlide = 1;
+
-
                        opts.API.advanceSlide( -1 );
+
-
                    },50);
+
-
                });
+
-
                opts.API.add( slide, true );
+
-
            }
+
-
            else {
+
-
                prepareTxFn.apply( opts.API, [ manual, fwd ] );
+
-
            }
+
-
        };
+
-
    }
+
-
 
+
-
    if ( nextFn ) {
+
-
        API.next = function() {
+
-
            var opts = this.opts();
+
-
            if ( slides.length && opts.currSlide == ( opts.slideCount - 1 ) ) {
+
-
                var slide = slides[ 0 ];
+
-
                slides = slides.slice( 1 );
+
-
                opts.container.one('cycle-slide-added', function(e, opts ) {
+
-
                    nextFn.apply( opts.API );
+
-
                    opts.container.removeClass('cycle-loading');
+
-
                });
+
-
                opts.container.addClass('cycle-loading');
+
-
                opts.API.add( slide );
+
-
            }
+
-
            else {
+
-
                nextFn.apply( opts.API );  
+
-
            }
+
-
        };
+
-
    }
+
-
   
+
-
    if ( prevFn ) {
+
-
        API.prev = function() {
+
-
            var opts = this.opts();
+
-
            if ( slides.length && opts.currSlide === 0 ) {
+
-
                var index = slides.length-1;
+
-
                var slide = slides[ index ];
+
-
                slides = slides.slice( 0, index );
+
-
                opts.container.one('cycle-slide-added', function(e, opts ) {
+
-
                    opts.currSlide = 1;
+
-
                    opts.API.advanceSlide( -1 );
+
-
                    opts.container.removeClass('cycle-loading');
+
-
                });
+
-
                opts.container.addClass('cycle-loading');
+
-
                opts.API.add( slide, true );
+
-
            }
+
-
            else {
+
-
                prevFn.apply( opts.API );
+
-
            }
+
-
        };
+
-
    }
+
-
});
+
})(jQuery);
})(jQuery);
-
 
-
/*! tmpl plugin for Cycle2;  version: 20121227 */
 
-
(function($) {
 
-
"use strict";
 
-
 
-
$.extend($.fn.cycle.defaults, {
 
-
    tmplRegex: '{{((.)?.*?)}}'
 
-
});
 
-
 
-
$.extend($.fn.cycle.API, {
 
-
    tmpl: function( str, opts /*, ... */) {
 
-
        var regex = new RegExp( opts.tmplRegex || $.fn.cycle.defaults.tmplRegex, 'g' );
 
-
        var args = $.makeArray( arguments );
 
-
        args.shift();
 
-
        return str.replace(regex, function(_, str) {
 
-
            var i, j, obj, prop, names = str.split('.');
 
-
            for (i=0; i < args.length; i++) {
 
-
                obj = args[i];
 
-
                if ( ! obj )
 
-
                    continue;
 
-
                if (names.length > 1) {
 
-
                    prop = obj;
 
-
                    for (j=0; j < names.length; j++) {
 
-
                        obj = prop;
 
-
                        prop = prop[ names[j] ] || str;
 
-
                    }
 
-
                } else {
 
-
                    prop = obj[str];
 
-
                }
 
-
 
-
                if ($.isFunction(prop))
 
-
                    return prop.apply(obj, args);
 
-
                if (prop !== undefined && prop !== null && prop != str)
 
-
                    return prop;
 
-
            }
 
-
            return str;
 
-
        });
 
-
    }
 
-
});   
 
-
 
-
})(jQuery);
 
-
 
</script>
</script>

Revision as of 15:51, 20 September 2013