/* =============================================== 01. ANYTHING SLIDER JQUERY PLUGINS - jQuery plugin =============================================== */ var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y0){for(var af=0;af0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad'}}aa.outerHTML='"+af+"";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab
'); // Add a reverse reference to the DOM object base.$el.data("AnythingSlider", base); base.init = function(){ // Added "o" to be used in the code instead of "base.options" which doesn't get modifed by the compiler - reduces size by ~1k base.options = o = $.extend({}, $.anythingSlider.defaults, options); base.initialized = false; if ($.isFunction(o.onBeforeInitialize)) { base.$el.bind('before_initialize', o.onBeforeInitialize); } base.$el.trigger('before_initialize', base); // Cache existing DOM elements for later // base.$el = original ul // for wrap - get parent() then closest in case the ul has "anythingSlider" class base.$wrapper = base.$el.parent().closest('div.anythingSlider').addClass('anythingSlider-' + o.theme); base.$window = base.$el.closest('div.anythingWindow'); base.win = window; base.$win = $(base.win); base.$controls = $('
').appendTo( (o.appendControlsTo !== null && $(o.appendControlsTo).length) ? $(o.appendControlsTo) : base.$wrapper); base.$startStop = $(''); if (o.buildStartStop) { base.$startStop.appendTo( (o.appendStartStopTo !== null && $(o.appendStartStopTo).length) ? $(o.appendStartStopTo) : base.$controls ); } base.$nav = $('
    ').appendTo( (o.appendNavigationTo !== null && $(o.appendNavigationTo).length) ? $(o.appendNavigationTo) : base.$controls ); // Set up a few defaults & get details base.flag = false; // event flag to prevent multiple calls (used in control click/focusin) base.playing = o.autoPlay; // slideshow state; removed "startStopped" option base.slideshow = false; // slideshow flag needed to correctly trigger slideshow events base.hovered = false; // actively hovering over the slider base.panelSize = []; // will contain dimensions and left position of each panel base.currentPage = o.startPanel = parseInt(o.startPanel,10) || 1; // make sure this isn't a string o.changeBy = parseInt(o.changeBy,10) || 1; base.adj = (o.infiniteSlides) ? 0 : 1; // adjust page limits for infinite or limited modes base.width = base.$el.width(); base.height = base.$el.height(); base.outerPad = [ base.$wrapper.innerWidth() - base.$wrapper.width(), base.$wrapper.innerHeight() - base.$wrapper.height() ]; if (o.playRtl) { base.$wrapper.addClass('rtl'); } // Expand slider to fit parent if (o.expand) { base.$outer = base.$wrapper.parent(); base.$window.css({ width: '100%', height: '100%' }); // needed for Opera base.checkResize(); } // Build start/stop button if (o.buildStartStop) { base.buildAutoPlay(); } // Build forwards/backwards buttons if (o.buildArrows) { base.buildNextBackButtons(); } // can't lock autoplay it if it's not enabled if (!o.autoPlay) { o.autoPlayLocked = false; } base.updateSlider(); base.$lastPage = base.$currentPage; // Get index (run time) of this slider on the page base.runTimes = $('div.anythingSlider').index(base.$wrapper) + 1; base.regex = new RegExp('panel' + base.runTimes + '-(\\d+)', 'i'); // hash tag regex if (base.runTimes === 1) { base.makeActive(); } // make the first slider on the page active // Make sure easing function exists. if (!$.isFunction($.easing[o.easing])) { o.easing = "swing"; } // If pauseOnHover then add hover effects if (o.pauseOnHover) { base.$wrapper.hover(function() { if (base.playing) { base.$el.trigger('slideshow_paused', base); base.clearTimer(true); } }, function() { if (base.playing) { base.$el.trigger('slideshow_unpaused', base); base.startStop(base.playing, true); } }); } // If a hash can not be used to trigger the plugin, then go to start panel base.setCurrentPage(base.gotoHash() || o.startPage, false); // Hide/Show navigation & play/stop controls base.slideControls(false); base.$wrapper.bind('mouseenter mouseleave', function(e){ base.hovered = (e.type === "mouseenter") ? true : false; base.slideControls( base.hovered, false ); }); // Add keyboard navigation $(document).keyup(function(e){ // Stop arrow keys from working when focused on form items if (o.enableKeyboard && base.$wrapper.is('.activeSlider') && !e.target.tagName.match('TEXTAREA|INPUT|SELECT')) { if (!o.vertical && (e.which === 38 || e.which === 40)) { return; } switch (e.which) { case 39: case 40: // right & down arrow base.goForward(); break; case 37: case 38: // left & up arrow base.goBack(); break; } } }); // Fix tabbing through the page, but don't change the view if the link is in view (showMultiple = true) base.$items.delegate('a', 'focus.AnythingSlider', function(e){ var panel = $(this).closest('.panel'), indx = base.$items.index(panel) + base.adj; base.$items.find('.focusedLink').removeClass('focusedLink'); $(this).addClass('focusedLink'); base.$window.scrollLeft(0); if ( (indx >= base.currentPage + o.showMultiple || indx < base.currentPage)) { base.gotoPage(indx); e.preventDefault(); } }); // Binds events var triggers = "slideshow_paused slideshow_unpaused slide_init slide_begin slideshow_stop slideshow_start initialized swf_completed".split(" "); $.each("onShowPause onShowUnpause onSlideInit onSlideBegin onShowStop onShowStart onInitialized onSWFComplete".split(" "), function(i,f){ if ($.isFunction(o[f])){ base.$el.bind(triggers[i], o[f]); } }); if ($.isFunction(o.onSlideComplete)){ // Added setTimeout (zero time) to ensure animation is complete... see this bug report: http://bugs.jquery.com/ticket/7157 base.$el.bind('slide_complete', function(){ setTimeout(function(){ o.onSlideComplete(base); }, 0); }); } base.initialized = true; base.$el.trigger('initialized', base); // trigger the slideshow base.startStop(base.playing); }; // called during initialization & to update the slider if a panel is added or deleted base.updateSlider = function(){ // needed for updating the slider base.$el.children('.cloned').remove(); base.$nav.empty(); // set currentPage to 1 in case it was zero - occurs when adding slides after removing them all base.currentPage = base.currentPage || 1; base.$items = base.$el.children(); base.pages = base.$items.length; base.dir = (o.vertical) ? 'top' : 'left'; o.showMultiple = (o.vertical) ? 1 : parseInt(o.showMultiple,10) || 1; // only integers allowed if (o.showMultiple > 1) { if (o.showMultiple > base.pages) { o.showMultiple = base.pages; } base.adjustMultiple = (o.infiniteSlides && base.pages > 1) ? 0 : o.showMultiple - 1; base.pages = base.$items.length - base.adjustMultiple; } // Hide navigation & player if there is only one page base.$controls .add(base.$nav) .add(base.$startStop) .add(base.$forward) .add(base.$back)[(base.pages <= 1) ? 'hide' : 'show'](); if (base.pages > 1) { // Build/update navigation tabs base.buildNavigation(); } // Top and tail the list with 'visible' number of items, top has the last section, and tail has the first // This supports the "infinite" scrolling, also ensures any cloned elements don't duplicate an ID // Moved removeAttr before addClass otherwise IE7 ignores the addClass: http://bugs.jquery.com/ticket/9871 if (o.infiniteSlides && base.pages > 1) { base.$el.prepend( base.$items.filter(':last').clone().removeAttr('id').addClass('cloned') ); // Add support for multiple sliders shown at the same time if (o.showMultiple > 1) { base.$el.append( base.$items.filter(':lt(' + o.showMultiple + ')').clone().removeAttr('id').addClass('cloned').addClass('multiple') ); } else { base.$el.append( base.$items.filter(':first').clone().removeAttr('id').addClass('cloned') ); } base.$el.find('.cloned').each(function(){ // disable all focusable elements in cloned panels to prevent shifting the panels by tabbing $(this).find('a,input,textarea,select,button,area').attr('disabled', 'disabled'); $(this).find('[id]').removeAttr('id'); }); } // We just added two items, time to re-cache the list, then get the dimensions of each panel base.$items = base.$el.children().addClass('panel' + (o.vertical ? ' vertical' : '')); base.setDimensions(); // Set the dimensions of each panel if (o.resizeContents) { base.$items.css('width', base.width); base.$wrapper.css('width', base.getDim(base.currentPage)[0]); base.$wrapper.add(base.$items).css('height', base.height); } else { base.$win.load(function(){ base.setDimensions(); }); // set dimensions after all images load } if (base.currentPage > base.pages) { base.currentPage = base.pages; } base.setCurrentPage(base.currentPage, false); base.$nav.find('a').eq(base.currentPage - 1).addClass('cur'); // update current selection }; // Creates the numbered navigation links base.buildNavigation = function() { if (o.buildNavigation && (base.pages > 1)) { var t, $a; base.$items.filter(':not(.cloned)').each(function(i) { var index = i + 1; t = ((index === 1) ? 'first' : '') + ((index === base.pages) ? 'last' : ''); $a = $('').addClass('panel' + index).wrap('
  • '); base.$nav.append($a.parent()); // use $a.parent() so it will add
  • instead of only the to the
      // If a formatter function is present, use it if ($.isFunction(o.navigationFormatter)) { t = o.navigationFormatter(index, $(this)); $a.html('' + t + ''); // Add formatting to title attribute if text is hidden if (parseInt($a.find('span').css('text-indent'),10) < 0) { $a.addClass(o.tooltipClass).attr('title', t); } } else { $a.html('' + index + ''); } $a.bind(o.clickControls, function(e) { if (!base.flag && o.enableNavigation) { // prevent running functions twice (once for click, second time for focusin) base.flag = true; setTimeout(function(){ base.flag = false; }, 100); base.gotoPage(index); if (o.hashTags) { base.setHash(index); } } e.preventDefault(); }); }); // Add navigation tab scrolling if (o.navigationSize !== false && parseInt(o.navigationSize,10) < base.pages) { if (!base.$controls.find('.anythingNavWindow').length){ base.$nav .before('') .after('') .wrap('
      '); } // include half of the left position to include extra width from themes like tabs-light and tabs-dark (still not perfect) base.navWidths = base.$nav.find('li').map(function(){ return $(this).innerWidth() + Math.ceil(parseInt($(this).find('span').css('left'),10)/2 || 0); }).get(); base.navLeft = 1; // add 5 pixels to make sure the tabs don't wrap to the next line base.$nav.width( base.navWidth( 1, base.pages + 1 ) + 5 ); base.$controls.find('.anythingNavWindow') .width( base.navWidth( 1, o.navigationSize + 1 ) ).end() .find('.prev,.next').bind(o.clickControls, function(e) { if (!base.flag) { base.flag = true; setTimeout(function(){ base.flag = false; }, 200); base.navWindow( base.navLeft + o.navigationSize * ( $(this).is('.prev') ? -1 : 1 ) ); } e.preventDefault(); }); } } }; base.navWidth = function(x,y){ var s = Math.min(x,y), e = Math.max(x,y), w = 0; for (; s < e; s++) { w += base.navWidths[s-1] || 0; } return w; }; base.navWindow = function(n){ var p = base.pages - o.navigationSize + 1; n = (n <= 1) ? 1 : (n > 1 && n < p) ? n : p; if (n !== base.navLeft) { base.$controls.find('.anythingNavWindow').animate( { scrollLeft: base.navWidth(1, n), width: base.navWidth(n, n + o.navigationSize) }, { queue: false, duration: o.animationTime }); base.navLeft = n; } }; // Creates the Forward/Backward buttons base.buildNextBackButtons = function() { base.$forward = $('' + o.forwardText + ''); base.$back = $('' + o.backText + ''); // Bind to the forward and back buttons base.$back.bind(o.clickBackArrow, function(e) { // prevent running functions twice (once for click, second time for swipe) if (o.enableArrows && !base.flag) { base.flag = true; setTimeout(function(){ base.flag = false; }, 100); base.goBack(); } e.preventDefault(); }); base.$forward.bind(o.clickForwardArrow, function(e) { // prevent running functions twice (once for click, second time for swipe) if (o.enableArrows && !base.flag) { base.flag = true; setTimeout(function(){ base.flag = false; }, 100); base.goForward(); } e.preventDefault(); }); // using tab to get to arrow links will show they have focus (outline is disabled in css) base.$back.add(base.$forward).find('a').bind('focusin focusout',function(){ $(this).toggleClass('hover'); }); // Append elements to page base.$back.appendTo( (o.appendBackTo !== null && $(o.appendBackTo).length) ? $(o.appendBackTo) : base.$wrapper ); base.$forward.appendTo( (o.appendForwardTo !== null && $(o.appendForwardTo).length) ? $(o.appendForwardTo) : base.$wrapper ); base.$arrowWidth = base.$forward.width(); // assuming the left & right arrows are the same width - used for toggle }; // Creates the Start/Stop button base.buildAutoPlay = function(){ base.$startStop .html('' + (base.playing ? o.stopText : o.startText) + '') .bind(o.clickSlideshow, function(e) { if (o.enableStartStop) { base.startStop(!base.playing); base.makeActive(); if (base.playing && !o.autoPlayDelayed) { base.goForward(true); } } e.preventDefault(); }) // show button has focus while tabbing .bind('focusin focusout',function(){ $(this).toggleClass('hover'); }); }; // Adjust slider dimensions on parent element resize base.checkResize = function(stopTimer){ clearTimeout(base.resizeTimer); base.resizeTimer = setTimeout(function(){ var w = base.$outer.width() - base.outerPad[0], h = (base.$outer[0].tagName === "BODY" ? base.$win.height() : base.$outer.height()) - base.outerPad[1]; // base.width = width of one panel, so multiply by # of panels; outerPad is padding added for arrows. if (base.width * o.showMultiple !== w || base.height !== h) { base.setDimensions(); // adjust panel sizes // make sure page is lined up (use -1 animation time, so we can differeniate it from when animationTime = 0) base.gotoPage(base.currentPage, base.playing, null, -1); } if (typeof(stopTimer) === 'undefined'){ base.checkResize(); } }, 500); }; // Set panel dimensions to either resize content or adjust panel to content base.setDimensions = function(){ var w, h, c, edge = 0, // determine panel width pw = (o.showMultiple > 1) ? base.width || base.$window.width()/o.showMultiple : base.$window.width(), winw = base.$win.width(); if (o.expand){ w = base.$outer.width() - base.outerPad[0]; base.height = h = base.$outer.height() - base.outerPad[1]; base.$wrapper.add(base.$window).add(base.$items).css({ width: w, height: h }); base.width = pw = (o.showMultiple > 1) ? w/o.showMultiple : w; } base.$items.each(function(i){ c = $(this).children(); if (o.resizeContents){ // resize panel w = base.width; h = base.height; $(this).css({ width: w, height: h }); if (c.length && c[0].tagName === "EMBED") { c.attr({ width: '100%', height: '100%' }); } // needed for IE7; also c.length > 1 in IE7 // resize panel contents, if solitary (wrapped content or solitary image) if (c.length === 1){ c.css({ width: '100%', height: '100%' }); } } else { // get panel width & height and save it w = $(this).width(); // if not defined, it will return the width of the ul parent if (c.length === 1 && w >= winw){ w = (c.width() >= winw) ? pw : c.width(); // get width of solitary child c.css('max-width', w); // set max width for all children } $(this).css('width', w); // set width of panel h = (c.length === 1) ? c.outerHeight(true) : $(this).height(); // get height after setting width $(this).css('height', h); } base.panelSize[i] = [w,h,edge]; edge += (o.vertical) ? h : w; }); // Set total width of slider, Note that this is limited to 32766 by Opera - option removed base.$el.css((o.vertical ? 'height' : 'width'), edge); }; // get dimension of multiple panels, as needed base.getDim = function(page){ if (base.pages < 1 || isNaN(page)) { return [ base.width, base.height ]; } // prevent errors when base.panelSize is empty page = (o.infiniteSlides && base.pages > 1) ? page : page - 1; var i, w = base.panelSize[page][0], h = base.panelSize[page][1]; if (o.showMultiple > 1) { for (i=1; i < o.showMultiple; i++) { w += base.panelSize[(page + i)%o.showMultiple][0]; h = Math.max(h, base.panelSize[page + i][1]); } } return [w,h]; }; base.goForward = function(autoplay) { base.gotoPage(base.currentPage + o.changeBy * (o.playRtl ? -1 : 1), autoplay); }; base.goBack = function(autoplay) { base.gotoPage(base.currentPage + o.changeBy * (o.playRtl ? 1 : -1), autoplay); }; base.gotoPage = function(page, autoplay, callback, time) { if (autoplay !== true) { autoplay = false; base.startStop(false); base.makeActive(); } // check if page is an id or class name if (/^[#|.]/.test(page) && $(page).length) { page = $(page).closest('.panel').index() + base.adj; } // rewind effect occurs here when changeBy > 1 if (o.changeBy !== 1){ if (page < 0) { page += base.pages; } if (page > base.pages) { page -= base.pages; } } if (base.pages <= 1) { return; } // prevents animation base.$lastPage = base.$currentPage; if (typeof(page) !== "number") { page = o.startPanel; base.setCurrentPage(page); } // pause YouTube videos before scrolling or prevent change if playing if (autoplay && o.isVideoPlaying(base)) { return; } if (page > base.pages + 1 - base.adj) { page = (!o.infiniteSlides && !o.stopAtEnd) ? 1 : base.pages; } if (page < base.adj ) { page = (!o.infiniteSlides && !o.stopAtEnd) ? base.pages : 1; } base.currentPage = ( page > base.pages ) ? base.pages : ( page < 1 ) ? 1 : base.currentPage; base.$currentPage = base.$items.eq(base.currentPage - base.adj); base.exactPage = page; base.$targetPage = base.$items.eq( (page === 0) ? base.pages - base.adj : (page > base.pages) ? 1 - base.adj : page - base.adj ); time = time || o.animationTime; // don't trigger events when time = 1 - to prevent FX from firing multiple times on page resize if (time >= 0) { base.$el.trigger('slide_init', base); } base.slideControls(true, false); // When autoplay isn't passed, we stop the timer if (autoplay !== true) { autoplay = false; } // Stop the slider when we reach the last page, if the option stopAtEnd is set to true if (!autoplay || (o.stopAtEnd && page === base.pages)) { base.startStop(false); } if (time >= 0) { base.$el.trigger('slide_begin', base); } // delay starting slide animation setTimeout(function(d){ // resize slider if content size varies if (!o.resizeContents) { // animating the wrapper resize before the window prevents flickering in Firefox d = base.getDim(page); base.$wrapper.filter(':not(:animated)').animate( // prevent animating a dimension to zero { width: d[0] || base.width, height: d[1] || base.height }, { queue: false, duration: (time < 0 ? 0 : time), easing: o.easing } ); } d = {}; d[base.dir] = -base.panelSize[(o.infiniteSlides && base.pages > 1) ? page : page - 1][2]; // Animate Slider base.$el.filter(':not(:animated)').animate( d, { queue: false, duration: time, easing: o.easing, complete: function(){ base.endAnimation(page, callback, time); } } ); }, parseInt(o.delayBeforeAnimate, 10) || 0); }; base.endAnimation = function(page, callback, time){ if (page === 0) { base.$el.css( base.dir, -base.panelSize[base.pages][2]); page = base.pages; } else if (page > base.pages) { // reset back to start position base.$el.css( base.dir, -base.panelSize[1][2]); page = 1; } base.exactPage = page; base.setCurrentPage(page, false); // Add active panel class base.$items.removeClass('activePage').eq(page - base.adj).addClass('activePage'); if (!base.hovered) { base.slideControls(false); } if (time >= 0) { base.$el.trigger('slide_complete', base); } // callback from external slide control: $('#slider').anythingSlider(4, function(slider){ }) if (typeof callback === 'function') { callback(base); } // Continue slideshow after a delay if (o.autoPlayLocked && !base.playing) { setTimeout(function(){ base.startStop(true); // subtract out slide delay as the slideshow waits that additional time. }, o.resumeDelay - (o.autoPlayDelayed ? o.delay : 0)); } }; base.setCurrentPage = function(page, move) { page = parseInt(page, 10); if (base.pages < 1 || page === 0 || isNaN(page)) { return; } if (page > base.pages + 1 - base.adj) { page = base.pages - base.adj; } if (page < base.adj ) { page = 1; } // Set visual if (o.buildNavigation){ base.$nav .find('.cur').removeClass('cur').end() .find('a').eq(page - 1).addClass('cur'); } // hide/show arrows based on infinite scroll mode if (!o.infiniteSlides && o.stopAtEnd){ base.$wrapper .find('span.forward')[ page === base.pages ? 'addClass' : 'removeClass']('disabled').end() .find('span.back')[ page === 1 ? 'addClass' : 'removeClass']('disabled'); if (page === base.pages && base.playing) { base.startStop(); } } // Only change left if move does not equal false if (!move) { var d = base.getDim(page); base.$wrapper .css({ width: d[0], height: d[1] }) .add(base.$window).scrollLeft(0); // reset in case tabbing changed this scrollLeft - probably overly redundant base.$el.css( base.dir, -base.panelSize[(o.infiniteSlides && base.pages > 1) ? page : page - 1][2] ); } // Update local variable base.currentPage = page; base.$currentPage = base.$items.removeClass('activePage').eq(page - base.adj).addClass('activePage'); }; base.makeActive = function(){ // Set current slider as active so keyboard navigation works properly if (!base.$wrapper.is('.activeSlider')){ $('.activeSlider').removeClass('activeSlider'); base.$wrapper.addClass('activeSlider'); } }; // This method tries to find a hash that matches an ID and panel-X // If either found, it tries to find a matching item // If that is found as well, then it returns the page number base.gotoHash = function(){ var h = base.win.location.hash, i = h.indexOf('&'), n = h.match(base.regex); if (n === null && !/^#&/.test(h)) { // #quote2&panel1-3&panel3-3 h = h.substring(0, (i >= 0 ? i : h.length)); // ensure the element is in the same slider n = ($(h).closest('.anythingBase')[0] === base.el) ? $(h).closest('.panel').index() : null; } else if (n !== null) { // #&panel1-3&panel3-3 n = (o.hashTags) ? parseInt(n[1],10) : null; } return n; }; base.setHash = function(n){ var s = 'panel' + base.runTimes + '-', h = base.win.location.hash; if ( typeof h !== 'undefined' ) { base.win.location.hash = (h.indexOf(s) > 0) ? h.replace(base.regex, s + n) : h + "&" + s + n; } }; // Slide controls (nav and play/stop button up or down) base.slideControls = function(toggle){ var dir = (toggle) ? 'slideDown' : 'slideUp', t1 = (toggle) ? 0 : o.animationTime, t2 = (toggle) ? o.animationTime: 0, op = (toggle) ? 1 : 0, sign = (toggle) ? 0 : 1; // 0 = visible, 1 = hidden if (o.toggleControls) { base.$controls.stop(true,true).delay(t1)[dir](o.animationTime/2).delay(t2); } if (o.buildArrows && o.toggleArrows) { if (!base.hovered && base.playing) { sign = 1; op = 0; } // don't animate arrows during slideshow base.$forward.stop(true,true).delay(t1).animate({ right: sign * base.$arrowWidth, opacity: op }, o.animationTime/2); base.$back.stop(true,true).delay(t1).animate({ left: sign * base.$arrowWidth, opacity: op }, o.animationTime/2); } }; base.clearTimer = function(paused){ // Clear the timer only if it is set if (base.timer) { base.win.clearInterval(base.timer); if (!paused && base.slideshow) { base.$el.trigger('slideshow_stop', base); base.slideshow = false; } } }; // Pass startStop(false) to stop and startStop(true) to play base.startStop = function(playing, paused) { if (playing !== true) { playing = false; } // Default if not supplied is false base.playing = playing; if (playing && !paused) { base.$el.trigger('slideshow_start', base); base.slideshow = true; } // Toggle playing and text if (o.buildStartStop) { base.$startStop.toggleClass('playing', playing).find('span').html( playing ? o.stopText : o.startText ); // add button text to title attribute if it is hidden by text-indent if (parseInt(base.$startStop.find('span').css('text-indent'),10) < 0) { base.$startStop.addClass(o.tooltipClass).attr( 'title', playing ? o.stopText : o.startText ); } } // Pause slideshow while video is playing if (playing){ base.clearTimer(true); // Just in case this was triggered twice in a row base.timer = base.win.setInterval(function() { // prevent autoplay if video is playing if ( !o.isVideoPlaying(base) ) { base.goForward(true); // stop slideshow if resume if false } else if (!o.resumeOnVideoEnd) { base.startStop(); } }, o.delay); } else { base.clearTimer(); } }; // Trigger the initialization base.init(); }; $.anythingSlider.defaults = { // Appearance theme : "default", // Theme name, add the css stylesheet manually expand : false, // If true, the entire slider will expand to fit the parent element resizeContents : true, // If true, solitary images/objects in the panel will expand to fit the viewport vertical : false, // If true, all panels will slide vertically; they slide horizontally otherwise showMultiple : false, // Set this value to a number and it will show that many slides at once easing : "swing", // Anything other than "linear" or "swing" requires the easing plugin or jQuery UI buildArrows : true, // If true, builds the forwards and backwards buttons buildNavigation : true, // If true, builds a list of anchor links to link to each panel buildStartStop : true, // ** If true, builds the start/stop button appendForwardTo : null, // Append forward arrow to a HTML element (jQuery Object, selector or HTMLNode), if not null appendBackTo : null, // Append back arrow to a HTML element (jQuery Object, selector or HTMLNode), if not null appendControlsTo : null, // Append controls (navigation + start-stop) to a HTML element (jQuery Object, selector or HTMLNode), if not null appendNavigationTo : null, // Append navigation buttons to a HTML element (jQuery Object, selector or HTMLNode), if not null appendStartStopTo : null, // Append start-stop button to a HTML element (jQuery Object, selector or HTMLNode), if not null toggleArrows : false, // If true, side navigation arrows will slide out on hovering & hide @ other times toggleControls : false, // if true, slide in controls (navigation + play/stop button) on hover and slide change, hide @ other times startText : "Start", // Start button text stopText : "Stop", // Stop button text forwardText : "»", // Link text used to move the slider forward (hidden by CSS, replaced with arrow image) backText : "«", // Link text used to move the slider back (hidden by CSS, replace with arrow image) tooltipClass : "tooltip", // Class added to navigation & start/stop button (text copied to title if it is hidden by a negative text indent) // Function enableArrows : true, // if false, arrows will be visible, but not clickable. enableNavigation : true, // if false, navigation links will still be visible, but not clickable. enableStartStop : true, // if false, the play/stop button will still be visible, but not clickable. Previously "enablePlay" enableKeyboard : true, // if false, keyboard arrow keys will not work for this slider. // Navigation startPanel : 1, // This sets the initial panel changeBy : 1, // Amount to go forward or back when changing panels. hashTags : true, // Should links change the hashtag in the URL? infiniteSlides : true, // if false, the slider will not wrap & not clone any panels navigationFormatter : null, // Details at the top of the file on this use (advanced use) navigationSize : false, // Set this to the maximum number of visible navigation tabs; false to disable // Slideshow options autoPlay : false, // If true, the slideshow will start running; replaces "startStopped" option autoPlayLocked : false, // If true, user changing slides will not stop the slideshow autoPlayDelayed : false, // If true, starting a slideshow will delay advancing slides; if false, the slider will immediately advance to the next slide when slideshow starts pauseOnHover : true, // If true & the slideshow is active, the slideshow will pause on hover stopAtEnd : false, // If true & the slideshow is active, the slideshow will stop on the last page. This also stops the rewind effect when infiniteSlides is false. playRtl : false, // If true, the slideshow will move right-to-left // Times delay : 3000, // How long between slideshow transitions in AutoPlay mode (in milliseconds) resumeDelay : 15000, // Resume slideshow after user interaction, only if autoplayLocked is true (in milliseconds). animationTime : 600, // How long the slideshow transition takes (in milliseconds) delayBeforeAnimate : 0, // How long to pause slide animation before going to the desired slide (used if you want your "out" FX to show). // Callbacks - removed from options to reduce size - they still work // Interactivity clickForwardArrow : "click", // Event used to activate forward arrow functionality (e.g. add jQuery mobile's "swiperight") clickBackArrow : "click", // Event used to activate back arrow functionality (e.g. add jQuery mobile's "swipeleft") clickControls : "click focusin", // Events used to activate navigation control functionality clickSlideshow : "click", // Event used to activate slideshow play/stop button // Video resumeOnVideoEnd : true, // If true & the slideshow is active & a supported video is playing, it will pause the autoplay until the video is complete addWmodeToObject : "opaque", // If your slider has an embedded object, the script will automatically add a wmode parameter with this setting isVideoPlaying : function(base){ return false; } // return true if video is playing or false if not - used by video extension }; $.fn.anythingSlider = function(options, callback) { return this.each(function(){ var page, anySlide = $(this).data('AnythingSlider'); // initialize the slider but prevent multiple initializations if ((typeof(options)).match('object|undefined')){ if (!anySlide) { (new $.anythingSlider(this, options)); } else { anySlide.updateSlider(); } // If options is a number, process as an external link to page #: $(element).anythingSlider(#) } else if (/\d/.test(options) && !isNaN(options) && anySlide) { page = (typeof(options) === "number") ? options : parseInt($.trim(options),10); // accepts " 2 " // ignore out of bound pages if ( page >= 1 && page <= anySlide.pages ) { anySlide.gotoPage(page, false, callback); // page #, autoplay, one time callback } // Accept id or class name } else if (/^[#|.]/.test(options) && $(options).length) { anySlide.gotoPage(options, false, callback); } }); }; })(jQuery); /* * AnythingSlider Video Controller 1.0 beta for AnythingSlider v1.6+ * By Rob Garrison (aka Mottie & Fudgey) * Dual licensed under the MIT and GPL licenses. */ (function($) { $.fn.anythingSliderVideo = function(options){ //Set the default values, use comma to separate the settings, example: var defaults = { videoID : 'asvideo' // id prefix }; return this.each(function(){ // make sure a AnythingSlider is attached var video, tmp, service, sel, base = $(this).data('AnythingSlider'); if (!base) { return; } video = base.video = {}; video.options = $.extend({}, defaults, options); // check if SWFObject is loaded video.hasSwfo = (typeof(swfobject) !== 'undefined' && swfobject.hasOwnProperty('embedSWF') && typeof(swfobject.embedSWF) === 'function') ? true : false; video.list = {}; video.hasVid = false; video.hasEmbed = false; video.services = $.fn.anythingSliderVideo.services; video.len = 0; // used to add a unique ID to videos "asvideo#" video.hasEmbedCount = 0; video.hasiframeCount = 0; video.$items = base.$items.filter(':not(.cloned)'); // find and save all known videos for (service in video.services) { if (typeof(service) === 'string') { sel = video.services[service].selector; video.$items.find(sel).each(function(){ tmp = $(this); // save panel and video selector in the list tmp.attr('id', video.options.videoID + video.len); video.list[video.len] = { id : video.options.videoID + video.len++, panel : tmp.closest('.panel')[0], service : service, selector : sel, status : -1 // YouTube uses -1 to mean the video is unstarted }; video.hasVid = true; if (sel.match('embed|object')) { video.hasEmbed = true; video.hasEmbedCount++; } else if (sel.match('iframe')) { video.hasiframeCount++; } }); } } // Initialize each video, as needed $.each(video.list, function(i,s){ // s.id = ID, s.panel = slider panel (DOM), s.selector = 'jQuery selector' var tmp, $tar, vidsrc, opts, $vid = $(s.panel).find(s.selector), service = video.services[s.service], api = service.initAPI || ''; // Initialize embeded video javascript api using SWFObject, if loaded if (video.hasEmbed && video.hasSwfo && s.selector.match('embed|object')) { $vid.each(function(){ // Older IE doesn't have an object - just make sure we are wrapping the correct element $tar = ($(this).parent()[0].tagName === 'OBJECT') ? $(this).parent() : $(this); vidsrc = ($tar[0].tagName === 'EMBED') ? $tar.attr('src') : $tar.find('embed').attr('src') || $tar.children().filter('[name=movie]').attr('value'); opts = $.extend(true, {}, { flashvars : null, params : { allowScriptAccess: 'always', wmode : base.options.addWmodeToObject, allowfullscreen : true }, attr : { 'class' : $tar.attr('class'), 'style' : $tar.attr('style'), 'data-url' : vidsrc } }, service.embedOpts); $tar.wrap('
      '); // use SWFObject if it exists, it replaces the wrapper with the object/embed swfobject.embedSWF(vidsrc + (api === '' ? '': api + s.id), s.id, $tar.attr('width'), $tar.attr('height'), '10', null, opts.flashvars, opts.params, opts.attr, function(){ // run init code if it exists if (service.hasOwnProperty('init')) { video.list[i].player = service.init(base, s.id, i); } if (i >= video.hasEmbedCount) { base.$el.trigger('swf_completed', base); // swf callback } } ); }); } else if (s.selector.match('iframe')) { $vid.each(function(i,v){ vidsrc = $(this).attr('src'); tmp = (vidsrc.match(/\?/g) ? '' : '?') + '&wmode=' + base.options.addWmodeToObject; // string connector & wmode $(this).attr('src', function(i,r){ return r + tmp + (api === '' ? '': api + s.id); }); }); } }); // Returns URL parameter; url: http://www.somesite.com?name=hello&id=11111 // Original code from Netlobo.com (http://www.netlobo.com/url_query_string_javascript.html) video.gup = function(n,s){ n = n.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]"); var p = (new RegExp("[\\?&]"+n+"=([^&#]*)")).exec(s || window.location.href); return (p===null) ? "" : p[1]; }; // postMessage to iframe - http://benalman.com/projects/jquery-postmessage-plugin/ (FOR IE7) video.postMsg = function(data, vid){ var $vid = $('#' + vid); if ($vid.length){ $vid[0].contentWindow.postMessage(data, $vid.attr('src').split('?')[0]); } }; // receive message from iframe video.message = function(e){ if (e.data) { if (/infoDelivery/g.test(e.data)) { return; } // ignore youtube video loading spam var data = $.parseJSON(e.data); $.each(video.list, function(i,s){ if (video.services[video.list[i].service].hasOwnProperty('message')) { video.services[video.list[i].service].message(base, data); } }); } }; // toDO = 'cont', 'pause' or 'isPlaying' video.control = function(toDo){ var i, s = video.list, slide = (toDo === 'pause') ? base.$lastPage[0] : base.$currentPage[0], isPlaying = false; for (i=0; i < video.len; i++){ if (s[i].panel === slide && video.services[s[i].service].hasOwnProperty(toDo)){ isPlaying = video.services[s[i].service][toDo](base, s[i].id, i); } } return isPlaying; }; // iframe event listener if (video.hasiframeCount){ if (window.addEventListener){ window.addEventListener('message', video.message, false); } else { // IE window.attachEvent('onmessage', video.message, false); } } // bind to events base.$el .bind('slide_init', function(){ video.control('pause'); }) .bind('slide_complete', function(){ video.control('cont'); }); base.options.isVideoPlaying = function(){ return video.control('isPlaying'); }; }); }; /* Each video service is set up as follows * service-name : { * // initialization * selector : 'object[data-url*=service], embed[src*=service]', // required: jQuery selector used to find the video ('video' or 'iframe[src*=service]' are other examples) * initAPI : 'string added to the URL to initialize the API', // optional: the string must end with a parameter pointing to the video id (e.g. "&player_id=") * embedOpts : { flashvars: {}, params: {}, attr: {} }, // optional: add any required flashvars, parameters or attributes to initialize the API * // video startup functions * init : function(base, vid, index){ }, // optional: include any additional initialization code here; function called AFTER the embeded video is added using SWFObject * // required functions * cont : function(base, vid, index){ }, // required: continue play if video was previously played * pause : function(base, vid, index){ }, // required: pause ALL videos * message : function(base, data){ }, // required for iframe: process data received from iframe and update the video status for the "isPlaying" function * isPlaying : function(base, vid, index){ } // required: return true if video is playing and return false if not playing (paused or ended) * } * * Function variables * base (object) = plugin base, all video values/functions are stored in base.video * vid (string) is the ID of the video: vid = "asvideo1"; so jQuery needs a "#" in front... "#" + videoID option default ("asvideo") + index (e.g. "1"); each video matching a service will have a unquie vid * index (number) is the unique video number from the vid (starts from zero) * * var list = base.video.list[index]; list will contain: * list.id = vid * list.service = service name (e.g. 'video', 'vimeo1', 'vimeo2', etc) * list.selector = 'jQuery selector' (e.g. 'video', 'object[data-url*=vimeo]', 'iframe[src*=vimeo]', etc) * list.panel = AnythingSlider panel DOM object. So you can target the video using $(list[index].panel).find(list[index].service) or $('#' + vid) * list.status = video status, updated by the iframe event listeners added in the video service "ready" function; see examples below */ $.fn.anythingSliderVideo.services = { // *** HTML5 video *** video : { selector : 'video', cont : function(base, vid, index){ var $vid = $('#' + vid); if ($vid.length && $vid[0].paused && $vid[0].currentTime > 0 && !$vid[0].ended) { $vid[0].play(); } }, pause : function(base, vid){ // pause ALL videos on the page $('video').each(function(){ if (typeof(this.pause) !== 'undefined') { this.pause(); } // throws an error in older ie without this }); }, isPlaying : function(base, vid, index){ var $vid = $('#' + vid); // media.paused seems to be the only way to determine if a video is playing return ($vid.length && typeof($vid[0].pause) !== 'undefined' && !$vid[0].paused && !$vid[0].ended) ? true : false; } }, // *** Vimeo iframe *** isolated demo: http://jsfiddle.net/Mottie/GxwEX/ vimeo1 : { selector : 'iframe[src*=vimeo]', initAPI : '&api=1&player_id=', // video ID added to the end cont : function(base, vid, index){ if (base.video.list[index].status === 'pause'){ // Commands sent to the iframe originally had "JSON.stringify" applied to them, // but not all browsers support this, so it's just as easy to wrap it in quotes. base.video.postMsg('{"method":"play"}', vid); } }, pause : function(base, vid){ // pause ALL videos on the page $('iframe[src*=vimeo]').each(function(){ base.video.postMsg('{"method":"pause"}', this.id); }); }, message : function(base, data){ // *** VIMEO *** iframe uses data.player_id var index, vid = data.player_id || ''; // vid = data.player_id (unique to vimeo) if (vid !== ''){ index = vid.replace(base.video.options.videoID, ''); if (data.event === 'ready') { // Vimeo ready, add additional event listeners for video status base.video.postMsg('{"method":"addEventListener","value":"play"}', vid); base.video.postMsg('{"method":"addEventListener","value":"pause"}', vid); base.video.postMsg('{"method":"addEventListener","value":"finish"}', vid); } // update current status - vimeo puts it in data.event if (base.video.list[index]) { base.video.list[index].status = data.event; } } }, isPlaying : function(base, vid, index){ return (base.video.list[index].status === 'play') ? true : false; } }, // *** Embeded Vimeo *** // SWFObject adds the url to the object data // using param as a selector, the script above looks for the parent if it sees "param" vimeo2 : { selector : 'object[data-url*=vimeo], embed[src*=vimeo]', embedOpts : { flashvars : { api : 1 } }, cont : function(base, vid, index) { var $vid = $('#' + vid); // continue video if previously played & not finished (api_finish doesn't seem to exist) - duration can be a decimal number, so subtract it and look at the difference (2 seconds here) if (typeof($vid[0].api_play) === 'function' && $vid[0].api_paused() && $vid[0].api_getCurrentTime() !== 0 && ($vid[0].api_getDuration() - $vid[0].api_getCurrentTime()) > 2) { $vid[0].api_play(); } }, pause : function(base, vid){ // find ALL videos and pause them, just in case $('object[data-url*=vimeo], embed[src*=vimeo]').each(function(){ var el = (this.tagName === 'EMBED') ? $(this).parent()[0] : this; if (typeof(el.api_pause) === 'function') { el.api_pause(); } }); }, isPlaying : function(base, vid, index){ var $vid = $('#' + vid); return (typeof($vid[0].api_paused) === 'function' && !$vid[0].api_paused()) ? true : false; } }, // *** iframe YouTube *** isolated demo: http://jsfiddle.net/Mottie/qk5MY/ youtube1 : { selector : 'iframe[src*=youtube]', // "iv_load_policy=3" should turn off annotations on init, but doesn't seem to initAPI : '&iv_load_policy=3&enablejsapi=1&playerapiid=', cont : function(base, vid, index){ if (base.video.list[index].status === 2){ base.video.postMsg('{"event":"command","func":"playVideo"}', vid); } }, pause : function(base, vid, index){ // pause ALL videos on the page - in IE, pausing a video means it will continue when next seen =( $('iframe[src*=youtube]').each(function(){ // if (this.id !== vid || (this.id === vid && base.video.list[index].status >= 0)) { // trying to fix the continue video problem; this only breaks it base.video.postMsg('{"event":"command","func":"pauseVideo"}', vid); // } }); }, message : function(base, data){ if (data.event === 'infoDelivery') { return; } // ignore youtube video loading spam // *** YouTube *** iframe returns an embeded url (data.info.videoUrl) but no video id... if (data.info && data.info.videoUrl) { // figure out vid for youtube // data.info.videoURL = http://www.youtube.com/watch?v=###########&feature=player_embedded var url = base.video.gup('v', data.info.videoUrl), // end up with ###########, now find it vid = $('iframe[src*=' + url + ']')[0].id, index = vid.replace(base.video.options.videoID, ''); // YouTube ready, add additional event listeners for video status. BUT this never fires off =( // Fixing this may solve the continue problem if (data.event === 'onReady') { base.video.postMsg('{"event":"listening","func":"onStateChange"}', vid); // **** FIX: NEED TO DETERMINE VID *** } // Update status, so the "isPlaying" function can access it if (data.event === 'onStateChange' && base.video.list[index]) { // update list with current status; data.state = YouTube base.video.list[index].status = data.state; } } }, isPlaying : function(base, vid, index){ var status = base.video.list[index].status; // state: unstarted (-1), ended (0), playing (1), paused (2), buffering (3), video cued (5). return (status === 1 || status > 2) ? true : false; } }, // *** Embeded YouTube *** // include embed for IE; SWFObject adds the url to the object data attribute youtube2 : { selector : 'object[data-url*=youtube], embed[src*=youtube]', initAPI : '&iv_load_policy=3&enablejsapi=1&version=3&playerapiid=', // video ID added to the end // YouTube - player states: unstarted (-1), ended (0), playing (1), paused (2), buffering (3), video cued (5). cont : function(base, vid, index) { var $vid = $('#' + vid); // continue video if previously played and not cued if ($vid.length && typeof($vid[0].getPlayerState) === 'function' && $vid[0].getPlayerState() > 0) { $vid[0].playVideo(); } }, pause : function(base, vid){ // find ALL videos and pause them, just in case $('object[data-url*=youtube], embed[src*=youtube]').each(function(){ var el = (this.tagName === 'EMBED') ? $(this).parent()[0] : this; // player states: unstarted (-1), ended (0), playing (1), paused (2), buffering (3), video cued (5). if (typeof(el.getPlayerState) === 'function' && el.getPlayerState() > 0) { // pause video if not autoplaying (if already initialized) el.pauseVideo(); } }); }, isPlaying : function(base, vid){ var $vid = $('#' + vid); return (typeof($vid[0].getPlayerState) === 'function' && ($vid[0].getPlayerState() === 1 || $vid[0].getPlayerState() > 2)) ? true : false; } } }; })(jQuery); // Initialize video extension automatically jQuery(window).load(function(){ jQuery('.anythingBase').anythingSliderVideo(); }); /* =============================================== 02. jQuery Nivo Slider v2.6 =============================================== * * http://nivo.dev7studios.com * * Copyright 2024, Gilbert Pellegrom * Free to use and abuse under the MIT license. * http://www.opensource.org/licenses/mit-license.html * * March 2024 */ (function($){var NivoSlider=function(element,options){var settings=$.extend({},$.fn.nivoSlider.defaults,options);var vars={currentSlide:0,currentImage:'',totalSlides:0,randAnim:'',running:false,paused:false,stop:false};var slider=$(element);slider.data('nivo:vars',vars);slider.css('position','relative');slider.addClass('nivoSlider');var kids=slider.children();kids.each(function(){var child=$(this);var link='';if(!child.is('img')){if(child.is('a')){child.addClass('nivo-imageLink');link=child;} child=child.find('img:first');} var childWidth=child.width();if(childWidth==0)childWidth=child.attr('width');var childHeight=child.height();if(childHeight==0)childHeight=child.attr('height');if(childWidth>slider.width()){slider.width(childWidth);} if(childHeight>slider.height()){slider.height(childHeight);} if(link!=''){link.css('display','none');} child.css('display','none');vars.totalSlides++;});if(settings.startSlide>0){if(settings.startSlide>=vars.totalSlides)settings.startSlide=vars.totalSlides-1;vars.currentSlide=settings.startSlide;} if($(kids[vars.currentSlide]).is('img')){vars.currentImage=$(kids[vars.currentSlide]);}else{vars.currentImage=$(kids[vars.currentSlide]).find('img:first');} if($(kids[vars.currentSlide]).is('a')){$(kids[vars.currentSlide]).css('display','block');} slider.css('background','url("'+vars.currentImage.attr('src')+'") no-repeat');slider.append($('

      ').css({display:'none',opacity:settings.captionOpacity}));var processCaption=function(settings){var nivoCaption=$('.nivo-caption',slider);if(vars.currentImage.attr('title')!=''&&vars.currentImage.attr('title')!=undefined){var title=vars.currentImage.attr('title');if(title.substr(0,1)=='#')title=$(title).html();if(nivoCaption.css('display')=='block'){nivoCaption.find('p').fadeOut(settings.animSpeed,function(){$(this).html(title);$(this).fadeIn(settings.animSpeed);});}else{nivoCaption.find('p').html(title);} nivoCaption.fadeIn(settings.animSpeed);}else{nivoCaption.fadeOut(settings.animSpeed);}} processCaption(settings);var timer=0;if(!settings.manualAdvance&&kids.length>1){timer=setInterval(function(){nivoRun(slider,kids,settings,false);},settings.pauseTime);} if(settings.directionNav){slider.append('');if(settings.directionNavHide){$('.nivo-directionNav',slider).hide();slider.hover(function(){$('.nivo-directionNav',slider).show();},function(){$('.nivo-directionNav',slider).hide();});} $('a.nivo-prevNav',slider).live('click',function(){if(vars.running)return false;clearInterval(timer);timer='';vars.currentSlide-=2;nivoRun(slider,kids,settings,'prev');});$('a.nivo-nextNav',slider).live('click',function(){if(vars.running)return false;clearInterval(timer);timer='';nivoRun(slider,kids,settings,'next');});} if(settings.controlNav){var nivoControl=$('
      ');slider.append(nivoControl);for(var i=0;i');}else{nivoControl.append('');}}else{nivoControl.append(''+(i+1)+'');}} $('.nivo-controlNav a:eq('+vars.currentSlide+')',slider).addClass('active');$('.nivo-controlNav a',slider).live('click',function(){if(vars.running)return false;if($(this).hasClass('active'))return false;clearInterval(timer);timer='';slider.css('background','url("'+vars.currentImage.attr('src')+'") no-repeat');vars.currentSlide=$(this).attr('rel')-1;nivoRun(slider,kids,settings,'control');});} if(settings.keyboardNav){$(window).keypress(function(event){if(event.keyCode=='37'){if(vars.running)return false;clearInterval(timer);timer='';vars.currentSlide-=2;nivoRun(slider,kids,settings,'prev');} if(event.keyCode=='39'){if(vars.running)return false;clearInterval(timer);timer='';nivoRun(slider,kids,settings,'next');}});} if(settings.pauseOnHover){slider.hover(function(){vars.paused=true;clearInterval(timer);timer='';},function(){vars.paused=false;if(timer==''&&!settings.manualAdvance){timer=setInterval(function(){nivoRun(slider,kids,settings,false);},settings.pauseTime);}});} slider.bind('nivo:animFinished',function(){vars.running=false;$(kids).each(function(){if($(this).is('a')){$(this).css('display','none');}});if($(kids[vars.currentSlide]).is('a')){$(kids[vars.currentSlide]).css('display','block');} if(timer==''&&!vars.paused&&!settings.manualAdvance){timer=setInterval(function(){nivoRun(slider,kids,settings,false);},settings.pauseTime);} settings.afterChange.call(this);});var createSlices=function(slider,settings,vars){for(var i=0;i').css({left:(sliceWidth*i)+'px',width:(slider.width()-(sliceWidth*i))+'px',height:'0px',opacity:'0',background:'url("'+vars.currentImage.attr('src')+'") no-repeat -'+((sliceWidth+(i*sliceWidth))-sliceWidth)+'px 0%'}));}else{slider.append($('
      ').css({left:(sliceWidth*i)+'px',width:sliceWidth+'px',height:'0px',opacity:'0',background:'url("'+vars.currentImage.attr('src')+'") no-repeat -'+((sliceWidth+(i*sliceWidth))-sliceWidth)+'px 0%'}));}}} var createBoxes=function(slider,settings,vars){var boxWidth=Math.round(slider.width()/settings.boxCols);var boxHeight=Math.round(slider.height()/settings.boxRows);for(var rows=0;rows').css({opacity:0,left:(boxWidth*cols)+'px',top:(boxHeight*rows)+'px',width:(slider.width()-(boxWidth*cols))+'px',height:boxHeight+'px',background:'url("'+vars.currentImage.attr('src')+'") no-repeat -'+((boxWidth+(cols*boxWidth))-boxWidth)+'px -'+((boxHeight+(rows*boxHeight))-boxHeight)+'px'}));}else{slider.append($('
      ').css({opacity:0,left:(boxWidth*cols)+'px',top:(boxHeight*rows)+'px',width:boxWidth+'px',height:boxHeight+'px',background:'url("'+vars.currentImage.attr('src')+'") no-repeat -'+((boxWidth+(cols*boxWidth))-boxWidth)+'px -'+((boxHeight+(rows*boxHeight))-boxHeight)+'px'}));}}}} var nivoRun=function(slider,kids,settings,nudge){var vars=slider.data('nivo:vars');if(vars&&(vars.currentSlide==vars.totalSlides-1)){settings.lastSlide.call(this);} if((!vars||vars.stop)&&!nudge)return false;settings.beforeChange.call(this);if(!nudge){slider.css('background','url("'+vars.currentImage.attr('src')+'") no-repeat');}else{if(nudge=='prev'){slider.css('background','url("'+vars.currentImage.attr('src')+'") no-repeat');} if(nudge=='next'){slider.css('background','url("'+vars.currentImage.attr('src')+'") no-repeat');}} vars.currentSlide++;if(vars.currentSlide==vars.totalSlides){vars.currentSlide=0;settings.slideshowEnd.call(this);} if(vars.currentSlide<0)vars.currentSlide=(vars.totalSlides-1);if($(kids[vars.currentSlide]).is('img')){vars.currentImage=$(kids[vars.currentSlide]);}else{vars.currentImage=$(kids[vars.currentSlide]).find('img:first');} if(settings.controlNav){$('.nivo-controlNav a',slider).removeClass('active');$('.nivo-controlNav a:eq('+vars.currentSlide+')',slider).addClass('active');} processCaption(settings);$('.nivo-slice',slider).remove();$('.nivo-box',slider).remove();if(settings.effect=='random'){var anims=new Array('sliceDownRight','sliceDownLeft','sliceUpRight','sliceUpLeft','sliceUpDown','sliceUpDownLeft','fold','fade','boxRandom','boxRain','boxRainReverse','boxRainGrow','boxRainGrowReverse');vars.randAnim=anims[Math.floor(Math.random()*(anims.length+1))];if(vars.randAnim==undefined)vars.randAnim='fade';} if(settings.effect.indexOf(',')!=-1){var anims=settings.effect.split(',');vars.randAnim=anims[Math.floor(Math.random()*(anims.length))];if(vars.randAnim==undefined)vars.randAnim='fade';} vars.running=true;if(settings.effect=='sliceDown'||settings.effect=='sliceDownRight'||vars.randAnim=='sliceDownRight'||settings.effect=='sliceDownLeft'||vars.randAnim=='sliceDownLeft'){createSlices(slider,settings,vars);var timeBuff=0;var i=0;var slices=$('.nivo-slice',slider);if(settings.effect=='sliceDownLeft'||vars.randAnim=='sliceDownLeft')slices=$('.nivo-slice',slider)._reverse();slices.each(function(){var slice=$(this);slice.css({'top':'0px'});if(i==settings.slices-1){setTimeout(function(){slice.animate({height:'100%',opacity:'1.0'},settings.animSpeed,'',function(){slider.trigger('nivo:animFinished');});},(100+timeBuff));}else{setTimeout(function(){slice.animate({height:'100%',opacity:'1.0'},settings.animSpeed);},(100+timeBuff));} timeBuff+=50;i++;});} else if(settings.effect=='sliceUp'||settings.effect=='sliceUpRight'||vars.randAnim=='sliceUpRight'||settings.effect=='sliceUpLeft'||vars.randAnim=='sliceUpLeft'){createSlices(slider,settings,vars);var timeBuff=0;var i=0;var slices=$('.nivo-slice',slider);if(settings.effect=='sliceUpLeft'||vars.randAnim=='sliceUpLeft')slices=$('.nivo-slice',slider)._reverse();slices.each(function(){var slice=$(this);slice.css({'bottom':'0px'});if(i==settings.slices-1){setTimeout(function(){slice.animate({height:'100%',opacity:'1.0'},settings.animSpeed,'',function(){slider.trigger('nivo:animFinished');});},(100+timeBuff));}else{setTimeout(function(){slice.animate({height:'100%',opacity:'1.0'},settings.animSpeed);},(100+timeBuff));} timeBuff+=50;i++;});} else if(settings.effect=='sliceUpDown'||settings.effect=='sliceUpDownRight'||vars.randAnim=='sliceUpDown'||settings.effect=='sliceUpDownLeft'||vars.randAnim=='sliceUpDownLeft'){createSlices(slider,settings,vars);var timeBuff=0;var i=0;var v=0;var slices=$('.nivo-slice',slider);if(settings.effect=='sliceUpDownLeft'||vars.randAnim=='sliceUpDownLeft')slices=$('.nivo-slice',slider)._reverse();slices.each(function(){var slice=$(this);if(i==0){slice.css('top','0px');i++;}else{slice.css('bottom','0px');i=0;} if(v==settings.slices-1){setTimeout(function(){slice.animate({height:'100%',opacity:'1.0'},settings.animSpeed,'',function(){slider.trigger('nivo:animFinished');});},(100+timeBuff));}else{setTimeout(function(){slice.animate({height:'100%',opacity:'1.0'},settings.animSpeed);},(100+timeBuff));} timeBuff+=50;v++;});} else if(settings.effect=='fold'||vars.randAnim=='fold'){createSlices(slider,settings,vars);var timeBuff=0;var i=0;$('.nivo-slice',slider).each(function(){var slice=$(this);var origWidth=slice.width();slice.css({top:'0px',height:'100%',width:'0px'});if(i==settings.slices-1){setTimeout(function(){slice.animate({width:origWidth,opacity:'1.0'},settings.animSpeed,'',function(){slider.trigger('nivo:animFinished');});},(100+timeBuff));}else{setTimeout(function(){slice.animate({width:origWidth,opacity:'1.0'},settings.animSpeed);},(100+timeBuff));} timeBuff+=50;i++;});} else if(settings.effect=='fade'||vars.randAnim=='fade'){createSlices(slider,settings,vars);var firstSlice=$('.nivo-slice:first',slider);firstSlice.css({'height':'100%','width':slider.width()+'px'});firstSlice.animate({opacity:'1.0'},(settings.animSpeed*2),'',function(){slider.trigger('nivo:animFinished');});} else if(settings.effect=='slideInRight'||vars.randAnim=='slideInRight'){createSlices(slider,settings,vars);var firstSlice=$('.nivo-slice:first',slider);firstSlice.css({'height':'100%','width':'0px','opacity':'1'});firstSlice.animate({width:slider.width()+'px'},(settings.animSpeed*2),'',function(){slider.trigger('nivo:animFinished');});} else if(settings.effect=='slideInLeft'||vars.randAnim=='slideInLeft'){createSlices(slider,settings,vars);var firstSlice=$('.nivo-slice:first',slider);firstSlice.css({'height':'100%','width':'0px','opacity':'1','left':'','right':'0px'});firstSlice.animate({width:slider.width()+'px'},(settings.animSpeed*2),'',function(){firstSlice.css({'left':'0px','right':''});slider.trigger('nivo:animFinished');});} else if(settings.effect=='boxRandom'||vars.randAnim=='boxRandom'){createBoxes(slider,settings,vars);var totalBoxes=settings.boxCols*settings.boxRows;var i=0;var timeBuff=0;var boxes=shuffle($('.nivo-box',slider));boxes.each(function(){var box=$(this);if(i==totalBoxes-1){setTimeout(function(){box.animate({opacity:'1'},settings.animSpeed,'',function(){slider.trigger('nivo:animFinished');});},(100+timeBuff));}else{setTimeout(function(){box.animate({opacity:'1'},settings.animSpeed);},(100+timeBuff));} timeBuff+=20;i++;});} else if(settings.effect=='boxRain'||vars.randAnim=='boxRain'||settings.effect=='boxRainReverse'||vars.randAnim=='boxRainReverse'||settings.effect=='boxRainGrow'||vars.randAnim=='boxRainGrow'||settings.effect=='boxRainGrowReverse'||vars.randAnim=='boxRainGrowReverse'){createBoxes(slider,settings,vars);var totalBoxes=settings.boxCols*settings.boxRows;var i=0;var timeBuff=0;var rowIndex=0;var colIndex=0;var box2Darr=new Array();box2Darr[rowIndex]=new Array();var boxes=$('.nivo-box',slider);if(settings.effect=='boxRainReverse'||vars.randAnim=='boxRainReverse'||settings.effect=='boxRainGrowReverse'||vars.randAnim=='boxRainGrowReverse'){boxes=$('.nivo-box',slider)._reverse();} boxes.each(function(){box2Darr[rowIndex][colIndex]=$(this);colIndex++;if(colIndex==settings.boxCols){rowIndex++;colIndex=0;box2Darr[rowIndex]=new Array();}});for(var cols=0;cols<(settings.boxCols*2);cols++){var prevCol=cols;for(var rows=0;rows=0&&prevCol .exposureLastImage').remove()},onCarousel:function(firstImage,lastImage){},onNext:function(){},onPrev:function(){},onPageChanged:function(){$('.exposureThumbs li.current').show().each(function(i){var imageHeight=$(this).find('img').height();if(imageHeight>0){$(this).height(imageHeight)}})},onPagingLink:function(link){return link},separatePageBrowsing:false,loop:true,onEndOfLoop:function(){},pageSize:5,viewFirstImage:true,visiblePages:5,preloadBuffer:3,keyboardNavigation:true,clickingNavigation:true,fixedContainerSize:false,maxWidth:null,maxHeight:null,stretchToMaxSize:false,fullScreen:false,onEnterFullScreen:function(mask){mask.show()},onExitFullScreen:function(target,mask){target.hide();mask.hide()},showThumbToolTip:true,onEmpty:function(){$('.exposureThumbs').hide();$($.exposure.target).remove();if($.exposure.showControls){$($.exposure.controlsTarget).remove()}if($.exposure.slideshowControlsTarget){$($.exposure.slideshowControlsTarget).remove()}},onInit:function(){},allowDuplicates:true,jsonSource:null};var opts=$.extend($defaults,$args);for(i in opts){if($$.defined($defaults[i])){$.exposure[i]=opts[i]}}if(!$($.exposure.target).length){$('
      ').insertBefore($(this))}var wrapper=$('
      ');var target=$($.exposure.target).addClass('exposureTarget').append(wrapper);if($.exposure.showCaption||$.exposure.showExtraData){var dataElementsHtml='';if($.exposure.showCaptions){dataElementsHtml+='
      '}if($.exposure.showExtraData){dataElementsHtml+='
      '}var dataElements=$(dataElementsHtml);if(dataElements.length){if($.exposure.dataTarget&&$($.exposure.dataTarget).length){$($.exposure.dataTarget).addClass('exposureData').append(dataElements)}else{$.exposure.dataTarget=null;target.append($('
      ').append(dataElements))}}}if(!$.exposure.showThumbs){$.exposure.carouselControls=false}if($.exposure.carouselControls||!$.exposure.controlsTarget||(!$.exposure.controls.prevNext&&!$.exposure.controls.firstLast&&!$.exposure.controls.pageNumbers)){$.exposure.showControls=false}if($.exposure.showControls){$($.exposure.controlsTarget).addClass('exposureControls').each(function(){if($.exposure.controls.firstLast){$(this).append($(''+$.exposure.texts.first+'').click($.exposure.first))}if($.exposure.controls.prevNext){$(this).append($(''+$.exposure.texts.previous+'').click($.exposure.prev))}if($.exposure.controls.pageNumbers){$(this).append($('
      '))}if($.exposure.controls.prevNext){$(this).append($(''+$.exposure.texts.next+'').click($.exposure.next))}if($.exposure.controls.firstLast){$(this).append($(''+$.exposure.texts.last+'').click($.exposure.last))}})}if($.exposure.enableSlideshow&&$.exposure.slideshowControlsTarget){$($.exposure.slideshowControlsTarget).addClass('exposureSlideshowControls').each(function(){$(this).append($(''+$.exposure.texts.play+'').click($.exposure.playSlideshow));$(this).append($(''+$.exposure.texts.pause+'').hide().click($.exposure.pauseSlideshow))})}if($.exposure.keyboardNavigation){$(document).bind('keyup','left',$.exposure.prevImage);$(document).bind('keyup','right',$.exposure.nextImage);$(document).bind('keyup','ctrl+left',$.exposure.prevPage);$(document).bind('keyup','ctrl+right',$.exposure.nextPage);$(document).bind('keyup','up',$.exposure.lastImage);$(document).bind('keyup','down',$.exposure.firstImage);$(document).bind('keyup','ctrl+up',$.exposure.lastPage);$(document).bind('keyup','ctrl+down',$.exposure.firstPage);if($.exposure.enableSlideshow){$(document).bind('keyup','space',$.exposure.toggleSlideshow)}}if($.exposure.fullScreen){$(window).resize($.exposure.fitToWindow);$('
      ').click($.exposure.exitFullScreen).insertAfter(target);if($.exposure.keyboardNavigation){$(document).bind('keyup','esc',$.exposure.exitFullScreen)}}var jsonImages=null;if($.exposure.jsonSource){if($$.object($.exposure.jsonSource)){jsonImages=$.exposure.jsonSource}else if($.exposure.jsonSource.length){if($$.startsWith($.exposure.jsonSource,"http://")||$$.startsWith($.exposure.jsonSource,"https://")){jsonImages=$.ajax({url:$.exposure.jsonSource,type:'GET',async:false}).responseText}else{jsonImages=$.exposure.jsonSource}}}return this.addClass('exposureThumbs').each(function(){var i;if(jsonImages){var images=$$.object(jsonImages)?jsonImages:$.parseJSON(jsonImages);if(images&&images.data){for(i in images.data){var photo=images.data[i];if(photo.source&&photo.source.length){var item=$('
    • ');var link=$('').attr('href',photo.source);if(photo.thumb_source&&photo.thumb_source.length){var thumb=$('').attr('src',photo.thumb_source);if(photo.caption&&photo.caption.length){thumb.attr('title',photo.caption)}link.append(thumb)}else if(photo.caption&&photo.caption.length){link.attr('title',photo.caption)}item.append(link);if(photo.extra_data&&photo.extra_data.length){item.append($(photo.extra_data))}$(this).append(item)}}}}var foundImage=false;var foundThumb=false;if($(this).children('li').length){var selectedIndex=null;$(this).show().children('li').each(function(){foundImage=true;var a=$(this).find('a');if(a.length){a=$(a[0]);var src=a.attr('href');var img=a.find('img');var thumbSrc=img.length?img.attr('src'):a.attr('rel');var caption=img.length?img.attr('title'):a.attr('title');var isSelected=a.hasClass('selected')&&!selectedIndex;a.remove();var thumbData=$(this).html();if(thumbSrc){foundThumb=true}$(this).remove();var imageIndex=$$.newImage(src,thumbSrc,caption,thumbData);if(imageIndex>-1){if(isSelected){selectedIndex=imageIndex}if($$.loadQueue.length<$.exposure.preloadBuffer){$$.addToLoadQueue(imageIndex)}}}else{$(this).remove()}});if(!$.exposure.showThumbs){$.exposure.pageSize=1;$('.exposureThumbs').remove()}if(foundImage){$$.preloadNextInQueue();$$.createPaging();if(selectedIndex){$.exposure.goToPage($.exposure.pageNumberForImage(selectedIndex));$.exposure.viewImage(selectedIndex)}else{$.exposure.goToPage(1)}if($.exposure.enableSlideshow&&$.exposure.autostartSlideshow){$.exposure.playSlideshow()}}else{$.exposure.onEmpty()}}else{$.exposure.onEmpty()}$.exposure.onInit();$$.initialized=true})};$$.defined=function(v){return typeof v!=='undefined'};$$.object=function(v){return typeof v==='object'};$$.startsWith=function(s1,s2){if(s1&&s2){return s1.match("^"+s2)===s2}return false};$$.widthDiff=function(el){return el?el.outerWidth(true)-el.width():0};$$.heightDiff=function(el){return el?el.outerHeight(true)-el.height():0};$$.Image=function(src,thumb,caption,data){this.src=src;this.thumb=thumb;this.caption=caption;this.data=data;this.loaded=false};$$.images=[];$$.sources={};$$.newImage=function(src,thumb,caption,data){var alreadyAdded=$$.defined($$.sources[src]);if(alreadyAdded&&!$.exposure.allowDuplicates){return-1}var image=new $$.Image(src,thumb,caption,data);var imageIndex=$$.images.push(image)-1;if(!alreadyAdded){$$.sources[src]=imageIndex}return imageIndex};$$.initialized=false;$$.current=-1;$$.deselectCurrentImage=function(){$$.current=-1;$('.exposureThumbs li.active').removeClass('active')};$$.loadQueue=[];$$.addToLoadQueue=function(index){if(!$$.loaded(index)&&!$$.queued(index)){$$.loadQueue.push(index)}};$$.queued=function(index){return $.inArray(index,$$.loadQueue)>-1};$$.loaded=function(index){var image=$.exposure.getImage(index);if(image!==null){return image.loaded}return false};$$.nextInLoadQueue=function(){var i;if($$.loadQueue.length>0){var next=$$.loadQueue.shift();if($$.loaded(next)){i=$.inArray(index,$$.loadQueue);$$.loadQueue.splice(i,1);return $$.nextInLoadQueue()}return next}return null};$$.preloadNextInQueue=function(){if($$.loadQueue.length>0){var nextIndex=$$.nextInLoadQueue();if(nextIndex!==null){$$.loadImage(nextIndex,$$.preloadNextInQueue)}}};$$.loadPage=function(page,imageToView){if($$.validPage(page)){var last=page*$.exposure.pageSize;var first=last-$.exposure.pageSize;if(last>$$.images.length){last=$$.images.length}$$.pageTransition=true;$$.viewThumbs(first,last-1);if(!$.exposure.separatePageBrowsing){if(imageToView){$.exposure.viewImage(imageToView)}else{if(page>1||((page===1&&$.exposure.viewFirstImage)||$$.initialized)){$.exposure.viewImage(first)}}}$$.pageTransition=false}};$$.viewThumbs=function(first,last){var i;if($.exposure.showThumbs){for(i=first;i<=last;i++){$$.viewThumb(i,i===first,i===last,true)}if(!$.exposure.carouselControls&&$$.currentPage<$.exposure.numberOfPages()){var firstNext=last+1;var lastNext=last+$.exposure.pageSize;if(lastNext>=$$.images.length){lastNext=$$.images.length-1}for(i=firstNext;i<=lastNext;i++){var container=$$.viewThumb(i,i===firstNext,i===lastNext,false);if(container&&container.length){container.hide()}}}}};$$.viewThumb=function(index,first,last,currentPage){if(index<0){index=$$.images.length+index}else if(index>=$$.images.length){index=index-$$.images.length}var image=$$.images[index];var container=$.exposure.getThumb(index).parent();if(!container.length){container=$$.createThumbForImage(image,index);container.attr('rel',$.exposure.pageNumberForImage(index))}if(container.length){container.parent().append(container);if(first){container.addClass('first')}else{container.removeClass('first')}if(last){container.addClass('last')}else{container.removeClass('last')}if(currentPage){if($.exposure.carouselControls){container.show()}else{container.addClass('current')}}}return container};$$.loadImage=function(index,onload){var image=$.exposure.getImage(index);var img=$('').addClass('exposureImage');var i;if(image!==null){image.loaded=true;if($$.queued(index)){i=$.inArray(index,$$.loadQueue);$$.loadQueue.splice(i,1)}if(typeof onload==='function'){img.load(onload)}img.attr('src',image.src)}return img};$$.createThumbForImage=function(image,index){if($.exposure.showThumbs){var thumb=$.exposure.getThumb(index);if(thumb===null||!thumb.length){var container=$('
    • ');$('.exposureThumbs').append(container);thumb=$('');if(image.thumb){thumb.attr('src',image.thumb)}else{thumb.attr('src',image.src);var imageWidth=Math.ceil(thumb.width()/thumb.height()*container.height());var imageHeight=Math.ceil(thumb.height()/thumb.width()*container.width());if(imageWidth0){$(this).parent().height(imageHeight)}});$.exposure.onThumb(thumb);return container}}return null};$$.currentPage=1;$$.validPage=function(page){return page>0&&page<=$.exposure.numberOfPages()};$$.createPaging=function(){var i;if($.exposure.showControls&&$.exposure.controls.pageNumbers){var stop=$.exposure.imageControls?$.exposure.numberOfImages():$.exposure.numberOfPages();$('.exposurePaging').each(function(){for(i=1;i<=stop;i++){$(this).append($$.newPagingLink(i))}})}};$$.updatePaging=function(newActivePage){if($.exposure.showControls&&$.exposure.controls.pageNumbers){var current=$.exposure.imageControls?$$.current+1:$$.currentPage;$('.exposurePaging span.active').each(function(){$(this).replaceWith($$.newPagingLink(current))});$('.exposurePaging a[rel="'+newActivePage+'"]').each(function(){$(this).replaceWith($(''+newActivePage+'').addClass('active'))});var pageCount=$.exposure.imageControls?$.exposure.numberOfImages():$.exposure.numberOfPages();if($.exposure.visiblePages>0&&pageCount>$.exposure.visiblePages){var firstVisiblePage=newActivePage;var lastVisiblePage=$.exposure.visiblePages;var flooredVisiblePages=Math.floor($.exposure.visiblePages/2);if(newActivePage<=flooredVisiblePages){firstVisiblePage=1}else if(newActivePage>(pageCount-flooredVisiblePages)){lastVisiblePage=pageCount;firstVisiblePage=lastVisiblePage-$.exposure.visiblePages+1}else{firstVisiblePage-=flooredVisiblePages;lastVisiblePage=firstVisiblePage+$.exposure.visiblePages-1}$('.exposurePaging').each(function(){$(this).children().each(function(i){var currentPage=i+1;if(currentPage>=firstVisiblePage&¤tPage<=lastVisiblePage){$(this).show()}else{$(this).hide()}})})}}};$$.newPagingLink=function(index){return $.exposure.onPagingLink($(''+index+'').click(function(){var rel=Number($(this).attr('rel'));if($.exposure.imageControls){$.exposure.viewImage(rel-1)}else{$.exposure.goToPage(rel)}}))};$$.pageTransition=false;$$.playingSlideshow=false;$$.slideshowTimer=null;$$.slideshowTransition=false;$$.slideshow=function(){$$.slideshowTimer=setTimeout(function(){$$.slideshowTransition=true;$.exposure.nextImage();$$.slideshowTransition=false;$$.slideshow()},$.exposure.slideshowDelay)};$$.infullScreen=false;$$.actualMaxWidth=function(image,target){return $.exposure.maxWidth?$.exposure.maxWidth-($$.widthDiff(image)+$$.widthDiff(target)):0};$$.actualMaxHeight=function(image,target){return $.exposure.maxHeight?$.exposure.maxHeight-($$.heightDiff(image)+$$.heightDiff(target)):0};$$.fitToMaxSize=function(image){var target=$('.exposureTarget');if($.exposure.stretchToMaxSize){if($.exposure.maxWidth){image.width($$.actualMaxWidth(image,target))}if($.exposure.maxHeight){image.height($$.actualMaxHeight(image,target))}}else{if(image.width()>image.height()){$$.fitToMaxWidth(image,target);$$.fitToMaxHeight(image,target)}else if(image.height()>image.width()){$$.fitToMaxHeight(image,target);$$.fitToMaxWidth(image,target)}else{var actualMaxHeight=$$.actualMaxHeight(image,target);var smallest=$$.actualMaxWidth(image,target);if(!smallest||(actualMaxHeight&&smallest&&actualMaxHeightsmallest){image.width(smallest);image.height(smallest)}}}};$$.centerImageInWindow=function(image){var target=$('.exposureTarget');target.width(image.width()).height(image.height());target.css({'top':($(window).height()-target.outerHeight(true))/2,'left':($(window).width()-target.outerWidth(true))/2});$('.exposureLastImage').each(function(){$(this).css({'top':(target.height()-$(this).height())/2,'left':(target.width()-$(this).width())/2})})};$$.fitToMaxWidth=function(image,target){var actualMaxWidth=$$.actualMaxWidth(image,target);if(actualMaxWidth&&image.width()>actualMaxWidth){var newHeight=Math.round(actualMaxWidth*image.height()/image.width());image.height(newHeight);image.width(actualMaxWidth)}};$$.fitToMaxHeight=function(image,target){var actualMaxHeight=$$.actualMaxHeight(image,target);if(actualMaxHeight&&image.height()>actualMaxHeight){var newWidth=Math.round(actualMaxHeight*image.width()/image.height());image.width(newWidth);image.height(actualMaxHeight)}};$$.resizeContainer=function(img){$$.fitToMaxSize(img);if(!$.exposure.fixedContainerSize){$('.exposureTarget').show().width(img.width()).height(img.height())}};$.extend({exposure:{pageNumberForImage:function(index){return Math.ceil((index+1)/$.exposure.pageSize)},numberOfPages:function(){return $.exposure.pageNumberForImage($$.images.length-1)},atFirstPage:function(){return $$.currentPage===1},atLastPage:function(){return $$.currentPage===$.exposure.numberOfPages()},firstImageOnPage:function(index){if(!index){index=$$.current}return $.exposure.pageSize===1||(index%$.exposure.pageSize===0)},lastImageOnPage:function(index){if(!index){index=$$.current}var imageCount=$$.images.length;if($.exposure.pageSize===1||imageCount===1){return true}if(index>0){var currentPageSize=$.exposure.pageSize;var currentPage=$.exposure.pageNumberForImage(index);if(currentPage===$.exposure.numberOfPages()){var newPageSize=imageCount%$.exposure.pageSize;if(newPageSize>0){currentPageSize=newPageSize}}var imageIndex=index;if(currentPage>1){imageIndex-=(currentPage-1)*$.exposure.pageSize}return(imageIndex+1)%currentPageSize===0}return false},currentPage:function(){return $$.currentPage},numberOfImages:function(){return $$.images.length},atFirstImage:function(){return $$.current===0},atLastImage:function(){return $$.current===$.exposure.numberOfImages()-1},getImage:function(index){if(index!==null&&index>-1&&index<$$.images.length){return $$.images[index]}return null},indexOfImage:function(src){if(src&&$$.defined($$.sources[src])){return $$.sources[src]}return-1},currentImage:function(){return $$.current},addImage:function(src,thumb,caption,data){var pageCount=$.exposure.numberOfPages();var index=$$.newImage(src,thumb,caption,data);if(index>-1){var pageNumber=$.exposure.pageNumberForImage(index);var containers=$('.exposureThumbs li[rel="'+pageNumber+'"]');if(containers.length){containers.removeClass('last')}var newPageAdded=pageNumber>pageCount;if(newPageAdded){$('.exposurePaging').empty();$$.createPaging()}if(newPageAdded||pageNumber===$$.currentPage){$.exposure.goToPage($$.currentPage)}}},removeImage:function(index){if($$.images.length===1){$.exposure.removeAllImages()}else{if($.exposure.enableSlideshow){$.exposure.pauseSlideshow()}var oldPageCount=$.exposure.numberOfPages();$$.images.splice(index,1);var queueIndex=$.inArray(index,$$.loadQueue);if(queueIndex>-1){$$.loadQueue.splice(queueIndex,1)}var container=$.exposure.getThumb(index).parent();container.remove();$('.exposureThumbs > li').each(function(i){if(i>=index){var newRel=$.exposure.pageNumberForImage(i);$(this).attr('rel',newRel);$(this).find('img').attr('rel',i);if($.exposure.firstImageOnPage(i)){$(this).addClass('first')}else{$(this).removeClass('first')}if($.exposure.lastImageOnPage(i)){$(this).addClass('last')}else{$(this).removeClass('last')}if($$.currentPage===newRel){$(this).show()}else{$(this).hide()}}});var pageRemoved=$.exposure.numberOfPages$.exposure.pageSize){var firstVisibleImage=index;var lastVisibleImage=$.exposure.pageSize-1;var flooredVisibleImages=Math.floor($.exposure.pageSize/2);if(!$.exposure.loop&&index=($$.images.length-flooredVisibleImages)){lastVisibleImage=$$.images.length-1;firstVisibleImage=lastVisibleImage-$.exposure.pageSize}else{firstVisibleImage-=flooredVisibleImages;lastVisibleImage=firstVisibleImage+$.exposure.pageSize-1}$.exposure.onCarousel(firstVisibleImage,lastVisibleImage);$('.exposureThumbs li').removeClass('current').hide();$$.viewThumbs(firstVisibleImage,lastVisibleImage);$$.currentPage=$.exposure.pageNumberForImage(index)}}},firstImage:function(){if(!$.exposure.atFirstImage()){if($.exposure.separatePageBrowsing||$.exposure.atFirstPage()){$.exposure.viewImage(0)}else{$.exposure.goToPage(1)}}},nextImage:function(){if(!$.exposure.separatePageBrowsing&&$.exposure.lastImageOnPage()){if($.exposure.atLastPage()&&$.exposure.loop){$.exposure.goToPage(1)}else{$.exposure.goToPage($$.currentPage+1)}$.exposure.onNext()}else{var next=$.exposure.getNextImage();if(next!==null){$.exposure.viewImage(next);$.exposure.onNext()}}var nextNext=$.exposure.getNextImage();if(nextNext!==null){$$.addToLoadQueue(nextNext)}},prevImage:function(){if(!$.exposure.separatePageBrowsing&&$.exposure.firstImageOnPage()){if($.exposure.atFirstPage()&&$.exposure.loop){$.exposure.goToPage($.exposure.numberOfPages(),$.exposure.numberOfImages()-1)}else{var page=$$.currentPage-1;$.exposure.goToPage(page,page*$.exposure.pageSize-1)}$.exposure.onPrev()}else{var prev=$.exposure.getPrevImage();if(prev!==null){$.exposure.viewImage(prev);$.exposure.onPrev()}}var prevPrev=$.exposure.getPrevImage();if(prevPrev!==null){$$.addToLoadQueue(prevPrev)}},lastImage:function(){if(!$.exposure.atLastImage()){if($.exposure.separatePageBrowsing||$.exposure.atLastPage()){$.exposure.viewImage($.exposure.numberOfImages()-1)}else{$.exposure.goToPage($.exposure.numberOfPages(),$.exposure.numberOfImages()-1)}}},playSlideshow:function(){if(!$$.playingSlideshow){if($.exposure.slideshowControlsTarget){$('.exposurePlaySlideshow').hide();$('.exposurePauseSlideshow').show()}$$.slideshow();$$.playingSlideshow=true}$.exposure.onSlideshowPlayed()},pauseSlideshow:function(){if($$.playingSlideshow){if($.exposure.slideshowControlsTarget){$('.exposurePlaySlideshow').show();$('.exposurePauseSlideshow').hide()}$$.playingSlideshow=false;if($$.slideshowTimer){clearTimeout($$.slideshowTimer)}$.exposure.onSlideshowPaused()}},toggleSlideshow:function(){if($$.playingSlideshow){$.exposure.pauseSlideshow()}else{$.exposure.playSlideshow()}},first:function(){if($.exposure.imageControls){$.exposure.firstImage()}else{$.exposure.firstPage()}},prev:function(){if($.exposure.imageControls){$.exposure.prevImage()}else{$.exposure.prevPage()}},next:function(){if($.exposure.imageControls){$.exposure.nextImage()}else{$.exposure.nextPage()}},last:function(){if($.exposure.imageControls){$.exposure.lastImage()}else{$.exposure.lastPage()}},exitFullScreen:function(){if($$.infullScreen){$.exposure.pauseSlideshow();$$.deselectCurrentImage();$.exposure.onExitFullScreen($('.exposureTarget'),$('.exposureMask'));$$.infullScreen=false}},fitToWindow:function(){$.exposure.maxWidth=$(window).width();$.exposure.maxHeight=$(window).height();var image=$('.exposureCurrentImage').width('auto').height('auto');$$.fitToMaxSize(image);if(!image.width()||!image.height()){var delay=setInterval(function(){$$.centerImageInWindow(image);clearTimeout(delay)},2)}else{$$.centerImageInWindow(image)}},texts:{first:'First',previous:'Prev',next:'Next',last:'Last',play:'Play slideshow',pause:'Pause slideshow'}}})})(jQuery); /* * jQuery Hotkeys Plugin * Copyright 2024, John Resig * Dual licensed under the MIT or GPL Version 2 licenses. * * Based upon the plugin by Tzury Bar Yochay: * http://github.com/tzuryby/hotkeys * * Original idea by: * Binny V A, http://www.openjs.com/scripts/events/keyboard_shortcuts/ */ (function(jQuery){jQuery.hotkeys={version:"0.8",specialKeys:{8:"backspace",9:"tab",13:"return",16:"shift",17:"ctrl",18:"alt",19:"pause",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"insert",46:"del",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"*",107:"+",109:"-",110:".",111:"/",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12",144:"numlock",145:"scroll",191:"/",224:"meta"},shiftNums:{"`":"~","1":"!","2":"@","3":"#","4":"$","5":"%","6":"^","7":"&","8":"*","9":"(","0":")","-":"_","=":"+",";":": ","'":"\"",",":"<",".":">","/":"?","\\":"|"}};function keyHandler(handleObj){if(typeof handleObj.data!=="string"){return}var origHandler=handleObj.handler,keys=handleObj.data.toLowerCase().split(" ");handleObj.handler=function(event){if(this!==event.target&&(/textarea|select/i.test(event.target.nodeName)||event.target.type==="text")){return}var special=event.type!=="keypress"&&jQuery.hotkeys.specialKeys[event.which],character=String.fromCharCode(event.which).toLowerCase(),key,modif="",possible={};if(event.altKey&&special!=="alt"){modif+="alt+"}if(event.ctrlKey&&special!=="ctrl"){modif+="ctrl+"}if(event.metaKey&&!event.ctrlKey&&special!=="meta"){modif+="meta+"}if(event.shiftKey&&special!=="shift"){modif+="shift+"}if(special){possible[modif+special]=true}else{possible[modif+character]=true;possible[modif+jQuery.hotkeys.shiftNums[character]]=true;if(modif==="shift+"){possible[jQuery.hotkeys.shiftNums[character]]=true}}for(var i=0,l=keys.length;i