/* slideshow.js Provide functionality for feature slide show presentations. :AUTHOR: James Green :CREATED: September 03, 2008 :UPDATED: JG 09/03/2008 - Initial setup. JG 10/02/2008 - Modified slide show defined area to support both the corporate style and ldc style. JG 11/12/2008 - Modified slide show to retrieve images from an external source. :DEPENDENCIES: /lib/jquery.1.2.6.js /lib/jquery.ifixpng2.js /lib/cycle-2.26/jquery.cycle.all.js * jQuery Cycle Plugin for light-weight slideshows * Examples and documentation at: http://malsup.com/jquery/cycle/ * Copyright (c) 2007-2008 M. Alsup * Version: 2.26 (08/28/2008) * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html * Requires: jQuery v1.2.3 or later * * Based on the work of: * 1) Matt Oakes (http://portfolio.gizone.co.uk/applications/slideshow/) * 2) Torsten Baldes (http://medienfreunde.com/lab/innerfade/) * 3) Benjamin Sterling (http://www.benjaminsterling.com/experiments/jqShuffle/) */ function slideShowManager(source, target) { var re = new RegExp('.*src=".*\/images\/features.*'); var slides = $(source).html(); var s = slides.split("<"); var t = new Array(); for (var i in s) { if (re.test(s[i])) t.push("<"+s[i]); // Only keep if it's a featured image. } s = t; slides = t.join(""); var totalSlideCount = s.length; $(target).empty(); // Remove any existing images from target. $(target).append(slides); // Add new images retrieved from source file. $(target).cycle({ fx:'fade', speed:1000, timeout:5000, next:'#ss-main-feature-next', prev:'#ss-main-feature-prev', pause:0, before: loadSlides }); function loadSlides(curr, next, opts, fwd) { // on Before arguments: // curr == DOM element for the slide that is currently being displayed // next == DOM element for the slide that is about to be displayed // opts == slideshow options // fwd == true if cycling forward, false if cycling backward // on the first pass, addSlide is undefined (plugin hasn't yet created the fn yet) if (!opts.addSlide) return; // have we added all our slides? if (opts.slideCount == totalSlideCount) return; // shift or pop from our slide array var nextSlideSrc = fwd ? s.shift() : s.pop(); // add our next slide opts.addSlide(nextSlideSrc, fwd == false); }; if (totalSlideCount <= 1) $("#ss-main-feature-controls").hide(); //$(target + " img").show(); // Toggle the pause and play button. $('#ss-main-feature-pause-play').toggle( function() { $(target).cycle('pause'); $('#ss-main-feature-pause-play').attr({ alt:"Play Slideshow", title:"Play Slideshow" }); $('#ss-pause').css({ visibility:"hidden" }); $('#ss-play').css({ visibility:"visible" }); }, function() { $(target).cycle('resume'); $('#ss-main-feature-pause-play').attr({ alt:"Pause Slideshow", title:"Pause Slideshow" }); $('#ss-pause').css({ visibility:"visible" }); $('#ss-play').css({ visibility:"hidden" }); }); }