PageSourceSearch

https://nouveauraw.com/wp-content/themes/widescreen/lib/js/jquery.cycle.all.js?ver=6.8.10

js nouveauraw.com collected 2026-10-02 06:23:58 UTC 51,679 bytes, 1,538 lines download raw bytes

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

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.