PageSourceSearch

http://mahabadcity.ir/UILibrary/PlugIn/jquery-cycle/jquery.cycle.all.js

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