123456 |
- /*
- AnythingSlider v1.7.16 minified using Google Closure Compiler
- Original by Chris Coyier: http://css-tricks.com
- Get the latest version: https://github.com/ProLoser/AnythingSlider
- */
- (function(d){d.anythingSlider=function(h,i){var a=this,b;a.el=h;a.$el=d(h).addClass("anythingBase").wrap('<div class="anythingSlider"><div class="anythingWindow" /></div>');a.$el.data("AnythingSlider",a);a.init=function(){a.options=b=d.extend({},d.anythingSlider.defaults,i);a.initialized=false;d.isFunction(b.onBeforeInitialize)&&a.$el.bind("before_initialize",b.onBeforeInitialize);a.$el.trigger("before_initialize",a);a.$wrapper=a.$el.parent().closest("div.anythingSlider").addClass("anythingSlider-"+ b.theme);a.$window=a.$el.closest("div.anythingWindow");a.win=window;a.$win=d(a.win);a.$controls=d('<div class="anythingControls"></div>').appendTo(b.appendControlsTo!==null&&d(b.appendControlsTo).length?d(b.appendControlsTo):a.$wrapper);a.$startStop=d('<a href="#" class="start-stop"></a>');b.buildStartStop&&a.$startStop.appendTo(b.appendStartStopTo!==null&&d(b.appendStartStopTo).length?d(b.appendStartStopTo):a.$controls);a.$nav=d('<ul class="thumbNav" />').appendTo(b.appendNavigationTo!==null&&d(b.appendNavigationTo).length? d(b.appendNavigationTo):a.$controls);a.flag=false;a.playing=b.autoPlay;a.slideshow=false;a.hovered=false;a.panelSize=[];a.currentPage=b.startPanel=parseInt(b.startPanel,10)||1;b.changeBy=parseInt(b.changeBy,10)||1;a.adj=b.infiniteSlides?0:1;a.width=a.$el.width();a.height=a.$el.height();a.outerPad=[a.$wrapper.innerWidth()-a.$wrapper.width(),a.$wrapper.innerHeight()-a.$wrapper.height()];b.playRtl&&a.$wrapper.addClass("rtl");if(b.expand)a.$outer=a.$wrapper.parent(),a.$window.css({width:"100%",height:"100%"}), a.checkResize();b.buildStartStop&&a.buildAutoPlay();b.buildArrows&&a.buildNextBackButtons();if(!b.autoPlay)b.autoPlayLocked=false;a.updateSlider();a.$lastPage=a.$currentPage;a.runTimes=d("div.anythingSlider").index(a.$wrapper)+1;a.regex=RegExp("panel"+a.runTimes+"-(\\d+)","i");a.runTimes===1&&a.makeActive();if(!d.isFunction(d.easing[b.easing]))b.easing="swing";b.pauseOnHover&&a.$wrapper.hover(function(){a.playing&&(a.$el.trigger("slideshow_paused",a),a.clearTimer(true))},function(){a.playing&&(a.$el.trigger("slideshow_unpaused", a),a.startStop(a.playing,true))});a.setCurrentPage(a.gotoHash()||b.startPage,false);a.slideControls(false);a.$wrapper.bind("mouseenter mouseleave",function(b){a.hovered=b.type==="mouseenter"?true:false;a.slideControls(a.hovered,false)});d(document).keyup(function(c){if(b.enableKeyboard&&a.$wrapper.is(".activeSlider")&&!c.target.tagName.match("TEXTAREA|INPUT|SELECT")&&(b.vertical||!(c.which===38||c.which===40)))switch(c.which){case 39:case 40:a.goForward();break;case 37:case 38:a.goBack()}});a.$items.delegate("a", "focus.AnythingSlider",function(c){var e=d(this).closest(".panel"),e=a.$items.index(e)+a.adj;a.$items.find(".focusedLink").removeClass("focusedLink");d(this).addClass("focusedLink");a.$window.scrollLeft(0);if(e!==-1&&(e>=a.currentPage+b.showMultiple||e<a.currentPage))a.gotoPage(e),c.preventDefault()});var c="slideshow_paused slideshow_unpaused slide_init slide_begin slideshow_stop slideshow_start initialized swf_completed".split(" ");d.each("onShowPause onShowUnpause onSlideInit onSlideBegin onShowStop onShowStart onInitialized onSWFComplete".split(" "), function(f,e){d.isFunction(b[e])&&a.$el.bind(c[f],b[e])});d.isFunction(b.onSlideComplete)&&a.$el.bind("slide_complete",function(){setTimeout(function(){b.onSlideComplete(a)},0)});a.initialized=true;a.$el.trigger("initialized",a);a.startStop(a.playing)};a.updateSlider=function(){a.$el.children(".cloned").remove();a.$nav.empty();a.currentPage=a.currentPage||1;a.$items=a.$el.children();a.pages=a.$items.length;a.dir=b.vertical?"top":"left";b.showMultiple=b.vertical?1:parseInt(b.showMultiple,10)||1;b.navigationSize= b.navigationSize===false?0:parseInt(b.navigationSize,10)||0;if(b.showMultiple>1){if(b.showMultiple>a.pages)b.showMultiple=a.pages;a.adjustMultiple=b.infiniteSlides&&a.pages>1?0:b.showMultiple-1;a.pages=a.$items.length-a.adjustMultiple}a.$controls.add(a.$nav).add(a.$startStop).add(a.$forward).add(a.$back)[a.pages<=1?"hide":"show"]();a.pages>1&&a.buildNavigation();b.infiniteSlides&&a.pages>1&&(a.$el.prepend(a.$items.filter(":last").clone().removeAttr("id").addClass("cloned")),b.showMultiple>1?a.$el.append(a.$items.filter(":lt("+ b.showMultiple+")").clone().removeAttr("id").addClass("cloned").addClass("multiple")):a.$el.append(a.$items.filter(":first").clone().removeAttr("id").addClass("cloned")),a.$el.find(".cloned").each(function(){d(this).find("a,input,textarea,select,button,area").attr("disabled","disabled");d(this).find("[id]").removeAttr("id")}));a.$items=a.$el.children().addClass("panel"+(b.vertical?" vertical":""));a.setDimensions();b.resizeContents?(a.$items.css("width",a.width),a.$wrapper.css("width",a.getDim(a.currentPage)[0]), a.$wrapper.add(a.$items).css("height",a.height)):a.$win.load(function(){a.setDimensions()});if(a.currentPage>a.pages)a.currentPage=a.pages;a.setCurrentPage(a.currentPage,false);a.$nav.find("a").eq(a.currentPage-1).addClass("cur")};a.buildNavigation=function(){if(b.buildNavigation&&a.pages>1){var c,f;a.$items.filter(":not(.cloned)").each(function(e){var g=e+1;c=(g===1?"first":"")+(g===a.pages?"last":"");f=d('<a href="#"></a>').addClass("panel"+g).wrap('<li class="'+c+'" />');a.$nav.append(f.parent()); d.isFunction(b.navigationFormatter)?(c=b.navigationFormatter(g,d(this)),f.html("<span>"+c+"</span>"),parseInt(f.find("span").css("text-indent"),10)<0&&f.addClass(b.tooltipClass).attr("title",c)):f.html("<span>"+g+"</span>");f.bind(b.clickControls,function(c){if(!a.flag&&b.enableNavigation)a.flag=true,setTimeout(function(){a.flag=false},100),a.gotoPage(g),b.hashTags&&a.setHash(g);c.preventDefault()})});if(b.navigationSize&&b.navigationSize<a.pages)a.$controls.find(".anythingNavWindow").length||a.$nav.before('<ul><li class="prev"><a href="#"><span>'+ b.backText+"</span></a></li></ul>").after('<ul><li class="next"><a href="#"><span>'+b.forwardText+"</span></a></li></ul>").wrap('<div class="anythingNavWindow"></div>'),a.navWidths=a.$nav.find("li").map(function(){return d(this).innerWidth()+Math.ceil(parseInt(d(this).find("span").css("left"),10)/2||0)}).get(),a.navLeft=1,a.$nav.width(a.navWidth(1,a.pages+1)+5),a.$controls.find(".anythingNavWindow").width(a.navWidth(1,b.navigationSize+1)).end().find(".prev,.next").bind(b.clickControls,function(c){if(!a.flag)a.flag= true,setTimeout(function(){a.flag=false},200),a.navWindow(a.navLeft+b.navigationSize*(d(this).is(".prev")?-1:1));c.preventDefault()})}};a.navWidth=function(b,f){var d;d=Math.min(b,f);for(var g=Math.max(b,f),j=0;d<g;d++)j+=a.navWidths[d-1]||0;return j};a.navWindow=function(c){if(b.navigationSize&&b.navigationSize<a.pages&&a.navWidths){var d=a.pages-b.navigationSize+1,c=c<=1?1:c>1&&c<d?c:d;if(c!==a.navLeft)a.$controls.find(".anythingNavWindow").animate({scrollLeft:a.navWidth(1,c),width:a.navWidth(c, c+b.navigationSize)},{queue:false,duration:b.animationTime}),a.navLeft=c}};a.buildNextBackButtons=function(){a.$forward=d('<span class="arrow forward"><a href="#"><span>'+b.forwardText+"</span></a></span>");a.$back=d('<span class="arrow back"><a href="#"><span>'+b.backText+"</span></a></span>");a.$back.bind(b.clickBackArrow,function(c){if(b.enableArrows&&!a.flag)a.flag=true,setTimeout(function(){a.flag=false},100),a.goBack();c.preventDefault()});a.$forward.bind(b.clickForwardArrow,function(c){if(b.enableArrows&& !a.flag)a.flag=true,setTimeout(function(){a.flag=false},100),a.goForward();c.preventDefault()});a.$back.add(a.$forward).find("a").bind("focusin focusout",function(){d(this).toggleClass("hover")});a.$back.appendTo(b.appendBackTo!==null&&d(b.appendBackTo).length?d(b.appendBackTo):a.$wrapper);a.$forward.appendTo(b.appendForwardTo!==null&&d(b.appendForwardTo).length?d(b.appendForwardTo):a.$wrapper);a.$arrowWidth=a.$forward.width()};a.buildAutoPlay=function(){a.$startStop.html("<span>"+(a.playing?b.stopText: b.startText)+"</span>").bind(b.clickSlideshow,function(c){b.enableStartStop&&(a.startStop(!a.playing),a.makeActive(),a.playing&&!b.autoPlayDelayed&&a.goForward(true));c.preventDefault()}).bind("focusin focusout",function(){d(this).toggleClass("hover")})};a.checkResize=function(c){clearTimeout(a.resizeTimer);a.resizeTimer=setTimeout(function(){var d=a.$outer.width()-a.outerPad[0],e=(a.$outer[0].tagName==="BODY"?a.$win.height():a.$outer.height())-a.outerPad[1];if(a.width*b.showMultiple!==d||a.height!== e)a.setDimensions(),a.gotoPage(a.currentPage,a.playing,null,-1);typeof c==="undefined"&&a.checkResize()},500)};a.setDimensions=function(){var c,f,e,g=0,j={width:"100%",height:"100%"},h=b.showMultiple>1?a.width||a.$window.width()/b.showMultiple:a.$window.width(),i=a.$win.width();if(b.expand)c=a.$outer.width()-a.outerPad[0],a.height=f=a.$outer.height()-a.outerPad[1],a.$wrapper.add(a.$window).add(a.$items).css({width:c,height:f}),a.width=h=b.showMultiple>1?c/b.showMultiple:c;a.$items.each(function(k){e= d(this).children();if(b.resizeContents)c=a.width,f=a.height,d(this).css({width:c,height:f}),e.length&&(e[0].tagName==="EMBED"&&e.attr(j),e[0].tagName==="OBJECT"&&e.find("embed").attr(j),e.length===1&&e.css(j));else{c=d(this).width()||a.width;e.length===1&&c>=i&&(c=e.width()>=i?h:e.width(),e.css("max-width",c));d(this).css("width",c);f=e.length===1?e.outerHeight(true):d(this).height();if(f<=a.outerPad[1])f=a.height;d(this).css("height",f)}a.panelSize[k]=[c,f,g];g+=b.vertical?f:c});a.$el.css(b.vertical? "height":"width",g)};a.getDim=function(c){if(a.pages<1||isNaN(c))return[a.width,a.height];var c=b.infiniteSlides&&a.pages>1?c:c-1,d,e=a.panelSize[c][0],g=a.panelSize[c][1];if(b.showMultiple>1)for(d=1;d<b.showMultiple;d++)e+=a.panelSize[(c+d)%b.showMultiple][0],g=Math.max(g,a.panelSize[c+d][1]);return[e,g]};a.goForward=function(c){a.gotoPage(a.currentPage+b.changeBy*(b.playRtl?-1:1),c)};a.goBack=function(c){a.gotoPage(a.currentPage+b.changeBy*(b.playRtl?1:-1),c)};a.gotoPage=function(c,f,e,g){f!==true&& (f=false,a.startStop(false),a.makeActive());/^[#|.]/.test(c)&&d(c).length&&(c=d(c).closest(".panel").index()+a.adj);b.changeBy!==1&&(c<0&&(c+=a.pages),c>a.pages&&(c-=a.pages));if(!(a.pages<=1)){a.$lastPage=a.$currentPage;if(typeof c!=="number")c=b.startPanel,a.setCurrentPage(c);if(!f||!b.isVideoPlaying(a))c>a.pages+1-a.adj&&(c=!b.infiniteSlides&&!b.stopAtEnd?1:a.pages),c<a.adj&&(c=!b.infiniteSlides&&!b.stopAtEnd?a.pages:1),a.currentPage=c>a.pages?a.pages:c<1?1:a.currentPage,a.$currentPage=a.$items.eq(a.currentPage- a.adj),a.exactPage=c,a.targetPage=c===0?a.pages-a.adj:c>a.pages?1-a.adj:c-a.adj,a.$targetPage=a.$items.eq(a.targetPage),g=g||b.animationTime,g>=0&&a.$el.trigger("slide_init",a),a.slideControls(true,false),f!==true&&(f=false),(!f||b.stopAtEnd&&c===a.pages)&&a.startStop(false),g>=0&&a.$el.trigger("slide_begin",a),setTimeout(function(d){b.resizeContents||(d=a.getDim(c),a.$wrapper.filter(":not(:animated)").animate({width:d[0]||a.width,height:d[1]||a.height},{queue:false,duration:g<0?0:g,easing:b.easing})); d={};d[a.dir]=-a.panelSize[b.infiniteSlides&&a.pages>1?c:c-1][2];a.$el.filter(":not(:animated)").animate(d,{queue:false,duration:g,easing:b.easing,complete:function(){a.endAnimation(c,e,g)}})},parseInt(b.delayBeforeAnimate,10)||0)}};a.endAnimation=function(c,d,e){c===0?(a.$el.css(a.dir,-a.panelSize[a.pages][2]),c=a.pages):c>a.pages&&(a.$el.css(a.dir,-a.panelSize[1][2]),c=1);a.exactPage=c;a.setCurrentPage(c,false);a.$items.removeClass("activePage").eq(c-a.adj).addClass("activePage");a.hovered||a.slideControls(false); e>=0&&a.$el.trigger("slide_complete",a);typeof d==="function"&&d(a);b.autoPlayLocked&&!a.playing&&setTimeout(function(){a.startStop(true)},b.resumeDelay-(b.autoPlayDelayed?b.delay:0))};a.setCurrentPage=function(c,d){c=parseInt(c,10);if(!(a.pages<1||c===0||isNaN(c))){c>a.pages+1-a.adj&&(c=a.pages-a.adj);c<a.adj&&(c=1);b.buildNavigation&&a.$nav.find(".cur").removeClass("cur").end().find("a").eq(c-1).addClass("cur");!b.infiniteSlides&&b.stopAtEnd&&(a.$wrapper.find("span.forward")[c===a.pages?"addClass": "removeClass"]("disabled").end().find("span.back")[c===1?"addClass":"removeClass"]("disabled"),c===a.pages&&a.playing&&a.startStop());if(!d){var e=a.getDim(c);a.$wrapper.css({width:e[0],height:e[1]}).add(a.$window).scrollLeft(0);a.$el.css(a.dir,-a.panelSize[b.infiniteSlides&&a.pages>1?c:c-1][2])}a.currentPage=c;a.$currentPage=a.$items.removeClass("activePage").eq(c-a.adj).addClass("activePage")}};a.makeActive=function(){a.$wrapper.is(".activeSlider")||(d(".activeSlider").removeClass("activeSlider"), a.$wrapper.addClass("activeSlider"))};a.gotoHash=function(){var c=a.win.location.hash,f=c.indexOf("&"),e=c.match(a.regex);e===null&&!/^#&/.test(c)?(c=c.substring(0,f>=0?f:c.length),e=d(c).closest(".anythingBase")[0]===a.el?d(c).closest(".panel").index():null):e!==null&&(e=b.hashTags?parseInt(e[1],10):null);return e};a.setHash=function(b){var d="panel"+a.runTimes+"-",e=a.win.location.hash;if(typeof e!=="undefined")a.win.location.hash=e.indexOf(d)>0?e.replace(a.regex,d+b):e+"&"+d+b};a.slideControls= function(c){var d=c?0:b.animationTime,e=c?b.animationTime:0,g=c?1:0,h=c?0:1;b.toggleControls&&a.$controls.stop(true,true).delay(d)[c?"slideDown":"slideUp"](b.animationTime/2).delay(e);b.buildArrows&&b.toggleArrows&&(!a.hovered&&a.playing&&(h=1,g=0),a.$forward.stop(true,true).delay(d).animate({right:h*a.$arrowWidth,opacity:g},b.animationTime/2),a.$back.stop(true,true).delay(d).animate({left:h*a.$arrowWidth,opacity:g},b.animationTime/2))};a.clearTimer=function(b){if(a.timer&&(a.win.clearInterval(a.timer), !b&&a.slideshow))a.$el.trigger("slideshow_stop",a),a.slideshow=false};a.startStop=function(c,d){c!==true&&(c=false);if((a.playing=c)&&!d)a.$el.trigger("slideshow_start",a),a.slideshow=true;b.buildStartStop&&(a.$startStop.toggleClass("playing",c).find("span").html(c?b.stopText:b.startText),parseInt(a.$startStop.find("span").css("text-indent"),10)<0&&a.$startStop.addClass(b.tooltipClass).attr("title",c?b.stopText:b.startText));c?(a.clearTimer(true),a.timer=a.win.setInterval(function(){b.isVideoPlaying(a)? b.resumeOnVideoEnd||a.startStop():a.goForward(true)},b.delay)):a.clearTimer()};a.init()};d.anythingSlider.defaults={theme:"default",expand:false,resizeContents:true,vertical:false,showMultiple:false,easing:"swing",buildArrows:true,buildNavigation:true,buildStartStop:true,appendForwardTo:null,appendBackTo:null,appendControlsTo:null,appendNavigationTo:null,appendStartStopTo:null,toggleArrows:false,toggleControls:false,startText:"Start",stopText:"Stop",forwardText:"»",backText:"«",tooltipClass:"tooltip", enableArrows:true,enableNavigation:true,enableStartStop:true,enableKeyboard:true,startPanel:1,changeBy:1,hashTags:true,infiniteSlides:true,navigationFormatter:null,navigationSize:false,autoPlay:false,autoPlayLocked:false,autoPlayDelayed:false,pauseOnHover:true,stopAtEnd:false,playRtl:false,delay:3E3,resumeDelay:15E3,animationTime:600,delayBeforeAnimate:0,clickForwardArrow:"click",clickBackArrow:"click",clickControls:"click focusin",clickSlideshow:"click",resumeOnVideoEnd:true,resumeOnVisible:true, addWmodeToObject:"opaque",isVideoPlaying:function(){return false}};d.fn.anythingSlider=function(h,i){return this.each(function(){var a,b=d(this).data("AnythingSlider");(typeof h).match("object|undefined")?b?b.updateSlider():new d.anythingSlider(this,h):/\d/.test(h)&&!isNaN(h)&&b?(a=typeof h==="number"?h:parseInt(d.trim(h),10),a>=1&&a<=b.pages&&b.gotoPage(a,false,i)):/^[#|.]/.test(h)&&d(h).length&&b.gotoPage(h,false,i)})}})(jQuery);
|