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