/** * HammerSlider - Hammerslider touch is a lightweight infinite carousel plugin * v0.1.10 | https://github.com/davidcetinkaya/hammer-slider * Copyright David Cetinkaya * * MIT license */ "use strict";function HammerSlider(e,t){function n(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])}function i(e,t,n,i){e&&e.addEventListener(t,n,!!i)}function o(e,t){e&&e.classList.add(t)}function r(e,t){e&&e.classList.remove(t)}function a(e,t,n){e.style[q]="translateX("+t+(n?n:"px")+")"}function s(e){var t=["","-webkit-","-moz-","-ms-","-o-"],n=document.createElement("div");for(var i in t)if("undefined"!=typeof n.style[t[i]+e])return t[i]+e;return!1}function d(e){for(var t=0;t<_;t++)e.call(x,t)}function u(){var e=window.getComputedStyle(x.container,null).getPropertyValue(q);return parseInt(e.split(",")[4])}function c(){return{getNextSlideNr:W.rewind?v:p,getRelativeSlideNr:Y?S:w,nrSlidesInPercent:100*_,lastSlide:_-1,isLastSlide:function(e){return e===this.lastSlide}}}function l(t){var n=t?Math.abs(t):W.startSlide;X=n,x.width=e.offsetWidth,W.rewind||(I[1]={slide:n?0:O.lastSlide,flipPoint:(O.isLastSlide(n)?n-1:n)*x.width*-1+x.width*-.5,toPos:n?O.nrSlidesInPercent:0},I[-1]={slide:O.isLastSlide(n)?0:n?O.lastSlide:O.lastSlide-1,flipPoint:n*x.width*-1+.5*x.width,toPos:O.isLastSlide(n)?0:O.nrSlidesInPercent*-1}),d(function(e){var t=0;W.rewind||(!e&&O.isLastSlide(n)?t=O.nrSlidesInPercent:O.isLastSlide(e)&&!n&&(t=O.nrSlidesInPercent*-1)),a(this.slides[e],t,"%"),this.slides[e].style.width=this.width+"px"}),x.container.style.width=_*x.width+"px",a(x.container,n*x.width*-1),F(n)}function f(e){var t=I[1].flipPoint,n=I[-1].flipPoint;return en&&-1}function m(e){if(e){var t=e>0?-1:1,i=I[e];a(x.slides[i.slide],i.toPos,"%"),n(I[t],{flipPoint:i.flipPoint,slide:i.slide,toPos:i.toPos+O.nrSlidesInPercent*t}),i.flipPoint+=x.width*t,h(i,e)&&(i.toPos+=O.nrSlidesInPercent*e)}}function h(e,t){switch(t){case 1:return e.slide=O.isLastSlide(e.slide)?0:++e.slide,!e.slide;case-1:return e.slide=e.slide?--e.slide:O.lastSlide,O.isLastSlide(e.slide)}}function p(e){return X+e}function v(e){if(e>0){if(O.isLastSlide(X))return 0}else if(!X)return O.lastSlide;return p(e)}function w(e){var t=u(),n=Math.ceil(t/x.width),i=Math.ceil(n/_),o=Math.abs(i*_-e);return t>0?o*-1:o}function S(e){var t=u()/x.width,n=t<0?Math.ceil(Math.abs(t)):Math.floor(t*-1),i=!(Math.abs(n%_)%2),o=i&&e?1:i||e?0:-1;return n+o}function g(e){var t=Math.abs(X%_),n=(e||u())<0?t:_-t;return n>O.lastSlide?0:n}function P(e,t,n,i){var o=t?O.getRelativeSlideNr(e):e,r=o*x.width*-1,a=void 0;C(),X=o,a=g(r),W.beforeSlideChange&&W.beforeSlideChange(a),F(a),T(r,n,i)}function T(e,t,n){function i(){c>o?(X%_===W.startSlide&&l(),M(n),W.afterSlideChange&&W.afterSlideChange(g())):(!W.rewind&&m(f(r)),r=parseInt(Math.easeOutQuad(c,s,d,o)),c+=h,a(x.container,r),x.animationFrame=requestAnimationFrame(i))}var o=t||W.slideSpeed,r=u(),s=r,d=e-s,c=0,h=2;x.animationFrame=requestAnimationFrame(i)}function b(){x.autoTimeOut=setTimeout(function(){return P(O.getNextSlideNr(1),!1,!1,!0)},W.slideInterval)}function C(){cancelAnimationFrame(x.animationFrame),clearTimeout(x.autoTimeOut)}function M(e){(W.slideShow&&!W.stopAfterInteraction||e)&&b()}function A(e){P(O.getNextSlideNr(e))}function y(){A(1)}function E(){A(-1)}function F(e){W.dots&&(r(x.dotWrap.querySelector("."+k.dotActiveClass),k.dotActiveClass),o(x.dots[Y?Math.abs(X%(_-Y)):e],k.dotActiveClass))}function L(){C(),l(g()),M()}function D(){var e=void 0,t=void 0,n=void 0;TouchEvents(x.container,{mouse:W.mouseDrag,dragThreshold:W.dragThreshold,start:function(t){C(),e=u(),n=X%_,o(x.container,k.dragging)},move:function(i,o,r){"left"!==o&&"right"!==o||(x.animationFrame=requestAnimationFrame(function(){t=e+r.X,W.rewind?(!n&&"right"===o||O.isLastSlide(n)&&"left"===o)&&(t=e+r.X/2.5):m(f(t)),a(x.container,t)}))},end:function(e,i,o){var a=X;Math.abs(o.X)>W.minimumDragDistance&&("left"===i?a=W.rewind&&O.isLastSlide(n)?O.lastSlide:O.getNextSlideNr(1):"right"===i&&(a=W.rewind&&!n?0:O.getNextSlideNr(-1))),t&&(P(a,!1,W.touchSpeed),t=null),r(x.container,k.dragging)}})}function N(){var t=document.createDocumentFragment();if(x.container=W.slideContainer||e.children[0],_=x.container.children.length,q=s("transform"),_<=1||!q)return d(function(e){this.container.children[e].style.width="100%",this.container.style.width=100*_+"%"}),void(q&&a(x.container,0));if(!W.rewind&&2===_){var n=x.container,r=n.children;n.appendChild(r[0].cloneNode(1)),n.appendChild(r[_-1].cloneNode(1)),_+=2,Y=2}O=c(),W.slideSpeed=W.slideSpeed<2?2:10*Math.ceil(W.slideSpeed/10),d(function(n){if(this.slides.push(this.container.children[n]),i(this.slides[n],"focus",function(t){C(),e.scrollLeft=0,P(n,!0)},!0),W.dots){var r=document.createElement("li");!function(e,n){n>=_-Y||(o(e,k.dotItem),e.setAttribute("tabindex",0),e.setAttribute("role","button"),e.innerHTML="",i(e,"click",function(t){P(n,!0),e.blur()}),i(e,"keyup",function(e){13===e.keyCode&&P(n,!0)}),t.appendChild(e))}(r,n),this.dots.push(r),O.isLastSlide(n)&&(this.dotWrap=W.dotContainer||document.createElement("ul"),this.dotWrap.appendChild(t),W.dotContainer||(o(this.dotWrap,k.dotWrap),e.appendChild(this.dotWrap)))}}),i(window,"resize",L),i(window,"orientationchange",L),D(),l(),W.mouseDrag&&o(x.container,k.mouseDrag),W.slideShow&&b(),W.onSetup&&setTimeout(function(){return W.onSetup(_)},0)}var x={slides:[],dots:[]},I={},X=0,_=0,Y=0,q=void 0,O=void 0,W={slideShow:!1,slideInterval:5e3,slideSpeed:50,touchSpeed:50,startSlide:0,dragThreshold:10,minimumDragDistance:30,stopAfterInteraction:!0,rewind:!1,dots:!1,mouseDrag:!1,dotContainer:void 0,slideContainer:void 0,beforeSlideChange:void 0,afterSlideChange:void 0,onSetup:void 0,cssPrefix:"c-slider"};t&&n(W,t);var k={dotWrap:W.cssPrefix+"__dots",dotItem:W.cssPrefix+"__dot",dotActiveClass:W.cssPrefix+"__dot--is-active",dragging:W.cssPrefix+"__container--is-dragging",mouseDrag:W.cssPrefix+"__container--mouse-drag-enabled"};return Math.easeOutQuad=function(e,t,n,i){return e/=i,-n*e*(e-2)+t},N(),{next:y,prev:E,stop:C,start:b,getActiveSlideNr:g,setupSlider:function(e){return l(e)},moveTo:function(e,t){return P(e,!0,t)}}}function TouchEvents(e,t){function n(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])}function i(e,t,n,i){t&&e.addEventListener(t,n,!!i)}function o(e,t,n,i){t&&e.removeEventListener(t,n,!!i)}function r(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function a(e){h={X:(v?e.clientX:e.touches[0].clientX)-m.X,Y:(v?e.clientY:e.touches[0].clientY)-m.Y,time:(new Date).getTime()-m.time}}function s(e,t){if(p="",v=t,!T[v](e)){r&&v&&r(e),i(document,P[v][1],d),i(document,P[v][2],u),i(document,P[v][3],u),m={X:v?e.clientX:e.touches[0].clientX,Y:v?e.clientY:e.touches[0].clientY,time:(new Date).getTime()};for(var n in h)h[n]=0;f.start(e)}}function d(e){a(e),document["on"+P[v][1]]=function(e){r(e)},w?"X"===w?(p=h.X<0?"left":"right",r&&r(e)):"Y"===w&&(p=h.Y<0?"up":"down"):w=f.dragThresholdf.dragThreshold&&e.preventDefault()})}var l=function(){},f={preventDefault:!0,mouse:!0,dragThreshold:10,start:l,move:l,end:l};t&&n(f,t);var m={},h={},p=void 0,v=void 0,w=void 0,S={pointerEvents:!!window.navigator.pointerEnabled,msPointerEvents:!!window.navigator.msPointerEnabled},g=S.pointerEvents?1:S.msPointerEvents?2:0,P=[["touchstart","touchmove","touchend","touchcancel"],["pointerdown","pointermove","pointerup","pointercancel"],["MSPointerDown","MSPointerMove","MSPointerUp","MSPointerCancel"],["mousedown","mousemove","mouseup",!1]],T=[function(e){return e.touches&&e.touches.length>1||e.scale&&1!==e.scale},function(e){return!e.isPrimary||e.buttons&&1!==e.buttons||!f.mouse&&"touch"!==e.pointerType&&"pen"!==e.pointerType},function(e){return!e.isPrimary||e.buttons&&1!==e.buttons||!f.mouse&&e.pointerType!==e.MSPOINTER_TYPE_TOUCH&&e.pointerType!==e.MSPOINTER_TYPE_PEN},function(e){return e.buttons&&1!==e.buttons}];c()}window.jQuery&&!function(e){e.fn.HammerSlider=function(t){return this.each(function(){e(this).data("HammerSlider",HammerSlider(this,t))}),this}}(window.jQuery),function(){for(var e=0,t=["ms","moz","webkit","o"],n=0;n