drupal.locale = { 'pluralformula': function ($n) { return number(($n!=1)); }, 'strings': {"":{"an ajax http error occurred.":"\u53d1\u751f\u4e00\u4e2aajax http\u9519\u8bef\u3002","http result code: !status":"http\u8fd4\u56de\u4ee3\u7801\uff1a!status","an ajax http request terminated abnormally.":"\u4e00\u4e2aajax http\u8bf7\u6c42\u5f02\u5e38\u7ec8\u6b62\u3002","debugging information follows.":"\u8c03\u8bd5\u4fe1\u606f\u5982\u4e0b\u3002","path: !uri":"\u8def\u5f84\uff1a!uri","statustext: !statustext":"\u72b6\u6001\u6587\u672c: !statustext","responsetext: !responsetext":"\u54cd\u5e94\u6587\u672c\uff1a !responsetext","readystate: !readystate":"\u51c6\u5907\u72b6\u6001\uff1a !readystate","loading":"\u6b63\u5728\u52a0\u8f7d","(active tab)":"\uff08\u6d3b\u52a8\u6807\u7b7e\uff09","hide":"\u9690\u85cf","show":"\u663e\u793a","re-order rows by numerical weight instead of dragging.":"\u4e0d\u7528\u62d6\u653e\u64cd\u4f5c\uff0c\u800c\u7528\u6570\u5b57\u6743\u91cd\u65b9\u5f0f\u91cd\u65b0\u5bf9\u884c\u6392\u5e8f\u3002","show row weights":"\u663e\u793a\u884c\u7684\u6743\u91cd","hide row weights":"\u9690\u85cf\u884c\u7684\u6743\u91cd","drag to re-order":"\u62d6\u653e\u91cd\u65b0\u6392\u5e8f","changes made in this table will not be saved until the form is submitted.":"\u5728\u6b64\u8868\u683c\u4e2d\u7684\u4fee\u6539\u53ea\u6709\u5728\u6574\u4e2a\u8868\u5355\u63d0\u4ea4\u540e\u624d\u4f1a\u88ab\u4fdd\u5b58\u3002","enabled":"\u5df2\u542f\u7528","hide shortcuts":"\u9690\u85cf\u5feb\u6377\u952e","disabled":"\u505c\u7528","@title dialog":"@title \u5bf9\u8bdd\u6846","configure":"\u914d\u7f6e","show shortcuts":"\u663e\u793a\u5feb\u6377\u65b9\u5f0f","edit":"\u7f16\u8f91","add":"\u6dfb\u52a0","done":"\u5b8c\u6210","select all rows in this table":"\u9009\u62e9\u6b64\u8868\u4e2d\u6240\u6709\u7684\u884c","deselect all rows in this table":"\u53d6\u6d88\u9009\u62e9\u6b64\u8868\u4e2d\u6240\u6709\u7684\u884c","not published":"\u672a\u53d1\u8868","please wait...":"\u8bf7\u7a0d\u7b49...","by @name on @date":"by @name \u5728 @date","by @name":"\u6309 @name","not in menu":"\u4e0d\u5728\u83dc\u5355\u4e2d","alias: @alias":"\u522b\u540d\uff1a@alias","no alias":"\u65e0\u522b\u540d","new revision":"\u65b0\u5efa\u4fee\u8ba2\u7248\u672c","the changes to these blocks will not be saved until the \u003cem\u003esave blocks\u003c\/em\u003e button is clicked.":"\u8fd9\u4e9b\u533a\u5757\u7684\u53d8\u66f4\u4e0d\u4f1a\u88ab\u50a8\u5b58\u8d77\u6765\uff0c\u9664\u975e\u60a8\u6309\u4e0b\u003cem\u003e\u50a8\u5b58\u533a\u5757\u003c\/em\u003e\u7684\u6309\u94ae\u3002","this permission is inherited from the authenticated user role.":"\u6b64\u6743\u9650\u7ee7\u627f\u81ea\u6ce8\u518c\u7528\u6237\u89d2\u8272\u3002","no revision":"\u6ca1\u6709\u4fee\u8ba2\u7248\u672c","@number comments per page":"\u6bcf\u9875 @number \u6761\u8bc4\u8bba","requires a title":"\u9700\u8981\u6807\u9898","not restricted":"\u672a\u53d7\u9650\u5236","not customizable":"\u4e0d\u53ef\u81ea\u5b9a\u4e49\u7684","restricted to certain pages":"\u9650\u5236\u5230\u7279\u5b9a\u7684\u533a\u5757","the block cannot be placed in this region.":"\u8fd9\u4e2a\u533a\u5757\u4e0d\u80fd\u653e\u624d\u8fd9\u4e2a\u533a\u57df\u4e2d\u3002","customize dashboard":"\u81ea\u5b9a\u4e49\u9762\u677f","hide summary":"\u9690\u85cf\u6458\u8981","edit summary":"\u7f16\u8f91\u6458\u8981","don\u0027t display post information":"\u4e0d\u8981\u663e\u793a\u53d1\u5e03\u4fe1\u606f\u3002","the selected file %filename cannot be uploaded. only files with the following extensions are allowed: %extensions.":"\u9009\u62e9\u7684\u6587\u4ef6%filename\u65e0\u6cd5\u4e0a\u4f20\u3002\u53ea\u6709\u4ee5\u4e0b\u7c7b\u578b\u7684\u6587\u4ef6\u88ab\u5141\u8bb8\uff1a%extensions\u3002","autocomplete popup":"\u81ea\u52a8\u5b8c\u6210\u7684\u5f39\u51fa\u7a97\u53e3","searching for matches...":"\u6b63\u5728\u67e5\u627e\u5339\u914d\u9879..."}} };; /*! * jquery cycle plugin (with transition definitions) * examples and documentation at: http://jquery.malsup.com/cycle/ * copyright (c) 2007-2013 m. alsup * version: 3.0.3 (11-jul-2013) * dual licensed under the mit and gpl licenses. * http://jquery.malsup.com/license.html * requires: jquery v1.7.1 or later */ ;(function($, undefined) { "use strict"; var ver = '3.0.3'; function debug(s) { if ($.fn.cycle.debug) log(s); } function log() { /*global console */ if (window.console && console.log) console.log('[cycle] ' + array.prototype.join.call(arguments,' ')); } $.expr[':'].paused = function(el) { return el.cyclepause; }; // the options arg can be... // a number - indicates an immediate transition should occur to the given slide index // a string - 'pause', 'resume', 'toggle', 'next', 'prev', 'stop', 'destroy' or the name of a transition effect (ie, 'fade', 'zoom', etc) // an object - properties to control the slideshow // // the arg2 arg can be... // the name of an fx (only used in conjunction with a numeric value for 'options') // the value true (only used in first arg == 'resume') and indicates // that the resume should occur immediately (not wait for next timeout) $.fn.cycle = function(options, arg2) { var o = { s: this.selector, c: this.context }; // in 1.3+ we can fix mistakes with the ready state if (this.length === 0 && options != 'stop') { if (!$.isready && o.s) { log('dom not ready, queuing slideshow'); $(function() { $(o.s,o.c).cycle(options,arg2); }); return this; } // is your dom ready? http://docs.jquery.com/tutorials:introducing_$(document).ready() log('terminating; zero elements found by selector' + ($.isready ? '' : ' (dom not ready)')); return this; } // iterate the matched nodeset return this.each(function() { var opts = handlearguments(this, options, arg2); if (opts === false) return; opts.updateactivepagerlink = opts.updateactivepagerlink || $.fn.cycle.updateactivepagerlink; // stop existing slideshow for this container (if there is one) if (this.cycletimeout) cleartimeout(this.cycletimeout); this.cycletimeout = this.cyclepause = 0; this.cyclestop = 0; // issue #108 var $cont = $(this); var $slides = opts.slideexpr ? $(opts.slideexpr, this) : $cont.children(); var els = $slides.get(); if (els.length < 2) { log('terminating; too few slides: ' + els.length); return; } var opts2 = buildoptions($cont, $slides, els, opts, o); if (opts2 === false) return; var starttime = opts2.continuous ? 10 : gettimeout(els[opts2.currslide], els[opts2.nextslide], opts2, !opts2.backwards); // if it's an auto slideshow, kick it off if (starttime) { starttime += (opts2.delay || 0); if (starttime < 10) starttime = 10; debug('first timeout: ' + starttime); this.cycletimeout = settimeout(function(){go(els,opts2,0,!opts.backwards);}, starttime); } }); }; function triggerpause(cont, byhover, onpager) { var opts = $(cont).data('cycle.opts'); if (!opts) return; var paused = !!cont.cyclepause; if (paused && opts.paused) opts.paused(cont, opts, byhover, onpager); else if (!paused && opts.resumed) opts.resumed(cont, opts, byhover, onpager); } // process the args that were passed to the plugin fn function handlearguments(cont, options, arg2) { if (cont.cyclestop === undefined) cont.cyclestop = 0; if (options === undefined || options === null) options = {}; if (options.constructor == string) { switch(options) { case 'destroy': case 'stop': var opts = $(cont).data('cycle.opts'); if (!opts) return false; cont.cyclestop++; // callbacks look for change if (cont.cycletimeout) cleartimeout(cont.cycletimeout); cont.cycletimeout = 0; if (opts.elements) $(opts.elements).stop(); $(cont).removedata('cycle.opts'); if (options == 'destroy') destroy(cont, opts); return false; case 'toggle': cont.cyclepause = (cont.cyclepause === 1) ? 0 : 1; checkinstantresume(cont.cyclepause, arg2, cont); triggerpause(cont); return false; case 'pause': cont.cyclepause = 1; triggerpause(cont); return false; case 'resume': cont.cyclepause = 0; checkinstantresume(false, arg2, cont); triggerpause(cont); return false; case 'prev': case 'next': opts = $(cont).data('cycle.opts'); if (!opts) { log('options not found, "prev/next" ignored'); return false; } if (typeof arg2 == 'string') opts.onetimefx = arg2; $.fn.cycle[options](opts); return false; default: options = { fx: options }; } return options; } else if (options.constructor == number) { // go to the requested slide var num = options; options = $(cont).data('cycle.opts'); if (!options) { log('options not found, can not advance slide'); return false; } if (num < 0 || num >= options.elements.length) { log('invalid slide index: ' + num); return false; } options.nextslide = num; if (cont.cycletimeout) { cleartimeout(cont.cycletimeout); cont.cycletimeout = 0; } if (typeof arg2 == 'string') options.onetimefx = arg2; go(options.elements, options, 1, num >= options.currslide); return false; } return options; function checkinstantresume(ispaused, arg2, cont) { if (!ispaused && arg2 === true) { // resume now! var options = $(cont).data('cycle.opts'); if (!options) { log('options not found, can not resume'); return false; } if (cont.cycletimeout) { cleartimeout(cont.cycletimeout); cont.cycletimeout = 0; } go(options.elements, options, 1, !options.backwards); } } } function removefilter(el, opts) { if (!$.support.opacity && opts.cleartype && el.style.filter) { try { el.style.removeattribute('filter'); } catch(smother) {} // handle old opera versions } } // unbind event handlers function destroy(cont, opts) { if (opts.next) $(opts.next).unbind(opts.prevnextevent); if (opts.prev) $(opts.prev).unbind(opts.prevnextevent); if (opts.pager || opts.pageranchorbuilder) $.each(opts.pageranchors || [], function() { this.unbind().remove(); }); opts.pageranchors = null; $(cont).unbind('mouseenter.cycle mouseleave.cycle'); if (opts.destroy) // callback opts.destroy(opts); } // one-time initialization function buildoptions($cont, $slides, els, options, o) { var startingslidespecified; // support metadata plugin (v1.0 and v2.0) var opts = $.extend({}, $.fn.cycle.defaults, options || {}, $.metadata ? $cont.metadata() : $.meta ? $cont.data() : {}); var meta = $.isfunction($cont.data) ? $cont.data(opts.metaattr) : null; if (meta) opts = $.extend(opts, meta); if (opts.autostop) opts.countdown = opts.autostopcount || els.length; var cont = $cont[0]; $cont.data('cycle.opts', opts); opts.$cont = $cont; opts.stopcount = cont.cyclestop; opts.elements = els; opts.before = opts.before ? [opts.before] : []; opts.after = opts.after ? [opts.after] : []; // push some after callbacks if (!$.support.opacity && opts.cleartype) opts.after.push(function() { removefilter(this, opts); }); if (opts.continuous) opts.after.push(function() { go(els,opts,0,!opts.backwards); }); saveoriginalopts(opts); // cleartype corrections if (!$.support.opacity && opts.cleartype && !opts.cleartypenobg) cleartypefix($slides); // container requires non-static position so that slides can be position within if ($cont.css('position') == 'static') $cont.css('position', 'relative'); if (opts.width) $cont.width(opts.width); if (opts.height && opts.height != 'auto') $cont.height(opts.height); if (opts.startingslide !== undefined) { opts.startingslide = parseint(opts.startingslide,10); if (opts.startingslide >= els.length || opts.startslide < 0) opts.startingslide = 0; // catch bogus input else startingslidespecified = true; } else if (opts.backwards) opts.startingslide = els.length - 1; else opts.startingslide = 0; // if random, mix up the slide array if (opts.random) { opts.randommap = []; for (var i = 0; i < els.length; i++) opts.randommap.push(i); opts.randommap.sort(function(a,b) {return math.random() - 0.5;}); if (startingslidespecified) { // try to find the specified starting slide and if found set start slide index in the map accordingly for ( var cnt = 0; cnt < els.length; cnt++ ) { if ( opts.startingslide == opts.randommap[cnt] ) { opts.randomindex = cnt; } } } else { opts.randomindex = 1; opts.startingslide = opts.randommap[1]; } } else if (opts.startingslide >= els.length) opts.startingslide = 0; // catch bogus input opts.currslide = opts.startingslide || 0; var first = opts.startingslide; // set position and zindex on all the slides $slides.css({position: 'absolute', top:0, left:0}).hide().each(function(i) { var z; if (opts.backwards) z = first ? i <= first ? els.length + (i-first) : first-i : els.length-i; else z = first ? i >= first ? els.length - (i-first) : first-i : els.length-i; $(this).css('z-index', z); }); // make sure first slide is visible $(els[first]).css('opacity',1).show(); // opacity bit needed to handle restart use case removefilter(els[first], opts); // stretch slides if (opts.fit) { if (!opts.aspect) { if (opts.width) $slides.width(opts.width); if (opts.height && opts.height != 'auto') $slides.height(opts.height); } else { $slides.each(function(){ var $slide = $(this); var ratio = (opts.aspect === true) ? $slide.width()/$slide.height() : opts.aspect; if( opts.width && $slide.width() != opts.width ) { $slide.width( opts.width ); $slide.height( opts.width / ratio ); } if( opts.height && $slide.height() < opts.height ) { $slide.height( opts.height ); $slide.width( opts.height * ratio ); } }); } } if (opts.center && ((!opts.fit) || opts.aspect)) { $slides.each(function(){ var $slide = $(this); $slide.css({ "margin-left": opts.width ? ((opts.width - $slide.width()) / 2) + "px" : 0, "margin-top": opts.height ? ((opts.height - $slide.height()) / 2) + "px" : 0 }); }); } if (opts.center && !opts.fit && !opts.slideresize) { $slides.each(function(){ var $slide = $(this); $slide.css({ "margin-left": opts.width ? ((opts.width - $slide.width()) / 2) + "px" : 0, "margin-top": opts.height ? ((opts.height - $slide.height()) / 2) + "px" : 0 }); }); } // stretch container var reshape = (opts.containerresize || opts.containerresizeheight) && $cont.innerheight() < 1; if (reshape) { // do this only if container has no size http://tinyurl.com/da2oa9 var maxw = 0, maxh = 0; for(var j=0; j < els.length; j++) { var $e = $(els[j]), e = $e[0], w = $e.outerwidth(), h = $e.outerheight(); if (!w) w = e.offsetwidth || e.width || $e.attr('width'); if (!h) h = e.offsetheight || e.height || $e.attr('height'); maxw = w > maxw ? w : maxw; maxh = h > maxh ? h : maxh; } if (opts.containerresize && maxw > 0 && maxh > 0) $cont.css({width:maxw+'px',height:maxh+'px'}); if (opts.containerresizeheight && maxh > 0) $cont.css({height:maxh+'px'}); } var pauseflag = false; // https://github.com/malsup/cycle/issues/44 if (opts.pause) $cont.bind('mouseenter.cycle', function(){ pauseflag = true; this.cyclepause++; triggerpause(cont, true); }).bind('mouseleave.cycle', function(){ if (pauseflag) this.cyclepause--; triggerpause(cont, true); }); if (supportmultitransitions(opts) === false) return false; // apparently a lot of people use image slideshows without height/width attributes on the images. // cycle 2.50+ requires the sizing info for every slide; this block tries to deal with that. var requeue = false; options.requeueattempts = options.requeueattempts || 0; $slides.each(function() { // try to get height/width of each slide var $el = $(this); this.cycleh = (opts.fit && opts.height) ? opts.height : ($el.height() || this.offsetheight || this.height || $el.attr('height') || 0); this.cyclew = (opts.fit && opts.width) ? opts.width : ($el.width() || this.offsetwidth || this.width || $el.attr('width') || 0); if ( $el.is('img') ) { var loading = (this.cycleh === 0 && this.cyclew === 0 && !this.complete); // don't requeue for images that are still loading but have a valid size if (loading) { if (o.s && opts.requeueonimagenotloaded && ++options.requeueattempts < 100) { // track retry count so we don't loop forever log(options.requeueattempts,' - img slide not loaded, requeuing slideshow: ', this.src, this.cyclew, this.cycleh); settimeout(function() {$(o.s,o.c).cycle(options);}, opts.requeuetimeout); requeue = true; return false; // break each loop } else { log('could not determine size of image: '+this.src, this.cyclew, this.cycleh); } } } return true; }); if (requeue) return false; opts.cssbefore = opts.cssbefore || {}; opts.cssafter = opts.cssafter || {}; opts.cssfirst = opts.cssfirst || {}; opts.animin = opts.animin || {}; opts.animout = opts.animout || {}; $slides.not(':eq('+first+')').css(opts.cssbefore); $($slides[first]).css(opts.cssfirst); if (opts.timeout) { opts.timeout = parseint(opts.timeout,10); // ensure that timeout and speed settings are sane if (opts.speed.constructor == string) opts.speed = $.fx.speeds[opts.speed] || parseint(opts.speed,10); if (!opts.sync) opts.speed = opts.speed / 2; var buffer = opts.fx == 'none' ? 0 : opts.fx == 'shuffle' ? 500 : 250; while((opts.timeout - opts.speed) < buffer) // sanitize timeout opts.timeout += opts.speed; } if (opts.easing) opts.easein = opts.easeout = opts.easing; if (!opts.speedin) opts.speedin = opts.speed; if (!opts.speedout) opts.speedout = opts.speed; opts.slidecount = els.length; opts.currslide = opts.lastslide = first; if (opts.random) { if (++opts.randomindex == els.length) opts.randomindex = 0; opts.nextslide = opts.randommap[opts.randomindex]; } else if (opts.backwards) opts.nextslide = opts.startingslide === 0 ? (els.length-1) : opts.startingslide-1; else opts.nextslide = opts.startingslide >= (els.length-1) ? 0 : opts.startingslide+1; // run transition init fn if (!opts.multifx) { var init = $.fn.cycle.transitions[opts.fx]; if ($.isfunction(init)) init($cont, $slides, opts); else if (opts.fx != 'custom' && !opts.multifx) { log('unknown transition: ' + opts.fx,'; slideshow terminating'); return false; } } // fire artificial events var e0 = $slides[first]; if (!opts.skipinitializationcallbacks) { if (opts.before.length) opts.before[0].apply(e0, [e0, e0, opts, true]); if (opts.after.length) opts.after[0].apply(e0, [e0, e0, opts, true]); } if (opts.next) $(opts.next).bind(opts.prevnextevent,function(){return advance(opts,1);}); if (opts.prev) $(opts.prev).bind(opts.prevnextevent,function(){return advance(opts,0);}); if (opts.pager || opts.pageranchorbuilder) buildpager(els,opts); exposeaddslide(opts, els); return opts; } // save off original opts so we can restore after clearing state function saveoriginalopts(opts) { opts.original = { before: [], after: [] }; opts.original.cssbefore = $.extend({}, opts.cssbefore); opts.original.cssafter = $.extend({}, opts.cssafter); opts.original.animin = $.extend({}, opts.animin); opts.original.animout = $.extend({}, opts.animout); $.each(opts.before, function() { opts.original.before.push(this); }); $.each(opts.after, function() { opts.original.after.push(this); }); } function supportmultitransitions(opts) { var i, tx, txs = $.fn.cycle.transitions; // look for multiple effects if (opts.fx.indexof(',') > 0) { opts.multifx = true; opts.fxs = opts.fx.replace(/\s*/g,'').split(','); // discard any bogus effect names for (i=0; i < opts.fxs.length; i++) { var fx = opts.fxs[i]; tx = txs[fx]; if (!tx || !txs.hasownproperty(fx) || !$.isfunction(tx)) { log('discarding unknown transition: ',fx); opts.fxs.splice(i,1); i--; } } // if we have an empty list then we threw everything away! if (!opts.fxs.length) { log('no valid transitions named; slideshow terminating.'); return false; } } else if (opts.fx == 'all') { // auto-gen the list of transitions opts.multifx = true; opts.fxs = []; for (var p in txs) { if (txs.hasownproperty(p)) { tx = txs[p]; if (txs.hasownproperty(p) && $.isfunction(tx)) opts.fxs.push(p); } } } if (opts.multifx && opts.randomizeeffects) { // munge the fxs array to make effect selection random var r1 = math.floor(math.random() * 20) + 30; for (i = 0; i < r1; i++) { var r2 = math.floor(math.random() * opts.fxs.length); opts.fxs.push(opts.fxs.splice(r2,1)[0]); } debug('randomized fx sequence: ',opts.fxs); } return true; } // provide a mechanism for adding slides after the slideshow has started function exposeaddslide(opts, els) { opts.addslide = function(newslide, prepend) { var $s = $(newslide), s = $s[0]; if (!opts.autostopcount) opts.countdown++; els[prepend?'unshift':'push'](s); if (opts.els) opts.els[prepend?'unshift':'push'](s); // shuffle needs this opts.slidecount = els.length; // add the slide to the random map and resort if (opts.random) { opts.randommap.push(opts.slidecount-1); opts.randommap.sort(function(a,b) {return math.random() - 0.5;}); } $s.css('position','absolute'); $s[prepend?'prependto':'appendto'](opts.$cont); if (prepend) { opts.currslide++; opts.nextslide++; } if (!$.support.opacity && opts.cleartype && !opts.cleartypenobg) cleartypefix($s); if (opts.fit && opts.width) $s.width(opts.width); if (opts.fit && opts.height && opts.height != 'auto') $s.height(opts.height); s.cycleh = (opts.fit && opts.height) ? opts.height : $s.height(); s.cyclew = (opts.fit && opts.width) ? opts.width : $s.width(); $s.css(opts.cssbefore); if (opts.pager || opts.pageranchorbuilder) $.fn.cycle.createpageranchor(els.length-1, s, $(opts.pager), els, opts); if ($.isfunction(opts.onaddslide)) opts.onaddslide($s); else $s.hide(); // default behavior }; } // reset internal state; we do this on every pass in order to support multiple effects $.fn.cycle.resetstate = function(opts, fx) { fx = fx || opts.fx; opts.before = []; opts.after = []; opts.cssbefore = $.extend({}, opts.original.cssbefore); opts.cssafter = $.extend({}, opts.original.cssafter); opts.animin = $.extend({}, opts.original.animin); opts.animout = $.extend({}, opts.original.animout); opts.fxfn = null; $.each(opts.original.before, function() { opts.before.push(this); }); $.each(opts.original.after, function() { opts.after.push(this); }); // re-init var init = $.fn.cycle.transitions[fx]; if ($.isfunction(init)) init(opts.$cont, $(opts.elements), opts); }; // this is the main engine fn, it handles the timeouts, callbacks and slide index mgmt function go(els, opts, manual, fwd) { var p = opts.$cont[0], curr = els[opts.currslide], next = els[opts.nextslide]; // opts.busy is true if we're in the middle of an animation if (manual && opts.busy && opts.manualtrump) { // let manual transitions requests trump active ones debug('manualtrump in go(), stopping active transition'); $(els).stop(true,true); opts.busy = 0; cleartimeout(p.cycletimeout); } // don't begin another timeout-based transition if there is one active if (opts.busy) { debug('transition active, ignoring new tx request'); return; } // stop cycling if we have an outstanding stop request if (p.cyclestop != opts.stopcount || p.cycletimeout === 0 && !manual) return; // check to see if we should stop cycling based on autostop options if (!manual && !p.cyclepause && !opts.bounce && ((opts.autostop && (--opts.countdown <= 0)) || (opts.nowrap && !opts.random && opts.nextslide < opts.currslide))) { if (opts.end) opts.end(opts); return; } // if slideshow is paused, only transition on a manual trigger var changed = false; if ((manual || !p.cyclepause) && (opts.nextslide != opts.currslide)) { changed = true; var fx = opts.fx; // keep trying to get the slide size if we don't have it yet curr.cycleh = curr.cycleh || $(curr).height(); curr.cyclew = curr.cyclew || $(curr).width(); next.cycleh = next.cycleh || $(next).height(); next.cyclew = next.cyclew || $(next).width(); // support multiple transition types if (opts.multifx) { if (fwd && (opts.lastfx === undefined || ++opts.lastfx >= opts.fxs.length)) opts.lastfx = 0; else if (!fwd && (opts.lastfx === undefined || --opts.lastfx < 0)) opts.lastfx = opts.fxs.length - 1; fx = opts.fxs[opts.lastfx]; } // one-time fx overrides apply to: $('div').cycle(3,'zoom'); if (opts.onetimefx) { fx = opts.onetimefx; opts.onetimefx = null; } $.fn.cycle.resetstate(opts, fx); // run the before callbacks if (opts.before.length) $.each(opts.before, function(i,o) { if (p.cyclestop != opts.stopcount) return; o.apply(next, [curr, next, opts, fwd]); }); // stage the after callacks var after = function() { opts.busy = 0; $.each(opts.after, function(i,o) { if (p.cyclestop != opts.stopcount) return; o.apply(next, [curr, next, opts, fwd]); }); if (!p.cyclestop) { // queue next transition queuenext(); } }; debug('tx firing('+fx+'); currslide: ' + opts.currslide + '; nextslide: ' + opts.nextslide); // get ready to perform the transition opts.busy = 1; if (opts.fxfn) // fx function provided? opts.fxfn(curr, next, opts, after, fwd, manual && opts.fastonevent); else if ($.isfunction($.fn.cycle[opts.fx])) // fx plugin ? $.fn.cycle[opts.fx](curr, next, opts, after, fwd, manual && opts.fastonevent); else $.fn.cycle.custom(curr, next, opts, after, fwd, manual && opts.fastonevent); } else { queuenext(); } if (changed || opts.nextslide == opts.currslide) { // calculate the next slide var roll; opts.lastslide = opts.currslide; if (opts.random) { opts.currslide = opts.nextslide; if (++opts.randomindex == els.length) { opts.randomindex = 0; opts.randommap.sort(function(a,b) {return math.random() - 0.5;}); } opts.nextslide = opts.randommap[opts.randomindex]; if (opts.nextslide == opts.currslide) opts.nextslide = (opts.currslide == opts.slidecount - 1) ? 0 : opts.currslide + 1; } else if (opts.backwards) { roll = (opts.nextslide - 1) < 0; if (roll && opts.bounce) { opts.backwards = !opts.backwards; opts.nextslide = 1; opts.currslide = 0; } else { opts.nextslide = roll ? (els.length-1) : opts.nextslide-1; opts.currslide = roll ? 0 : opts.nextslide+1; } } else { // sequence roll = (opts.nextslide + 1) == els.length; if (roll && opts.bounce) { opts.backwards = !opts.backwards; opts.nextslide = els.length-2; opts.currslide = els.length-1; } else { opts.nextslide = roll ? 0 : opts.nextslide+1; opts.currslide = roll ? els.length-1 : opts.nextslide-1; } } } if (changed && opts.pager) opts.updateactivepagerlink(opts.pager, opts.currslide, opts.activepagerclass); function queuenext() { // stage the next transition var ms = 0, timeout = opts.timeout; if (opts.timeout && !opts.continuous) { ms = gettimeout(els[opts.currslide], els[opts.nextslide], opts, fwd); if (opts.fx == 'shuffle') ms -= opts.speedout; } else if (opts.continuous && p.cyclepause) // continuous shows work off an after callback, not this timer logic ms = 10; if (ms > 0) p.cycletimeout = settimeout(function(){ go(els, opts, 0, !opts.backwards); }, ms); } } // invoked after transition $.fn.cycle.updateactivepagerlink = function(pager, currslide, clsname) { $(pager).each(function() { $(this).children().removeclass(clsname).eq(currslide).addclass(clsname); }); }; // calculate timeout value for current transition function gettimeout(curr, next, opts, fwd) { if (opts.timeoutfn) { // call user provided calc fn var t = opts.timeoutfn.call(curr,curr,next,opts,fwd); while (opts.fx != 'none' && (t - opts.speed) < 250) // sanitize timeout t += opts.speed; debug('calculated timeout: ' + t + '; speed: ' + opts.speed); if (t !== false) return t; } return opts.timeout; } // expose next/prev function, caller must pass in state $.fn.cycle.next = function(opts) { advance(opts,1); }; $.fn.cycle.prev = function(opts) { advance(opts,0);}; // advance slide forward or back function advance(opts, moveforward) { var val = moveforward ? 1 : -1; var els = opts.elements; var p = opts.$cont[0], timeout = p.cycletimeout; if (timeout) { cleartimeout(timeout); p.cycletimeout = 0; } if (opts.random && val < 0) { // move back to the previously display slide opts.randomindex--; if (--opts.randomindex == -2) opts.randomindex = els.length-2; else if (opts.randomindex == -1) opts.randomindex = els.length-1; opts.nextslide = opts.randommap[opts.randomindex]; } else if (opts.random) { opts.nextslide = opts.randommap[opts.randomindex]; } else { opts.nextslide = opts.currslide + val; if (opts.nextslide < 0) { if (opts.nowrap) return false; opts.nextslide = els.length - 1; } else if (opts.nextslide >= els.length) { if (opts.nowrap) return false; opts.nextslide = 0; } } var cb = opts.onprevnextevent || opts.prevnextclick; // prevnextclick is deprecated if ($.isfunction(cb)) cb(val > 0, opts.nextslide, els[opts.nextslide]); go(els, opts, 1, moveforward); return false; } function buildpager(els, opts) { var $p = $(opts.pager); $.each(els, function(i,o) { $.fn.cycle.createpageranchor(i,o,$p,els,opts); }); opts.updateactivepagerlink(opts.pager, opts.startingslide, opts.activepagerclass); } $.fn.cycle.createpageranchor = function(i, el, $p, els, opts) { var a; if ($.isfunction(opts.pageranchorbuilder)) { a = opts.pageranchorbuilder(i,el); debug('pageranchorbuilder('+i+', el) returned: ' + a); } else a = ''+(i+1)+''; if (!a) return; var $a = $(a); // don't reparent if anchor is in the dom if ($a.parents('body').length === 0) { var arr = []; if ($p.length > 1) { $p.each(function() { var $clone = $a.clone(true); $(this).append($clone); arr.push($clone[0]); }); $a = $(arr); } else { $a.appendto($p); } } opts.pageranchors = opts.pageranchors || []; opts.pageranchors.push($a); var pagerfn = function(e) { e.preventdefault(); opts.nextslide = i; var p = opts.$cont[0], timeout = p.cycletimeout; if (timeout) { cleartimeout(timeout); p.cycletimeout = 0; } var cb = opts.onpagerevent || opts.pagerclick; // pagerclick is deprecated if ($.isfunction(cb)) cb(opts.nextslide, els[opts.nextslide]); go(els,opts,1,opts.currslide < i); // trigger the trans // return false; // <== allow bubble }; if ( /mouseenter|mouseover/i.test(opts.pagerevent) ) { $a.hover(pagerfn, function(){/* no-op */} ); } else { $a.bind(opts.pagerevent, pagerfn); } if ( ! /^click/.test(opts.pagerevent) && !opts.allowpagerclickbubble) $a.bind('click.cycle', function(){return false;}); // suppress click var cont = opts.$cont[0]; var pauseflag = false; // https://github.com/malsup/cycle/issues/44 if (opts.pauseonpagerhover) { $a.hover( function() { pauseflag = true; cont.cyclepause++; triggerpause(cont,true,true); }, function() { if (pauseflag) cont.cyclepause--; triggerpause(cont,true,true); } ); } }; // helper fn to calculate the number of slides between the current and the next $.fn.cycle.hopsfromlast = function(opts, fwd) { var hops, l = opts.lastslide, c = opts.currslide; if (fwd) hops = c > l ? c - l : opts.slidecount - l; else hops = c < l ? l - c : l + opts.slidecount - c; return hops; }; // fix cleartype problems in ie6 by setting an explicit bg color // (otherwise text slides look horrible during a fade transition) function cleartypefix($slides) { debug('applying cleartype background-color hack'); function hex(s) { s = parseint(s,10).tostring(16); return s.length < 2 ? '0'+s : s; } function getbg(e) { for ( ; e && e.nodename.tolowercase() != 'html'; e = e.parentnode) { var v = $.css(e,'background-color'); if (v && v.indexof('rgb') >= 0 ) { var rgb = v.match(/\d+/g); return '#'+ hex(rgb[0]) + hex(rgb[1]) + hex(rgb[2]); } if (v && v != 'transparent') return v; } return '#ffffff'; } $slides.each(function() { $(this).css('background-color', getbg(this)); }); } // reset common props before the next transition $.fn.cycle.commonreset = function(curr,next,opts,w,h,rev) { $(opts.elements).not(curr).hide(); if (typeof opts.cssbefore.opacity == 'undefined') opts.cssbefore.opacity = 1; opts.cssbefore.display = 'block'; if (opts.slideresize && w !== false && next.cyclew > 0) opts.cssbefore.width = next.cyclew; if (opts.slideresize && h !== false && next.cycleh > 0) opts.cssbefore.height = next.cycleh; opts.cssafter = opts.cssafter || {}; opts.cssafter.display = 'none'; $(curr).css('zindex',opts.slidecount + (rev === true ? 1 : 0)); $(next).css('zindex',opts.slidecount + (rev === true ? 0 : 1)); }; // the actual fn for effecting a transition $.fn.cycle.custom = function(curr, next, opts, cb, fwd, speedoverride) { var $l = $(curr), $n = $(next); var speedin = opts.speedin, speedout = opts.speedout, easein = opts.easein, easeout = opts.easeout, animindelay = opts.animindelay, animoutdelay = opts.animoutdelay; $n.css(opts.cssbefore); if (speedoverride) { if (typeof speedoverride == 'number') speedin = speedout = speedoverride; else speedin = speedout = 1; easein = easeout = null; } var fn = function() { $n.delay(animindelay).animate(opts.animin, speedin, easein, function() { cb(); }); }; $l.delay(animoutdelay).animate(opts.animout, speedout, easeout, function() { $l.css(opts.cssafter); if (!opts.sync) fn(); }); if (opts.sync) fn(); }; // transition definitions - only fade is defined here, transition pack defines the rest $.fn.cycle.transitions = { fade: function($cont, $slides, opts) { $slides.not(':eq('+opts.currslide+')').css('opacity',0); opts.before.push(function(curr,next,opts) { $.fn.cycle.commonreset(curr,next,opts); opts.cssbefore.opacity = 0; }); opts.animin = { opacity: 1 }; opts.animout = { opacity: 0 }; opts.cssbefore = { top: 0, left: 0 }; } }; $.fn.cycle.ver = function() { return ver; }; // override these globally if you like (they are all optional) $.fn.cycle.defaults = { activepagerclass: 'activeslide', // class name used for the active pager link after: null, // transition callback (scope set to element that was shown): function(currslideelement, nextslideelement, options, forwardflag) allowpagerclickbubble: false, // allows or prevents click event on pager anchors from bubbling animin: null, // properties that define how the slide animates in animindelay: 0, // allows delay before next slide transitions in animout: null, // properties that define how the slide animates out animoutdelay: 0, // allows delay before current slide transitions out aspect: false, // preserve aspect ratio during fit resizing, cropping if necessary (must be used with fit option) autostop: 0, // true to end slideshow after x transitions (where x == slide count) autostopcount: 0, // number of transitions (optionally used with autostop to define x) backwards: false, // true to start slideshow at last slide and move backwards through the stack before: null, // transition callback (scope set to element to be shown): function(currslideelement, nextslideelement, options, forwardflag) center: null, // set to true to have cycle add top/left margin to each slide (use with width and height options) cleartype: !$.support.opacity, // true if cleartype corrections should be applied (for ie) cleartypenobg: false, // set to true to disable extra cleartype fixing (leave false to force background color setting on slides) containerresize: 1, // resize container to fit largest slide containerresizeheight: 0, // resize containers height to fit the largest slide but leave the width dynamic continuous: 0, // true to start next transition immediately after current one completes cssafter: null, // properties that defined the state of the slide after transitioning out cssbefore: null, // properties that define the initial state of the slide before transitioning in delay: 0, // additional delay (in ms) for first transition (hint: can be negative) easein: null, // easing for "in" transition easeout: null, // easing for "out" transition easing: null, // easing method for both in and out transitions end: null, // callback invoked when the slideshow terminates (use with autostop or nowrap options): function(options) fastonevent: 0, // force fast transitions when triggered manually (via pager or prev/next); value == time in ms fit: 0, // force slides to fit container fx: 'fade', // name of transition effect (or comma separated names, ex: 'fade,scrollup,shuffle') fxfn: null, // function used to control the transition: function(currslideelement, nextslideelement, options, aftercalback, forwardflag) height: 'auto', // container height (if the 'fit' option is true, the slides will be set to this height as well) manualtrump: true, // causes manual transition to stop an active transition instead of being ignored metaattr: 'cycle', // data- attribute that holds the option data for the slideshow next: null, // element, jquery object, or jquery selector string for the element to use as event trigger for next slide nowrap: 0, // true to prevent slideshow from wrapping onpagerevent: null, // callback fn for pager events: function(zerobasedslideindex, slideelement) onprevnextevent: null, // callback fn for prev/next events: function(isnext, zerobasedslideindex, slideelement) pager: null, // element, jquery object, or jquery selector string for the element to use as pager container pageranchorbuilder: null, // callback fn for building anchor links: function(index, domelement) pagerevent: 'click.cycle', // name of event which drives the pager navigation pause: 0, // true to enable "pause on hover" pauseonpagerhover: 0, // true to pause when hovering over pager link prev: null, // element, jquery object, or jquery selector string for the element to use as event trigger for previous slide prevnextevent: 'click.cycle',// event which drives the manual transition to the previous or next slide random: 0, // true for random, false for sequence (not applicable to shuffle fx) randomizeeffects: 1, // valid when multiple effects are used; true to make the effect sequence random requeueonimagenotloaded: true, // requeue the slideshow if any image slides are not yet loaded requeuetimeout: 250, // ms delay for requeue rev: 0, // causes animations to transition in reverse (for effects that support it such as scrollhorz/scrollvert/shuffle) shuffle: null, // coords for shuffle animation, ex: { top:15, left: 200 } skipinitializationcallbacks: false, // set to true to disable the first before/after callback that occurs prior to any transition slideexpr: null, // expression for selecting slides (if something other than all children is required) slideresize: 1, // force slide width/height to fixed size before every transition speed: 1000, // speed of the transition (any valid fx speed value) speedin: null, // speed of the 'in' transition speedout: null, // speed of the 'out' transition startingslide: undefined,// zero-based index of the first slide to be displayed sync: 1, // true if in/out transitions should occur simultaneously timeout: 4000, // milliseconds between slide transitions (0 to disable auto advance) timeoutfn: null, // callback for determining per-slide timeout value: function(currslideelement, nextslideelement, options, forwardflag) updateactivepagerlink: null,// callback fn invoked to update the active pager link (adds/removes activepagerclass style) width: null // container width (if the 'fit' option is true, the slides will be set to this width as well) }; })(jquery); /*! * jquery cycle plugin transition definitions * this script is a plugin for the jquery cycle plugin * examples and documentation at: http://malsup.com/jquery/cycle/ * copyright (c) 2007-2010 m. alsup * version: 2.73 * dual licensed under the mit and gpl licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html */ (function($) { "use strict"; // // these functions define slide initialization and properties for the named // transitions. to save file size feel free to remove any of these that you // don't need. // $.fn.cycle.transitions.none = function($cont, $slides, opts) { opts.fxfn = function(curr,next,opts,after){ $(next).show(); $(curr).hide(); after(); }; }; // not a cross-fade, fadeout only fades out the top slide $.fn.cycle.transitions.fadeout = function($cont, $slides, opts) { $slides.not(':eq('+opts.currslide+')').css({ display: 'block', 'opacity': 1 }); opts.before.push(function(curr,next,opts,w,h,rev) { $(curr).css('zindex',opts.slidecount + (rev !== true ? 1 : 0)); $(next).css('zindex',opts.slidecount + (rev !== true ? 0 : 1)); }); opts.animin.opacity = 1; opts.animout.opacity = 0; opts.cssbefore.opacity = 1; opts.cssbefore.display = 'block'; opts.cssafter.zindex = 0; }; // scrollup/down/left/right $.fn.cycle.transitions.scrollup = function($cont, $slides, opts) { $cont.css('overflow','hidden'); opts.before.push($.fn.cycle.commonreset); var h = $cont.height(); opts.cssbefore.top = h; opts.cssbefore.left = 0; opts.cssfirst.top = 0; opts.animin.top = 0; opts.animout.top = -h; }; $.fn.cycle.transitions.scrolldown = function($cont, $slides, opts) { $cont.css('overflow','hidden'); opts.before.push($.fn.cycle.commonreset); var h = $cont.height(); opts.cssfirst.top = 0; opts.cssbefore.top = -h; opts.cssbefore.left = 0; opts.animin.top = 0; opts.animout.top = h; }; $.fn.cycle.transitions.scrollleft = function($cont, $slides, opts) { $cont.css('overflow','hidden'); opts.before.push($.fn.cycle.commonreset); var w = $cont.width(); opts.cssfirst.left = 0; opts.cssbefore.left = w; opts.cssbefore.top = 0; opts.animin.left = 0; opts.animout.left = 0-w; }; $.fn.cycle.transitions.scrollright = function($cont, $slides, opts) { $cont.css('overflow','hidden'); opts.before.push($.fn.cycle.commonreset); var w = $cont.width(); opts.cssfirst.left = 0; opts.cssbefore.left = -w; opts.cssbefore.top = 0; opts.animin.left = 0; opts.animout.left = w; }; $.fn.cycle.transitions.scrollhorz = function($cont, $slides, opts) { $cont.css('overflow','hidden').width(); opts.before.push(function(curr, next, opts, fwd) { if (opts.rev) fwd = !fwd; $.fn.cycle.commonreset(curr,next,opts); opts.cssbefore.left = fwd ? (next.cyclew-1) : (1-next.cyclew); opts.animout.left = fwd ? -curr.cyclew : curr.cyclew; }); opts.cssfirst.left = 0; opts.cssbefore.top = 0; opts.animin.left = 0; opts.animout.top = 0; }; $.fn.cycle.transitions.scrollvert = function($cont, $slides, opts) { $cont.css('overflow','hidden'); opts.before.push(function(curr, next, opts, fwd) { if (opts.rev) fwd = !fwd; $.fn.cycle.commonreset(curr,next,opts); opts.cssbefore.top = fwd ? (1-next.cycleh) : (next.cycleh-1); opts.animout.top = fwd ? curr.cycleh : -curr.cycleh; }); opts.cssfirst.top = 0; opts.cssbefore.left = 0; opts.animin.top = 0; opts.animout.left = 0; }; // slidex/slidey $.fn.cycle.transitions.slidex = function($cont, $slides, opts) { opts.before.push(function(curr, next, opts) { $(opts.elements).not(curr).hide(); $.fn.cycle.commonreset(curr,next,opts,false,true); opts.animin.width = next.cyclew; }); opts.cssbefore.left = 0; opts.cssbefore.top = 0; opts.cssbefore.width = 0; opts.animin.width = 'show'; opts.animout.width = 0; }; $.fn.cycle.transitions.slidey = function($cont, $slides, opts) { opts.before.push(function(curr, next, opts) { $(opts.elements).not(curr).hide(); $.fn.cycle.commonreset(curr,next,opts,true,false); opts.animin.height = next.cycleh; }); opts.cssbefore.left = 0; opts.cssbefore.top = 0; opts.cssbefore.height = 0; opts.animin.height = 'show'; opts.animout.height = 0; }; // shuffle $.fn.cycle.transitions.shuffle = function($cont, $slides, opts) { var i, w = $cont.css('overflow', 'visible').width(); $slides.css({left: 0, top: 0}); opts.before.push(function(curr,next,opts) { $.fn.cycle.commonreset(curr,next,opts,true,true,true); }); // only adjust speed once! if (!opts.speedadjusted) { opts.speed = opts.speed / 2; // shuffle has 2 transitions opts.speedadjusted = true; } opts.random = 0; opts.shuffle = opts.shuffle || {left:-w, top:15}; opts.els = []; for (i=0; i < $slides.length; i++) opts.els.push($slides[i]); for (i=0; i < opts.currslide; i++) opts.els.push(opts.els.shift()); // custom transition fn (hat tip to benjamin sterling for this bit of sweetness!) opts.fxfn = function(curr, next, opts, cb, fwd) { if (opts.rev) fwd = !fwd; var $el = fwd ? $(curr) : $(next); $(next).css(opts.cssbefore); var count = opts.slidecount; $el.animate(opts.shuffle, opts.speedin, opts.easein, function() { var hops = $.fn.cycle.hopsfromlast(opts, fwd); for (var k=0; k < hops; k++) { if (fwd) opts.els.push(opts.els.shift()); else opts.els.unshift(opts.els.pop()); } if (fwd) { for (var i=0, len=opts.els.length; i < len; i++) $(opts.els[i]).css('z-index', len-i+count); } else { var z = $(curr).css('z-index'); $el.css('z-index', parseint(z,10)+1+count); } $el.animate({left:0, top:0}, opts.speedout, opts.easeout, function() { $(fwd ? this : curr).hide(); if (cb) cb(); }); }); }; $.extend(opts.cssbefore, { display: 'block', opacity: 1, top: 0, left: 0 }); }; // turnup/down/left/right $.fn.cycle.transitions.turnup = function($cont, $slides, opts) { opts.before.push(function(curr, next, opts) { $.fn.cycle.commonreset(curr,next,opts,true,false); opts.cssbefore.top = next.cycleh; opts.animin.height = next.cycleh; opts.animout.width = next.cyclew; }); opts.cssfirst.top = 0; opts.cssbefore.left = 0; opts.cssbefore.height = 0; opts.animin.top = 0; opts.animout.height = 0; }; $.fn.cycle.transitions.turndown = function($cont, $slides, opts) { opts.before.push(function(curr, next, opts) { $.fn.cycle.commonreset(curr,next,opts,true,false); opts.animin.height = next.cycleh; opts.animout.top = curr.cycleh; }); opts.cssfirst.top = 0; opts.cssbefore.left = 0; opts.cssbefore.top = 0; opts.cssbefore.height = 0; opts.animout.height = 0; }; $.fn.cycle.transitions.turnleft = function($cont, $slides, opts) { opts.before.push(function(curr, next, opts) { $.fn.cycle.commonreset(curr,next,opts,false,true); opts.cssbefore.left = next.cyclew; opts.animin.width = next.cyclew; }); opts.cssbefore.top = 0; opts.cssbefore.width = 0; opts.animin.left = 0; opts.animout.width = 0; }; $.fn.cycle.transitions.turnright = function($cont, $slides, opts) { opts.before.push(function(curr, next, opts) { $.fn.cycle.commonreset(curr,next,opts,false,true); opts.animin.width = next.cyclew; opts.animout.left = curr.cyclew; }); $.extend(opts.cssbefore, { top: 0, left: 0, width: 0 }); opts.animin.left = 0; opts.animout.width = 0; }; // zoom $.fn.cycle.transitions.zoom = function($cont, $slides, opts) { opts.before.push(function(curr, next, opts) { $.fn.cycle.commonreset(curr,next,opts,false,false,true); opts.cssbefore.top = next.cycleh/2; opts.cssbefore.left = next.cyclew/2; $.extend(opts.animin, { top: 0, left: 0, width: next.cyclew, height: next.cycleh }); $.extend(opts.animout, { width: 0, height: 0, top: curr.cycleh/2, left: curr.cyclew/2 }); }); opts.cssfirst.top = 0; opts.cssfirst.left = 0; opts.cssbefore.width = 0; opts.cssbefore.height = 0; }; // fadezoom $.fn.cycle.transitions.fadezoom = function($cont, $slides, opts) { opts.before.push(function(curr, next, opts) { $.fn.cycle.commonreset(curr,next,opts,false,false); opts.cssbefore.left = next.cyclew/2; opts.cssbefore.top = next.cycleh/2; $.extend(opts.animin, { top: 0, left: 0, width: next.cyclew, height: next.cycleh }); }); opts.cssbefore.width = 0; opts.cssbefore.height = 0; opts.animout.opacity = 0; }; // blindx $.fn.cycle.transitions.blindx = function($cont, $slides, opts) { var w = $cont.css('overflow','hidden').width(); opts.before.push(function(curr, next, opts) { $.fn.cycle.commonreset(curr,next,opts); opts.animin.width = next.cyclew; opts.animout.left = curr.cyclew; }); opts.cssbefore.left = w; opts.cssbefore.top = 0; opts.animin.left = 0; opts.animout.left = w; }; // blindy $.fn.cycle.transitions.blindy = function($cont, $slides, opts) { var h = $cont.css('overflow','hidden').height(); opts.before.push(function(curr, next, opts) { $.fn.cycle.commonreset(curr,next,opts); opts.animin.height = next.cycleh; opts.animout.top = curr.cycleh; }); opts.cssbefore.top = h; opts.cssbefore.left = 0; opts.animin.top = 0; opts.animout.top = h; }; // blindz $.fn.cycle.transitions.blindz = function($cont, $slides, opts) { var h = $cont.css('overflow','hidden').height(); var w = $cont.width(); opts.before.push(function(curr, next, opts) { $.fn.cycle.commonreset(curr,next,opts); opts.animin.height = next.cycleh; opts.animout.top = curr.cycleh; }); opts.cssbefore.top = h; opts.cssbefore.left = w; opts.animin.top = 0; opts.animin.left = 0; opts.animout.top = h; opts.animout.left = w; }; // growx - grow horizontally from centered 0 width $.fn.cycle.transitions.growx = function($cont, $slides, opts) { opts.before.push(function(curr, next, opts) { $.fn.cycle.commonreset(curr,next,opts,false,true); opts.cssbefore.left = this.cyclew/2; opts.animin.left = 0; opts.animin.width = this.cyclew; opts.animout.left = 0; }); opts.cssbefore.top = 0; opts.cssbefore.width = 0; }; // growy - grow vertically from centered 0 height $.fn.cycle.transitions.growy = function($cont, $slides, opts) { opts.before.push(function(curr, next, opts) { $.fn.cycle.commonreset(curr,next,opts,true,false); opts.cssbefore.top = this.cycleh/2; opts.animin.top = 0; opts.animin.height = this.cycleh; opts.animout.top = 0; }); opts.cssbefore.height = 0; opts.cssbefore.left = 0; }; // curtainx - squeeze in both edges horizontally $.fn.cycle.transitions.curtainx = function($cont, $slides, opts) { opts.before.push(function(curr, next, opts) { $.fn.cycle.commonreset(curr,next,opts,false,true,true); opts.cssbefore.left = next.cyclew/2; opts.animin.left = 0; opts.animin.width = this.cyclew; opts.animout.left = curr.cyclew/2; opts.animout.width = 0; }); opts.cssbefore.top = 0; opts.cssbefore.width = 0; }; // curtainy - squeeze in both edges vertically $.fn.cycle.transitions.curtainy = function($cont, $slides, opts) { opts.before.push(function(curr, next, opts) { $.fn.cycle.commonreset(curr,next,opts,true,false,true); opts.cssbefore.top = next.cycleh/2; opts.animin.top = 0; opts.animin.height = next.cycleh; opts.animout.top = curr.cycleh/2; opts.animout.height = 0; }); opts.cssbefore.height = 0; opts.cssbefore.left = 0; }; // cover - curr slide covered by next slide $.fn.cycle.transitions.cover = function($cont, $slides, opts) { var d = opts.direction || 'left'; var w = $cont.css('overflow','hidden').width(); var h = $cont.height(); opts.before.push(function(curr, next, opts) { $.fn.cycle.commonreset(curr,next,opts); opts.cssafter.display = ''; if (d == 'right') opts.cssbefore.left = -w; else if (d == 'up') opts.cssbefore.top = h; else if (d == 'down') opts.cssbefore.top = -h; else opts.cssbefore.left = w; }); opts.animin.left = 0; opts.animin.top = 0; opts.cssbefore.top = 0; opts.cssbefore.left = 0; }; // uncover - curr slide moves off next slide $.fn.cycle.transitions.uncover = function($cont, $slides, opts) { var d = opts.direction || 'left'; var w = $cont.css('overflow','hidden').width(); var h = $cont.height(); opts.before.push(function(curr, next, opts) { $.fn.cycle.commonreset(curr,next,opts,true,true,true); if (d == 'right') opts.animout.left = w; else if (d == 'up') opts.animout.top = -h; else if (d == 'down') opts.animout.top = h; else opts.animout.left = -w; }); opts.animin.left = 0; opts.animin.top = 0; opts.cssbefore.top = 0; opts.cssbefore.left = 0; }; // toss - move top slide and fade away $.fn.cycle.transitions.toss = function($cont, $slides, opts) { var w = $cont.css('overflow','visible').width(); var h = $cont.height(); opts.before.push(function(curr, next, opts) { $.fn.cycle.commonreset(curr,next,opts,true,true,true); // provide default toss settings if animout not provided if (!opts.animout.left && !opts.animout.top) $.extend(opts.animout, { left: w*2, top: -h/2, opacity: 0 }); else opts.animout.opacity = 0; }); opts.cssbefore.left = 0; opts.cssbefore.top = 0; opts.animin.left = 0; }; // wipe - clip animation $.fn.cycle.transitions.wipe = function($cont, $slides, opts) { var w = $cont.css('overflow','hidden').width(); var h = $cont.height(); opts.cssbefore = opts.cssbefore || {}; var clip; if (opts.clip) { if (/l2r/.test(opts.clip)) clip = 'rect(0px 0px '+h+'px 0px)'; else if (/r2l/.test(opts.clip)) clip = 'rect(0px '+w+'px '+h+'px '+w+'px)'; else if (/t2b/.test(opts.clip)) clip = 'rect(0px '+w+'px 0px 0px)'; else if (/b2t/.test(opts.clip)) clip = 'rect('+h+'px '+w+'px '+h+'px 0px)'; else if (/zoom/.test(opts.clip)) { var top = parseint(h/2,10); var left = parseint(w/2,10); clip = 'rect('+top+'px '+left+'px '+top+'px '+left+'px)'; } } opts.cssbefore.clip = opts.cssbefore.clip || clip || 'rect(0px 0px 0px 0px)'; var d = opts.cssbefore.clip.match(/(\d+)/g); var t = parseint(d[0],10), r = parseint(d[1],10), b = parseint(d[2],10), l = parseint(d[3],10); opts.before.push(function(curr, next, opts) { if (curr == next) return; var $curr = $(curr), $next = $(next); $.fn.cycle.commonreset(curr,next,opts,true,true,false); opts.cssafter.display = 'block'; var step = 1, count = parseint((opts.speedin / 13),10) - 1; (function f() { var tt = t ? t - parseint(step * (t/count),10) : 0; var ll = l ? l - parseint(step * (l/count),10) : 0; var bb = b < h ? b + parseint(step * ((h-b)/count || 1),10) : h; var rr = r < w ? r + parseint(step * ((w-r)/count || 1),10) : w; $next.css({ clip: 'rect('+tt+'px '+rr+'px '+bb+'px '+ll+'px)' }); (step++ <= count) ? settimeout(f, 13) : $curr.css('display', 'none'); })(); }); $.extend(opts.cssbefore, { display: 'block', opacity: 1, top: 0, left: 0 }); opts.animin = { left: 0 }; opts.animout = { left: 0 }; }; })(jquery); ; /** * @file * a simple jquery cycle div slideshow rotator. */ /** * this will set our initial behavior, by starting up each individual slideshow. */ (function ($) { drupal.behaviors.viewsslideshowcycle = { attach: function (context) { $('.views_slideshow_cycle_main:not(.viewsslideshowcycle-processed)', context).addclass('viewsslideshowcycle-processed').each(function() { var fullid = '#' + $(this).attr('id'); var settings = drupal.settings.viewsslideshowcycle[fullid]; settings.targetid = '#' + $(fullid + " :first").attr('id'); settings.slideshowid = settings.targetid.replace('#views_slideshow_cycle_teaser_section_', ''); // pager after function. var pager_after_fn = function(curr, next, opts) { // need to do some special handling on first load. var slidenum = opts.currslide; if (typeof settings.processedafter == 'undefined' || !settings.processedafter) { settings.processedafter = 1; slidenum = (typeof settings.opts.startingslide == 'undefined') ? 0 : settings.opts.startingslide; } drupal.viewsslideshow.action({ "action": 'transitionend', "slideshowid": settings.slideshowid, "slidenum": slidenum }); } // pager before function. var pager_before_fn = function(curr, next, opts) { var slidenum = opts.nextslide; // remember last slide. if (settings.remember_slide) { createcookie(settings.vss_id, slidenum, settings.remember_slide_days); } // make variable height. if (!settings.fixed_height) { //get the height of the current slide var $ht = $(next).height(); //set the container's height to that of the current slide $(next).parent().animate({height: $ht}); } // need to do some special handling on first load. if (typeof settings.processedbefore == 'undefined' || !settings.processedbefore) { settings.processedbefore = 1; slidenum = (typeof opts.startingslide == 'undefined') ? 0 : opts.startingslide; } drupal.viewsslideshow.action({ "action": 'transitionbegin', "slideshowid": settings.slideshowid, "slidenum": slidenum }); } settings.loaded = false; settings.opts = { speed:settings.speed, timeout:settings.timeout, delay:settings.delay, sync:settings.sync, random:settings.random, nowrap:settings.nowrap, after:pager_after_fn, before:pager_before_fn, cleartype:(settings.cleartype)? true : false, cleartypenobg:(settings.cleartypenobg)? true : false } // set the starting slide if we are supposed to remember the slide if (settings.remember_slide) { var startslide = readcookie(settings.vss_id); if (startslide == null) { startslide = 0; } settings.opts.startingslide = parseint(startslide); } if (settings.effect == 'none') { settings.opts.speed = 1; } else { settings.opts.fx = settings.effect; } // take starting item from fragment. var hash = location.hash; if (hash) { var hash = hash.replace('#', ''); var ahash = hash.split(';'); var ahashlen = ahash.length; // loop through all the possible starting points. for (var i = 0; i < ahashlen; i++) { // split the hash into two parts. one part is the slideshow id the // other is the slide number. var initialinfo = ahash[i].split(':'); // the id in the hash should match our slideshow. // the slide number chosen shouldn't be larger than the number of // slides we have. if (settings.slideshowid == initialinfo[0] && settings.num_divs > initialinfo[1]) { settings.opts.startingslide = parseint(initialinfo[1]); } } } // pause on hover. if (settings.pause) { var mousein = function() { drupal.viewsslideshow.action({ "action": 'pause', "slideshowid": settings.slideshowid }); } var mouseout = function() { drupal.viewsslideshow.action({ "action": 'play', "slideshowid": settings.slideshowid }); } if (jquery.fn.hoverintent) { $('#views_slideshow_cycle_teaser_section_' + settings.vss_id).hoverintent(mousein, mouseout); } else { $('#views_slideshow_cycle_teaser_section_' + settings.vss_id).hover(mousein, mouseout); } } // pause on clicking of the slide. if (settings.pause_on_click) { $('#views_slideshow_cycle_teaser_section_' + settings.vss_id).click(function() { drupal.viewsslideshow.action({ "action": 'pause', "slideshowid": settings.slideshowid, "force": true }); }); } if (typeof json != 'undefined') { var advancedoptions = json.parse(settings.advanced_options); for (var option in advancedoptions) { switch(option) { // standard options case "activepagerclass": case "allowpagerclickbubble": case "autostop": case "autostopcount": case "backwards": case "bounce": case "cleartype": case "cleartypenobg": case "containerresize": case "continuous": case "delay": case "easein": case "easeout": case "easing": case "fastonevent": case "fit": case "fx": case "height": case "manualtrump": case "metaattr": case "next": case "nowrap": case "pager": case "pagerevent": case "pause": case "pauseonpagerhover": case "prev": case "prevnextevent": case "random": case "randomizeeffects": case "requeueonimagenotloaded": case "requeuetimeout": case "rev": case "slideexpr": case "slideresize": case "speed": case "speedin": case "speedout": case "startingslide": case "sync": case "timeout": case "width": var optionvalue = advancedoptions[option]; optionvalue = drupal.viewsslideshowcycle.advancedoptioncleanup(optionvalue); settings.opts[option] = optionvalue; break; // these process options that look like {top:50, bottom:20} case "animin": case "animout": case "cssbefore": case "cssafter": case "shuffle": var cssvalue = advancedoptions[option]; cssvalue = drupal.viewsslideshowcycle.advancedoptioncleanup(cssvalue); settings.opts[option] = eval('(' + cssvalue + ')'); break; // these options have their own functions. case "after": var aftervalue = advancedoptions[option]; aftervalue = drupal.viewsslideshowcycle.advancedoptioncleanup(aftervalue); // transition callback (scope set to element that was shown): function(currslideelement, nextslideelement, options, forwardflag) settings.opts[option] = function(currslideelement, nextslideelement, options, forwardflag) { pager_after_fn(currslideelement, nextslideelement, options); eval(aftervalue); } break; case "before": var beforevalue = advancedoptions[option]; beforevalue = drupal.viewsslideshowcycle.advancedoptioncleanup(beforevalue); // transition callback (scope set to element to be shown): function(currslideelement, nextslideelement, options, forwardflag) settings.opts[option] = function(currslideelement, nextslideelement, options, forwardflag) { pager_before_fn(currslideelement, nextslideelement, options); eval(beforevalue); } break; case "end": var endvalue = advancedoptions[option]; endvalue = drupal.viewsslideshowcycle.advancedoptioncleanup(endvalue); // callback invoked when the slideshow terminates (use with autostop or nowrap options): function(options) settings.opts[option] = function(options) { eval(endvalue); } break; case "fxfn": var fxfnvalue = advancedoptions[option]; fxfnvalue = drupal.viewsslideshowcycle.advancedoptioncleanup(fxfnvalue); // function used to control the transition: function(currslideelement, nextslideelement, options, aftercalback, forwardflag) settings.opts[option] = function(currslideelement, nextslideelement, options, aftercalback, forwardflag) { eval(fxfnvalue); } break; case "onpagerevent": var onpagereventvalue = advancedoptions[option]; onpagereventvalue = drupal.viewsslideshowcycle.advancedoptioncleanup(onpagereventvalue); settings.opts[option] = function(zerobasedslideindex, slideelement) { eval(onpagereventvalue); } break; case "onprevnextevent": var onprevnexteventvalue = advancedoptions[option]; onprevnexteventvalue = drupal.viewsslideshowcycle.advancedoptioncleanup(onprevnexteventvalue); settings.opts[option] = function(isnext, zerobasedslideindex, slideelement) { eval(onprevnexteventvalue); } break; case "pageranchorbuilder": var pageranchorbuildervalue = advancedoptions[option]; pageranchorbuildervalue = drupal.viewsslideshowcycle.advancedoptioncleanup(pageranchorbuildervalue); // callback fn for building anchor links: function(index, domelement) settings.opts[option] = function(index, domelement) { var returnval = ''; eval(pageranchorbuildervalue); return returnval; } break; case "pagerclick": var pagerclickvalue = advancedoptions[option]; pagerclickvalue = drupal.viewsslideshowcycle.advancedoptioncleanup(pagerclickvalue); // callback fn for pager clicks: function(zerobasedslideindex, slideelement) settings.opts[option] = function(zerobasedslideindex, slideelement) { eval(pagerclickvalue); } break; case "paused": var pausedvalue = advancedoptions[option]; pausedvalue = drupal.viewsslideshowcycle.advancedoptioncleanup(pausedvalue); // undocumented callback when slideshow is paused: function(cont, opts, byhover) settings.opts[option] = function(cont, opts, byhover) { eval(pausedvalue); } break; case "resumed": var resumedvalue = advancedoptions[option]; resumedvalue = drupal.viewsslideshowcycle.advancedoptioncleanup(resumedvalue); // undocumented callback when slideshow is resumed: function(cont, opts, byhover) settings.opts[option] = function(cont, opts, byhover) { eval(resumedvalue); } break; case "timeoutfn": var timeoutfnvalue = advancedoptions[option]; timeoutfnvalue = drupal.viewsslideshowcycle.advancedoptioncleanup(timeoutfnvalue); settings.opts[option] = function(currslideelement, nextslideelement, options, forwardflag) { eval(timeoutfnvalue); } break; case "updateactivepagerlink": var updateactivepagerlinkvalue = advancedoptions[option]; updateactivepagerlinkvalue = drupal.viewsslideshowcycle.advancedoptioncleanup(updateactivepagerlinkvalue); // callback fn invoked to update the active pager link (adds/removes activepagerclass style) settings.opts[option] = function(pager, currslideindex) { eval(updateactivepagerlinkvalue); } break; } } } // if selected wait for the images to be loaded. // otherwise just load the slideshow. if (settings.wait_for_image_load) { // for ie/chrome/opera we if there are images then we need to make // sure the images are loaded before starting the slideshow. settings.totalimages = $(settings.targetid + ' img').length; if (settings.totalimages) { settings.loadedimages = 0; // add a load event for each image. $(settings.targetid + ' img').each(function() { var $imageelement = $(this); $imageelement.bind('load', function () { drupal.viewsslideshowcycle.imagewait(fullid); }); // removing the source and adding it again will fire the load event. var imgsrc = $imageelement.attr('src'); $imageelement.attr('src', ''); $imageelement.attr('src', imgsrc); }); // we need to set a timeout so that the slideshow doesn't wait // indefinitely for all images to load. settimeout("drupal.viewsslideshowcycle.load('" + fullid + "')", settings.wait_for_image_load_timeout); } else { drupal.viewsslideshowcycle.load(fullid); } } else { drupal.viewsslideshowcycle.load(fullid); } }); } }; drupal.viewsslideshowcycle = drupal.viewsslideshowcycle || {}; // cleanup the values of advanced options. drupal.viewsslideshowcycle.advancedoptioncleanup = function(value) { value = $.trim(value); value = value.replace(/\n/g, ''); if (!isnan(parseint(value))) { value = parseint(value); } else if (value.tolowercase() == 'true') { value = true; } else if (value.tolowercase() == 'false') { value = false; } return value; } // this checks to see if all the images have been loaded. // if they have then it starts the slideshow. drupal.viewsslideshowcycle.imagewait = function(fullid) { if (++drupal.settings.viewsslideshowcycle[fullid].loadedimages == drupal.settings.viewsslideshowcycle[fullid].totalimages) { drupal.viewsslideshowcycle.load(fullid); } }; // start the slideshow. drupal.viewsslideshowcycle.load = function (fullid) { var settings = drupal.settings.viewsslideshowcycle[fullid]; // make sure the slideshow isn't already loaded. if (!settings.loaded) { $(settings.targetid).cycle(settings.opts); settings.loaded = true; // start paused if (settings.start_paused) { drupal.viewsslideshow.action({ "action": 'pause', "slideshowid": settings.slideshowid, "force": true }); } // pause if hidden. if (settings.pause_when_hidden) { var checkpause = function(settings) { // if the slideshow is visible and it is paused then resume. // otherwise if the slideshow is not visible and it is not paused then // pause it. var visible = viewsslideshowcycleisvisible(settings.targetid, settings.pause_when_hidden_type, settings.amount_allowed_visible); if (visible) { drupal.viewsslideshow.action({ "action": 'play', "slideshowid": settings.slideshowid }); } else { drupal.viewsslideshow.action({ "action": 'pause', "slideshowid": settings.slideshowid }); } } // check when scrolled. $(window).scroll(function() { checkpause(settings); }); // check when the window is resized. $(window).resize(function() { checkpause(settings); }); } } }; drupal.viewsslideshowcycle.pause = function (options) { //eat typeerror, cycle doesn't handle pause well if options isn't defined. try{ if (options.pause_in_middle && $.fn.pause) { $('#views_slideshow_cycle_teaser_section_' + options.slideshowid).pause(); } else { $('#views_slideshow_cycle_teaser_section_' + options.slideshowid).cycle('pause'); } } catch(e){ if(!e instanceof typeerror){ throw e; } } }; drupal.viewsslideshowcycle.play = function (options) { drupal.settings.viewsslideshowcycle['#views_slideshow_cycle_main_' + options.slideshowid].paused = false; if (options.pause_in_middle && $.fn.resume) { $('#views_slideshow_cycle_teaser_section_' + options.slideshowid).resume(); } else { $('#views_slideshow_cycle_teaser_section_' + options.slideshowid).cycle('resume'); } }; drupal.viewsslideshowcycle.previousslide = function (options) { $('#views_slideshow_cycle_teaser_section_' + options.slideshowid).cycle('prev'); }; drupal.viewsslideshowcycle.nextslide = function (options) { $('#views_slideshow_cycle_teaser_section_' + options.slideshowid).cycle('next'); }; drupal.viewsslideshowcycle.gotoslide = function (options) { $('#views_slideshow_cycle_teaser_section_' + options.slideshowid).cycle(options.slidenum); }; // verify that the value is a number. function isnumeric(stext) { var validchars = "0123456789"; var isnumber=true; var char; for (var i=0; i < stext.length && isnumber == true; i++) { char = stext.charat(i); if (validchars.indexof(char) == -1) { isnumber = false; } } return isnumber; } /** * cookie handling functions */ function createcookie(name,value,days) { if (days) { var date = new date(); date.settime(date.gettime()+(days*24*60*60*1000)); var expires = "; expires="+date.togmtstring(); } else { var expires = ""; } document.cookie = name+"="+value+expires+"; path=/"; } function readcookie(name) { var nameeq = name + "="; var ca = document.cookie.split(';'); for(var i=0;i < ca.length;i++) { var c = ca[i]; while (c.charat(0)==' ') c = c.substring(1,c.length); if (c.indexof(nameeq) == 0) { return c.substring(nameeq.length,c.length); } } return null; } function erasecookie(name) { createcookie(name,"",-1); } /** * checks to see if the slide is visible enough. * elem = element to check. * type = the way to calculate how much is visible. * amountvisible = amount that should be visible. either in percent or px. if * it's not defined then all of the slide must be visible. * * returns true or false */ function viewsslideshowcycleisvisible(elem, type, amountvisible) { // get the top and bottom of the window; var docviewtop = $(window).scrolltop(); var docviewbottom = docviewtop + $(window).height(); var docviewleft = $(window).scrollleft(); var docviewright = docviewleft + $(window).width(); // get the top, bottom, and height of the slide; var elemtop = $(elem).offset().top; var elemheight = $(elem).height(); var elembottom = elemtop + elemheight; var elemleft = $(elem).offset().left; var elemwidth = $(elem).width(); var elemright = elemleft + elemwidth; var elemarea = elemheight * elemwidth; // calculate what's hiding in the slide. var missingleft = 0; var missingright = 0; var missingtop = 0; var missingbottom = 0; // find out how much of the slide is missing from the left. if (elemleft < docviewleft) { missingleft = docviewleft - elemleft; } // find out how much of the slide is missing from the right. if (elemright > docviewright) { missingright = elemright - docviewright; } // find out how much of the slide is missing from the top. if (elemtop < docviewtop) { missingtop = docviewtop - elemtop; } // find out how much of the slide is missing from the bottom. if (elembottom > docviewbottom) { missingbottom = elembottom - docviewbottom; } // if there is no amountvisible defined then check to see if the whole slide // is visible. if (type == 'full') { return ((elembottom >= docviewtop) && (elemtop <= docviewbottom) && (elembottom <= docviewbottom) && (elemtop >= docviewtop) && (elemleft >= docviewleft) && (elemright <= docviewright) && (elemleft <= docviewright) && (elemright >= docviewleft)); } else if(type == 'vertical') { var verticalshowing = elemheight - missingtop - missingbottom; // if user specified a percentage then find out if the current shown percent // is larger than the allowed percent. // otherwise check to see if the amount of px shown is larger than the // allotted amount. if (amountvisible.indexof('%')) { return (((verticalshowing/elemheight)*100) >= parseint(amountvisible)); } else { return (verticalshowing >= parseint(amountvisible)); } } else if(type == 'horizontal') { var horizontalshowing = elemwidth - missingleft - missingright; // if user specified a percentage then find out if the current shown percent // is larger than the allowed percent. // otherwise check to see if the amount of px shown is larger than the // allotted amount. if (amountvisible.indexof('%')) { return (((horizontalshowing/elemwidth)*100) >= parseint(amountvisible)); } else { return (horizontalshowing >= parseint(amountvisible)); } } else if(type == 'area') { var areashowing = (elemwidth - missingleft - missingright) * (elemheight - missingtop - missingbottom); // if user specified a percentage then find out if the current shown percent // is larger than the allowed percent. // otherwise check to see if the amount of px shown is larger than the // allotted amount. if (amountvisible.indexof('%')) { return (((areashowing/elemarea)*100) >= parseint(amountvisible)); } else { return (areashowing >= parseint(amountvisible)); } } } })(jquery); ;