Team:Heidelberg/js/slick
From 2014.igem.org
(Difference between revisions)
(Created page with "!function(a){"use strict";"function"==typeof define&&define.amd?define(["jquery"],a):"undefined"!=typeof exports?module.exports=a(require("jquery")):a(jQuery)}(function(a){"use s...") |
|||
Line 1: | Line 1: | ||
- | + | (function(e){"use strict";if(typeof define==="function"&&define.amd){define(["jquery"],e)}else if(typeof exports!=="undefined"){module.exports=e(require("jquery"))}else{e(jQuery)}})(function(e){"use strict";var t=window.Slick||{};t=function(){function n(n,r){var i=this,s,o;i.defaults={accessibility:true,adaptiveHeight:false,appendArrows:e(n),appendDots:e(n),arrows:true,asNavFor:null,prevArrow:'<button type="button" data-role="none" class="slick-prev">Previous</button>',nextArrow:'<button type="button" data-role="none" class="slick-next">Next</button>',autoplay:false,autoplaySpeed:3e3,centerMode:false,centerPadding:"50px",cssEase:"ease",customPaging:function(e,t){return'<button type="button" data-role="none">'+(t+1)+"</button>"},dots:false,dotsClass:"slick-dots",draggable:true,easing:"linear",fade:false,focusOnSelect:false,infinite:true,lazyLoad:"ondemand",onBeforeChange:null,onAfterChange:null,onInit:null,onReInit:null,pauseOnHover:true,pauseOnDotsHover:false,responsive:null,rtl:false,slide:"div",slidesToShow:1,slidesToScroll:1,speed:300,swipe:true,touchMove:true,touchThreshold:5,useCSS:true,vertical:false,waitForAnimate:true};i.initials={animating:false,dragging:false,autoPlayTimer:null,currentSlide:0,currentLeft:null,direction:1,$dots:null,listWidth:null,listHeight:null,loadIndex:0,$nextArrow:null,$prevArrow:null,slideCount:null,slideWidth:null,$slideTrack:null,$slides:null,sliding:false,slideOffset:0,swipeLeft:null,$list:null,touchObject:{},transformsEnabled:false};e.extend(i,i.initials);i.activeBreakpoint=null;i.animType=null;i.animProp=null;i.breakpoints=[];i.breakpointSettings=[];i.cssTransitions=false;i.paused=false;i.positionProp=null;i.$slider=e(n);i.$slidesCache=null;i.transformType=null;i.transitionType=null;i.windowWidth=0;i.windowTimer=null;i.options=e.extend({},i.defaults,r);i.originalSettings=i.options;s=i.options.responsive||null;if(s&&s.length>-1){for(o in s){if(s.hasOwnProperty(o)){i.breakpoints.push(s[o].breakpoint);i.breakpointSettings[s[o].breakpoint]=s[o].settings}}i.breakpoints.sort(function(e,t){return t-e})}i.autoPlay=e.proxy(i.autoPlay,i);i.autoPlayClear=e.proxy(i.autoPlayClear,i);i.changeSlide=e.proxy(i.changeSlide,i);i.selectHandler=e.proxy(i.selectHandler,i);i.setPosition=e.proxy(i.setPosition,i);i.swipeHandler=e.proxy(i.swipeHandler,i);i.dragHandler=e.proxy(i.dragHandler,i);i.keyHandler=e.proxy(i.keyHandler,i);i.autoPlayIterator=e.proxy(i.autoPlayIterator,i);i.instanceUid=t++;i.htmlExpr=/^(?:\s*(<[\w\W]+>)[^>]*)$/;i.init()}var t=0;return n}();t.prototype.addSlide=function(t,n,r){var i=this;if(typeof n==="boolean"){r=n;n=null}else if(n<0||n>=i.slideCount){return false}i.unload();if(typeof n==="number"){if(n===0&&i.$slides.length===0){e(t).appendTo(i.$slideTrack)}else if(r){e(t).insertBefore(i.$slides.eq(n))}else{e(t).insertAfter(i.$slides.eq(n))}}else{if(r===true){e(t).prependTo(i.$slideTrack)}else{e(t).appendTo(i.$slideTrack)}}i.$slides=i.$slideTrack.children(this.options.slide);i.$slideTrack.children(this.options.slide).detach();i.$slideTrack.append(i.$slides);i.$slides.each(function(t,n){e(n).attr("index",t)});i.$slidesCache=i.$slides;i.reinit()};t.prototype.animateSlide=function(t,n){var r={},i=this;if(i.options.slidesToShow===1&&i.options.adaptiveHeight===true&&i.options.vertical===false){var s=i.$slides.eq(i.currentSlide).outerHeight(true);i.$list.animate({height:s},i.options.speed)}if(i.options.rtl===true&&i.options.vertical===false){t=-t}if(i.transformsEnabled===false){if(i.options.vertical===false){i.$slideTrack.animate({left:t},i.options.speed,i.options.easing,n)}else{i.$slideTrack.animate({top:t},i.options.speed,i.options.easing,n)}}else{if(i.cssTransitions===false){e({animStart:i.currentLeft}).animate({animStart:t},{duration:i.options.speed,easing:i.options.easing,step:function(e){if(i.options.vertical===false){r[i.animType]="translate("+e+"px, 0px)";i.$slideTrack.css(r)}else{r[i.animType]="translate(0px,"+e+"px)";i.$slideTrack.css(r)}},complete:function(){if(n){n.call()}}})}else{i.applyTransition();if(i.options.vertical===false){r[i.animType]="translate3d("+t+"px, 0px, 0px)"}else{r[i.animType]="translate3d(0px,"+t+"px, 0px)"}i.$slideTrack.css(r);if(n){setTimeout(function(){i.disableTransition();n.call()},i.options.speed)}}}};t.prototype.applyTransition=function(e){var t=this,n={};if(t.options.fade===false){n[t.transitionType]=t.transformType+" "+t.options.speed+"ms "+t.options.cssEase}else{n[t.transitionType]="opacity "+t.options.speed+"ms "+t.options.cssEase}if(t.options.fade===false){t.$slideTrack.css(n)}else{t.$slides.eq(e).css(n)}};t.prototype.autoPlay=function(){var e=this;if(e.autoPlayTimer){clearInterval(e.autoPlayTimer)}if(e.slideCount>e.options.slidesToShow&&e.paused!==true){e.autoPlayTimer=setInterval(e.autoPlayIterator,e.options.autoplaySpeed)}};t.prototype.autoPlayClear=function(){var e=this;if(e.autoPlayTimer){clearInterval(e.autoPlayTimer)}};t.prototype.autoPlayIterator=function(){var t=this;var n=t.options.asNavFor!=null?e(t.options.asNavFor).getSlick():null;if(t.options.infinite===false){if(t.direction===1){if(t.currentSlide+1===t.slideCount-1){t.direction=0}t.slideHandler(t.currentSlide+t.options.slidesToScroll);if(n!=null)n.slideHandler(n.currentSlide+n.options.slidesToScroll)}else{if(t.currentSlide-1===0){t.direction=1}t.slideHandler(t.currentSlide-t.options.slidesToScroll);if(n!=null)n.slideHandler(n.currentSlide-n.options.slidesToScroll)}}else{t.slideHandler(t.currentSlide+t.options.slidesToScroll);if(n!=null)n.slideHandler(n.currentSlide+n.options.slidesToScroll)}};t.prototype.buildArrows=function(){var t=this;if(t.options.arrows===true&&t.slideCount>t.options.slidesToShow){t.$prevArrow=e(t.options.prevArrow);t.$nextArrow=e(t.options.nextArrow);if(t.htmlExpr.test(t.options.prevArrow)){t.$prevArrow.appendTo(t.options.appendArrows)}if(t.htmlExpr.test(t.options.nextArrow)){t.$nextArrow.appendTo(t.options.appendArrows)}if(t.options.infinite!==true){t.$prevArrow.addClass("slick-disabled")}}};t.prototype.buildDots=function(){var t=this,n,r;if(t.options.dots===true&&t.slideCount>t.options.slidesToShow){r='<ul class="'+t.options.dotsClass+'">';for(n=0;n<=t.getDotCount();n+=1){r+="<li>"+t.options.customPaging.call(this,t,n)+"</li>"}r+="</ul>";t.$dots=e(r).appendTo(t.options.appendDots);t.$dots.find("li").first().addClass("slick-active")}};t.prototype.buildOut=function(){var t=this;t.$slides=t.$slider.children(t.options.slide+":not(.slick-cloned)").addClass("slick-slide");t.slideCount=t.$slides.length;t.$slides.each(function(t,n){e(n).attr("index",t)});t.$slidesCache=t.$slides;t.$slider.addClass("slick-slider");t.$slideTrack=t.slideCount===0?e('<div class="slick-track"/>').appendTo(t.$slider):t.$slides.wrapAll('<div class="slick-track"/>').parent();t.$list=t.$slideTrack.wrap('<div class="slick-list"/>').parent();t.$slideTrack.css("opacity",0);if(t.options.centerMode===true){t.options.slidesToScroll=1;if(t.options.slidesToShow%2===0){t.options.slidesToShow=3}}e("img[data-lazy]",t.$slider).not("[src]").addClass("slick-loading");t.setupInfinite();t.buildArrows();t.buildDots();t.updateDots();if(t.options.accessibility===true){t.$list.prop("tabIndex",0)}t.setSlideClasses(typeof this.currentSlide==="number"?this.currentSlide:0);if(t.options.draggable===true){t.$list.addClass("draggable")}};t.prototype.checkResponsive=function(){var t=this,n,r;if(t.originalSettings.responsive&&t.originalSettings.responsive.length>-1&&t.originalSettings.responsive!==null){r=null;for(n in t.breakpoints){if(t.breakpoints.hasOwnProperty(n)){if(e(window).width()<t.breakpoints[n]){r=t.breakpoints[n]}}}if(r!==null){if(t.activeBreakpoint!==null){if(r!==t.activeBreakpoint){t.activeBreakpoint=r;t.options=e.extend({},t.options,t.breakpointSettings[r]);t.refresh()}}else{t.activeBreakpoint=r;t.options=e.extend({},t.options,t.breakpointSettings[r]);t.refresh()}}else{if(t.activeBreakpoint!==null){t.activeBreakpoint=null;t.options=e.extend({},t.options,t.originalSettings);t.refresh()}}}};t.prototype.changeSlide=function(t){var n=this,r=e(t.target);var i=n.options.asNavFor!=null?e(n.options.asNavFor).getSlick():null;r.is("a")&&t.preventDefault();switch(t.data.message){case"previous":if(n.slideCount>n.options.slidesToShow){n.slideHandler(n.currentSlide-n.options.slidesToScroll);if(i!=null)i.slideHandler(i.currentSlide-i.options.slidesToScroll)}break;case"next":if(n.slideCount>n.options.slidesToShow){n.slideHandler(n.currentSlide+n.options.slidesToScroll);if(i!=null)i.slideHandler(i.currentSlide+i.options.slidesToScroll)}break;case"index":var s=t.data.index===0?0:t.data.index||e(t.target).parent().index()*n.options.slidesToScroll;n.slideHandler(s);if(i!=null)i.slideHandler(s);default:return false}};t.prototype.destroy=function(){var t=this;t.autoPlayClear();t.touchObject={};e(".slick-cloned",t.$slider).remove();if(t.$dots){t.$dots.remove()}if(t.$prevArrow){t.$prevArrow.remove();t.$nextArrow.remove()}if(t.$slides.parent().hasClass("slick-track")){t.$slides.unwrap().unwrap()}t.$slides.removeClass("slick-slide slick-active slick-visible").css("width","");t.$slider.removeClass("slick-slider");t.$slider.removeClass("slick-initialized");t.$list.off(".slick");e(window).off(".slick-"+t.instanceUid);e(document).off(".slick-"+t.instanceUid)};t.prototype.disableTransition=function(e){var t=this,n={};n[t.transitionType]="";if(t.options.fade===false){t.$slideTrack.css(n)}else{t.$slides.eq(e).css(n)}};t.prototype.fadeSlide=function(e,t){var n=this;if(n.cssTransitions===false){n.$slides.eq(e).css({zIndex:1e3});n.$slides.eq(e).animate({opacity:1},n.options.speed,n.options.easing,t)}else{n.applyTransition(e);n.$slides.eq(e).css({opacity:1,zIndex:1e3});if(t){setTimeout(function(){n.disableTransition(e);t.call()},n.options.speed)}}};t.prototype.filterSlides=function(e){var t=this;if(e!==null){t.unload();t.$slideTrack.children(this.options.slide).detach();t.$slidesCache.filter(e).appendTo(t.$slideTrack);t.reinit()}};t.prototype.getCurrent=function(){var e=this;return e.currentSlide};t.prototype.getDotCount=function(){var e=this,t=0,n=0,r=0,i;i=e.options.infinite===true?e.slideCount+e.options.slidesToShow-e.options.slidesToScroll:e.slideCount;while(t<i){r++;n+=e.options.slidesToScroll;t=n+e.options.slidesToShow}return r};t.prototype.getLeft=function(e){var t=this,n,r,i=0;t.slideOffset=0;r=t.$slides.first().outerHeight();if(t.options.infinite===true){if(t.slideCount>t.options.slidesToShow){t.slideOffset=t.slideWidth*t.options.slidesToShow*-1;i=r*t.options.slidesToShow*-1}if(t.slideCount%t.options.slidesToScroll!==0){if(e+t.options.slidesToScroll>t.slideCount&&t.slideCount>t.options.slidesToShow){t.slideOffset=t.slideCount%t.options.slidesToShow*t.slideWidth*-1;i=t.slideCount%t.options.slidesToShow*r*-1}}}else{if(t.slideCount%t.options.slidesToShow!==0){if(e+t.options.slidesToScroll>t.slideCount&&t.slideCount>t.options.slidesToShow){t.slideOffset=t.options.slidesToShow*t.slideWidth-t.slideCount%t.options.slidesToShow*t.slideWidth;i=t.slideCount%t.options.slidesToShow*r}}}if(t.options.centerMode===true&&t.options.infinite===true){t.slideOffset+=t.slideWidth*Math.floor(t.options.slidesToShow/2)-t.slideWidth}else if(t.options.centerMode===true){t.slideOffset+=t.slideWidth*Math.floor(t.options.slidesToShow/2)}if(t.options.vertical===false){n=e*t.slideWidth*-1+t.slideOffset}else{n=e*r*-1+i}return n};t.prototype.init=function(){var t=this;if(!e(t.$slider).hasClass("slick-initialized")){e(t.$slider).addClass("slick-initialized");t.buildOut();t.setProps();t.startLoad();t.loadSlider();t.initializeEvents();t.checkResponsive()}if(t.options.onInit!==null){t.options.onInit.call(this,t)}};t.prototype.initArrowEvents=function(){var e=this;if(e.options.arrows===true&&e.slideCount>e.options.slidesToShow){e.$prevArrow.on("click.slick",{message:"previous"},e.changeSlide);e.$nextArrow.on("click.slick",{message:"next"},e.changeSlide)}};t.prototype.initDotEvents=function(){var t=this;if(t.options.dots===true&&t.slideCount>t.options.slidesToShow){e("li",t.$dots).on("click.slick",{message:"index"},t.changeSlide)}if(t.options.dots===true&&t.options.pauseOnDotsHover===true&&t.options.autoplay===true){e("li",t.$dots).on("mouseenter.slick",t.autoPlayClear).on("mouseleave.slick",t.autoPlay)}};t.prototype.initializeEvents=function(){var t=this;t.initArrowEvents();t.initDotEvents();t.$list.on("touchstart.slick mousedown.slick",{action:"start"},t.swipeHandler);t.$list.on("touchmove.slick mousemove.slick",{action:"move"},t.swipeHandler);t.$list.on("touchend.slick mouseup.slick",{action:"end"},t.swipeHandler);t.$list.on("touchcancel.slick mouseleave.slick",{action:"end"},t.swipeHandler);if(t.options.pauseOnHover===true&&t.options.autoplay===true){t.$list.on("mouseenter.slick",t.autoPlayClear);t.$list.on("mouseleave.slick",t.autoPlay)}if(t.options.accessibility===true){t.$list.on("keydown.slick",t.keyHandler)}if(t.options.focusOnSelect===true){e(t.options.slide,t.$slideTrack).on("click.slick",t.selectHandler)}e(window).on("orientationchange.slick.slick-"+t.instanceUid,function(){t.checkResponsive();t.setPosition()});e(window).on("resize.slick.slick-"+t.instanceUid,function(){if(e(window).width()!==t.windowWidth){clearTimeout(t.windowDelay);t.windowDelay=window.setTimeout(function(){t.windowWidth=e(window).width();t.checkResponsive();t.setPosition()},50)}});e(window).on("load.slick.slick-"+t.instanceUid,t.setPosition);e(document).on("ready.slick.slick-"+t.instanceUid,t.setPosition)};t.prototype.initUI=function(){var e=this;if(e.options.arrows===true&&e.slideCount>e.options.slidesToShow){e.$prevArrow.show();e.$nextArrow.show()}if(e.options.dots===true&&e.slideCount>e.options.slidesToShow){e.$dots.show()}if(e.options.autoplay===true){e.autoPlay()}};t.prototype.keyHandler=function(e){var t=this;if(e.keyCode===37){t.changeSlide({data:{message:"previous"}})}else if(e.keyCode===39){t.changeSlide({data:{message:"next"}})}};t.prototype.lazyLoad=function(){function o(t){e("img[data-lazy]",t).each(function(){var t=e(this),n=e(this).attr("data-lazy")+"?"+(new Date).getTime();t.load(function(){t.animate({opacity:1},200)}).css({opacity:0}).attr("src",n).removeAttr("data-lazy").removeClass("slick-loading")})}var t=this,n,r,i,s;if(t.options.centerMode===true){if(t.options.infinite===true){i=t.currentSlide+(t.options.slidesToShow/2+1);s=i+t.options.slidesToShow+2}else{i=Math.max(0,t.currentSlide-(t.options.slidesToShow/2+1));s=2+(t.options.slidesToShow/2+1)+t.currentSlide}}else{i=t.options.infinite?t.options.slidesToShow+t.currentSlide:t.currentSlide;s=i+t.options.slidesToShow;if(t.options.fade===true){if(i>0)i--;if(s<=t.slideCount)s++}}n=t.$slider.find(".slick-slide").slice(i,s);o(n);if(t.slideCount<=t.options.slidesToShow){r=t.$slider.find(".slick-slide");o(r)}else if(t.currentSlide>=t.slideCount-t.options.slidesToShow){r=t.$slider.find(".slick-cloned").slice(0,t.options.slidesToShow);o(r)}else if(t.currentSlide===0){r=t.$slider.find(".slick-cloned").slice(t.options.slidesToShow*-1);o(r)}};t.prototype.loadSlider=function(){var e=this;e.setPosition();e.$slideTrack.css({opacity:1});e.$slider.removeClass("slick-loading");e.initUI();if(e.options.lazyLoad==="progressive"){e.progressiveLazyLoad()}};t.prototype.postSlide=function(e){var t=this;if(t.options.onAfterChange!==null){t.options.onAfterChange.call(this,t,e)}t.animating=false;t.setPosition();t.swipeLeft=null;if(t.options.autoplay===true&&t.paused===false){t.autoPlay()}};t.prototype.progressiveLazyLoad=function(){var t=this,n,r;n=e("img[data-lazy]").length;if(n>0){r=e("img[data-lazy]",t.$slider).first();r.attr("src",r.attr("data-lazy")).removeClass("slick-loading").load(function(){r.removeAttr("data-lazy");t.progressiveLazyLoad()}).error(function(){r.removeAttr("data-lazy");t.progressiveLazyLoad()})}};t.prototype.refresh=function(){var t=this,n=t.currentSlide;t.destroy();e.extend(t,t.initials);t.currentSlide=n;t.init()};t.prototype.reinit=function(){var t=this;t.$slides=t.$slideTrack.children(t.options.slide).addClass("slick-slide");t.slideCount=t.$slides.length;if(t.currentSlide>=t.slideCount&&t.currentSlide!==0){t.currentSlide=t.currentSlide-t.options.slidesToScroll}t.setProps();t.setupInfinite();t.buildArrows();t.updateArrows();t.initArrowEvents();t.buildDots();t.updateDots();t.initDotEvents();if(t.options.focusOnSelect===true){e(t.options.slide,t.$slideTrack).on("click.slick",t.selectHandler)}t.setSlideClasses(0);t.setPosition();if(t.options.onReInit!==null){t.options.onReInit.call(this,t)}};t.prototype.removeSlide=function(e,t){var n=this;if(typeof e==="boolean"){t=e;e=t===true?0:n.slideCount-1}else{e=t===true?--e:e}if(n.slideCount<1||e<0||e>n.slideCount-1){return false}n.unload();n.$slideTrack.children(this.options.slide).eq(e).remove();n.$slides=n.$slideTrack.children(this.options.slide);n.$slideTrack.children(this.options.slide).detach();n.$slideTrack.append(n.$slides);n.$slidesCache=n.$slides;n.reinit()};t.prototype.setCSS=function(e){var t=this,n={},r,i;if(t.options.rtl===true){e=-e}r=t.positionProp=="left"?e+"px":"0px";i=t.positionProp=="top"?e+"px":"0px";n[t.positionProp]=e;if(t.transformsEnabled===false){t.$slideTrack.css(n)}else{n={};if(t.cssTransitions===false){n[t.animType]="translate("+r+", "+i+")";t.$slideTrack.css(n)}else{n[t.animType]="translate3d("+r+", "+i+", 0px)";t.$slideTrack.css(n)}}};t.prototype.setDimensions=function(){var e=this;if(e.options.vertical===false){if(e.options.centerMode===true){e.$list.css({padding:"0px "+e.options.centerPadding})}}else{e.$list.height(e.$slides.first().outerHeight(true)*e.options.slidesToShow);if(e.options.centerMode===true){e.$list.css({padding:e.options.centerPadding+" 0px"})}}e.listWidth=e.$list.width();e.listHeight=e.$list.height();if(e.options.vertical===false){e.slideWidth=Math.ceil(e.listWidth/e.options.slidesToShow);e.$slideTrack.width(Math.ceil(e.slideWidth*e.$slideTrack.children(".slick-slide").length))}else{e.slideWidth=Math.ceil(e.listWidth);e.$slideTrack.height(Math.ceil(e.$slides.first().outerHeight(true)*e.$slideTrack.children(".slick-slide").length))}var t=e.$slides.first().outerWidth(true)-e.$slides.first().width();e.$slideTrack.children(".slick-slide").width(e.slideWidth-t)};t.prototype.setFade=function(){var t=this,n;t.$slides.each(function(r,i){n=t.slideWidth*r*-1;e(i).css({position:"relative",left:n,top:0,zIndex:800,opacity:0})});t.$slides.eq(t.currentSlide).css({zIndex:900,opacity:1})};t.prototype.setHeight=function(){var e=this;if(e.options.slidesToShow===1&&e.options.adaptiveHeight===true&&e.options.vertical===false){var t=e.$slides.eq(e.currentSlide).outerHeight(true);e.$list.css("height",t)}};t.prototype.setPosition=function(){var e=this;e.setDimensions();e.setHeight();if(e.options.fade===false){e.setCSS(e.getLeft(e.currentSlide))}else{e.setFade()}};t.prototype.setProps=function(){var e=this,t=document.body.style;e.positionProp=e.options.vertical===true?"top":"left";if(e.positionProp==="top"){e.$slider.addClass("slick-vertical")}else{e.$slider.removeClass("slick-vertical")}if(t.WebkitTransition!==undefined||t.MozTransition!==undefined||t.msTransition!==undefined){if(e.options.useCSS===true){e.cssTransitions=true}}if(t.OTransform!==undefined){e.animType="OTransform";e.transformType="-o-transform";e.transitionType="OTransition";if(t.perspectiveProperty===undefined&&t.webkitPerspective===undefined)e.animType=false}if(t.MozTransform!==undefined){e.animType="MozTransform";e.transformType="-moz-transform";e.transitionType="MozTransition";if(t.perspectiveProperty===undefined&&t.MozPerspective===undefined)e.animType=false}if(t.webkitTransform!==undefined){e.animType="webkitTransform";e.transformType="-webkit-transform";e.transitionType="webkitTransition";if(t.perspectiveProperty===undefined&&t.webkitPerspective===undefined)e.animType=false}if(t.msTransform!==undefined){e.animType="msTransform";e.transformType="-ms-transform";e.transitionType="msTransition";if(t.msTransform===undefined)e.animType=false}if(t.transform!==undefined&&e.animType!==false){e.animType="transform";e.transformType="transform";e.transitionType="transition"}e.transformsEnabled=e.animType!==null&&e.animType!==false};t.prototype.setSlideClasses=function(e){var t=this,n,r,i,s;t.$slider.find(".slick-slide").removeClass("slick-active").removeClass("slick-center");r=t.$slider.find(".slick-slide");if(t.options.centerMode===true){n=Math.floor(t.options.slidesToShow/2);if(t.options.infinite===true){if(e>=n&&e<=t.slideCount-1-n){t.$slides.slice(e-n,e+n+1).addClass("slick-active")}else{i=t.options.slidesToShow+e;r.slice(i-n+1,i+n+2).addClass("slick-active")}if(e===0){r.eq(r.length-1-t.options.slidesToShow).addClass("slick-center")}else if(e===t.slideCount-1){r.eq(t.options.slidesToShow).addClass("slick-center")}}t.$slides.eq(e).addClass("slick-center")}else{if(e>=0&&e<=t.slideCount-t.options.slidesToShow){t.$slides.slice(e,e+t.options.slidesToShow).addClass("slick-active")}else if(r.length<=t.options.slidesToShow){r.addClass("slick-active")}else{s=t.slideCount%t.options.slidesToShow;i=t.options.infinite===true?t.options.slidesToShow+e:e;if(t.options.slidesToShow==t.options.slidesToScroll&&t.slideCount-e<t.options.slidesToShow){r.slice(i-(t.options.slidesToShow-s),i+s).addClass("slick-active")}else{r.slice(i,i+t.options.slidesToShow).addClass("slick-active")}}}if(t.options.lazyLoad==="ondemand"){t.lazyLoad()}};t.prototype.setupInfinite=function(){var t=this,n,r,i;if(t.options.fade===true||t.options.vertical===true){t.options.centerMode=false}if(t.options.infinite===true&&t.options.fade===false){r=null;if(t.slideCount>t.options.slidesToShow){if(t.options.centerMode===true){i=t.options.slidesToShow+1}else{i=t.options.slidesToShow}for(n=t.slideCount;n>t.slideCount-i;n-=1){r=n-1;e(t.$slides[r]).clone(true).attr("id","").attr("index",r-t.slideCount).prependTo(t.$slideTrack).addClass("slick-cloned")}for(n=0;n<i;n+=1){r=n;e(t.$slides[r]).clone(true).attr("id","").attr("index",r+t.slideCount).appendTo(t.$slideTrack).addClass("slick-cloned")}t.$slideTrack.find(".slick-cloned").find("[id]").each(function(){e(this).attr("id","")})}}};t.prototype.selectHandler=function(t){var n=this;var r=n.options.asNavFor!=null?e(n.options.asNavFor).getSlick():null;var i=parseInt(e(t.target).parents(".slick-slide").attr("index"));if(!i)i=0;if(n.slideCount<=n.options.slidesToShow){return}n.slideHandler(i);if(r!=null){if(r.slideCount<=r.options.slidesToShow){return}r.slideHandler(i)}};t.prototype.slideHandler=function(e){var t,n,r,i,s=null,o=this;if(o.animating===true&&o.options.waitForAnimate===true){return false}t=e;s=o.getLeft(t);r=o.getLeft(o.currentSlide);i=o.slideCount%o.options.slidesToScroll!==0?o.options.slidesToScroll:0;o.currentLeft=o.swipeLeft===null?r:o.swipeLeft;if(o.options.infinite===false&&o.options.centerMode===false&&(e<0||e>o.slideCount-o.options.slidesToShow+i)){if(o.options.fade===false){t=o.currentSlide;o.animateSlide(r,function(){o.postSlide(t)})}return false}else if(o.options.infinite===false&&o.options.centerMode===true&&(e<0||e>o.slideCount-o.options.slidesToScroll)){if(o.options.fade===false){t=o.currentSlide;o.animateSlide(r,function(){o.postSlide(t)})}return false}if(o.options.autoplay===true){clearInterval(o.autoPlayTimer)}if(t<0){if(o.slideCount%o.options.slidesToScroll!==0){n=o.slideCount-o.slideCount%o.options.slidesToScroll}else{n=o.slideCount-o.options.slidesToScroll}}else if(t>o.slideCount-1){n=0}else{n=t}o.animating=true;if(o.options.onBeforeChange!==null&&e!==o.currentSlide){o.options.onBeforeChange.call(this,o,o.currentSlide,n)}o.currentSlide=n;o.setSlideClasses(o.currentSlide);o.updateDots();o.updateArrows();if(o.options.fade===true){o.fadeSlide(n,function(){o.postSlide(n)});return false}o.animateSlide(s,function(){o.postSlide(n)})};t.prototype.startLoad=function(){var e=this;if(e.options.arrows===true&&e.slideCount>e.options.slidesToShow){e.$prevArrow.hide();e.$nextArrow.hide()}if(e.options.dots===true&&e.slideCount>e.options.slidesToShow){e.$dots.hide()}e.$slider.addClass("slick-loading")};t.prototype.swipeDirection=function(){var e,t,n,r,i=this;e=i.touchObject.startX-i.touchObject.curX;t=i.touchObject.startY-i.touchObject.curY;n=Math.atan2(t,e);r=Math.round(n*180/Math.PI);if(r<0){r=360-Math.abs(r)}if(r<45&&r>=0){return"left"}if(r<=360&&r>315){return"left"}if(r>135&&r<225){return"right"}if(r>=45&&r<=135){return"up"}if(r>=225&&r<=315){return"down"}return"vertical"};t.prototype.swipeEnd=function(t){var n=this;var r=n.options.asNavFor!=null?e(n.options.asNavFor).getSlick():null;n.dragging=false;if(n.touchObject.curX===undefined){return false}if(n.touchObject.swipeLength>=n.touchObject.minSwipe){e(t.target).on("click.slick",function(t){t.stopImmediatePropagation();t.stopPropagation();t.preventDefault();e(t.target).off("click.slick")});switch(n.swipeDirection()){case"left":n.slideHandler(n.currentSlide+n.options.slidesToScroll);if(r!=null)r.slideHandler(r.currentSlide+r.options.slidesToScroll);n.touchObject={};break;case"right":n.slideHandler(n.currentSlide-n.options.slidesToScroll);if(r!=null)r.slideHandler(r.currentSlide-r.options.slidesToScroll);n.touchObject={};break;case"up":if(n.options.vertical==false)break;n.slideHandler(n.currentSlide+n.options.slidesToScroll);if(r!=null)r.slideHandler(r.currentSlide+r.options.slidesToScroll);n.touchObject={};break;case"down":if(n.options.vertical==false)break;n.slideHandler(n.currentSlide-n.options.slidesToScroll);if(r!=null)r.slideHandler(r.currentSlide-r.options.slidesToScroll);n.touchObject={};break}}else{if(n.touchObject.startX!==n.touchObject.curX){n.slideHandler(n.currentSlide);if(r!=null)r.slideHandler(r.currentSlide);n.touchObject={}}}};t.prototype.swipeHandler=function(e){var t=this;if(t.options.swipe===false||"ontouchend"in document&&t.options.swipe===false){return}else if(t.options.draggable===false&&e.type.indexOf("mouse")!==-1){return}t.touchObject.fingerCount=e.originalEvent&&e.originalEvent.touches!==undefined?e.originalEvent.touches.length:1;t.touchObject.minSwipe=t.listWidth/t.options.touchThreshold;switch(e.data.action){case"start":t.swipeStart(e);break;case"move":t.swipeMove(e);break;case"end":t.swipeEnd(e);break}};t.prototype.swipeMove=function(e){var t=this,n,r,i,s;s=e.originalEvent!==undefined?e.originalEvent.touches:null;n=t.getLeft(t.currentSlide);if(!t.dragging||s&&s.length!==1){return false}t.touchObject.curX=s!==undefined?s[0].pageX:e.clientX;t.touchObject.curY=s!==undefined?s[0].pageY:e.clientY;if(t.options.vertical==false)t.touchObject.swipeLength=Math.round(Math.sqrt(Math.pow(t.touchObject.curX-t.touchObject.startX,2)));else t.touchObject.swipeLength=Math.round(Math.sqrt(Math.pow(t.touchObject.curY-t.touchObject.startY,2)));r=t.swipeDirection();if(r==="vertical"){return}if(e.originalEvent!==undefined&&t.touchObject.swipeLength>4){e.preventDefault()}i=t.touchObject.curX>t.touchObject.startX?1:-1;if(t.options.vertical===false){t.swipeLeft=n+t.touchObject.swipeLength*i}else{i=t.touchObject.curY>t.touchObject.startY?1:-1;t.swipeLeft=n+t.touchObject.swipeLength*(t.$list.height()/t.listWidth)*i}if(t.options.fade===true||t.options.touchMove===false){return false}if(t.animating===true){t.swipeLeft=null;return false}t.setCSS(t.swipeLeft)};t.prototype.swipeStart=function(e){var t=this,n;if(t.touchObject.fingerCount!==1||t.slideCount<=t.options.slidesToShow){t.touchObject={};return false}if(e.originalEvent!==undefined&&e.originalEvent.touches!==undefined){n=e.originalEvent.touches[0]}t.touchObject.startX=t.touchObject.curX=n!==undefined?n.pageX:e.clientX;t.touchObject.startY=t.touchObject.curY=n!==undefined?n.pageY:e.clientY;t.dragging=true};t.prototype.unfilterSlides=function(){var e=this;if(e.$slidesCache!==null){e.unload();e.$slideTrack.children(this.options.slide).detach();e.$slidesCache.appendTo(e.$slideTrack);e.reinit()}};t.prototype.unload=function(){var t=this;e(".slick-cloned",t.$slider).remove();if(t.$dots){t.$dots.remove()}if(t.$prevArrow){t.$prevArrow.remove();t.$nextArrow.remove()}t.$slides.removeClass("slick-slide slick-active slick-visible").css("width","")};t.prototype.updateArrows=function(){var e=this;if(e.options.arrows===true&&e.options.infinite!==true&&e.slideCount>e.options.slidesToShow){e.$prevArrow.removeClass("slick-disabled");e.$nextArrow.removeClass("slick-disabled");if(e.currentSlide===0){e.$prevArrow.addClass("slick-disabled");e.$nextArrow.removeClass("slick-disabled")}else if(e.currentSlide>=e.slideCount-e.options.slidesToShow){e.$nextArrow.addClass("slick-disabled");e.$prevArrow.removeClass("slick-disabled")}}};t.prototype.updateDots=function(){var e=this;if(e.$dots!==null){e.$dots.find("li").removeClass("slick-active");e.$dots.find("li").eq(Math.floor(e.currentSlide/e.options.slidesToScroll)).addClass("slick-active")}};e.fn.slick=function(e){var n=this;return n.each(function(n,r){r.slick=new t(r,e)})};e.fn.slickAdd=function(e,t,n){var r=this;return r.each(function(r,i){i.slick.addSlide(e,t,n)})};e.fn.slickCurrentSlide=function(){var e=this;return e.get(0).slick.getCurrent()};e.fn.slickFilter=function(e){var t=this;return t.each(function(t,n){n.slick.filterSlides(e)})};e.fn.slickGoTo=function(e){var t=this;return t.each(function(t,n){n.slick.changeSlide({data:{message:"index",index:e}})})};e.fn.slickNext=function(){var e=this;return e.each(function(e,t){t.slick.changeSlide({data:{message:"next"}})})};e.fn.slickPause=function(){var e=this;return e.each(function(e,t){t.slick.autoPlayClear();t.slick.paused=true})};e.fn.slickPlay=function(){var e=this;return e.each(function(e,t){t.slick.paused=false;t.slick.autoPlay()})};e.fn.slickPrev=function(){var e=this;return e.each(function(e,t){t.slick.changeSlide({data:{message:"previous"}})})};e.fn.slickRemove=function(e,t){var n=this;return n.each(function(n,r){r.slick.removeSlide(e,t)})};e.fn.slickGetOption=function(e){var t=this;return t.get(0).slick.options[e]};e.fn.slickSetOption=function(e,t,n){var r=this;return r.each(function(r,i){i.slick.options[e]=t;if(n===true){i.slick.unload();i.slick.reinit()}})};e.fn.slickUnfilter=function(){var e=this;return e.each(function(e,t){t.slick.unfilterSlides()})};e.fn.unslick=function(){var e=this;return e.each(function(e,t){if(t.slick){t.slick.destroy()}})};e.fn.getSlick=function(){var e=null;var t=this;t.each(function(t,n){e=n.slick});return e}}) |