diff --git a/dist/min/tiny-slider.js b/dist/min/tiny-slider.js index 0b942f83..ff0b4b02 100644 --- a/dist/min/tiny-slider.js +++ b/dist/min/tiny-slider.js @@ -1,2 +1,2 @@ -var tns=function(){function t(){for(var t,e,n,i=arguments[0]||{},a=1,o=arguments.length;a=0?JSON.parse(t):t}function n(t,e){return localStorage.setItem(t,e),e}function i(){return void 0===window.tnsId?window.tnsId=1:window.tnsId++,"tns"+window.tnsId}function a(t){var e=document.createElement("style");return t&&e.setAttribute("media",t),document.querySelector("head").appendChild(e),e.sheet?e.sheet:e.styleSheet}function o(t,e,n,i){"insertRule"in t?t.insertRule(e+"{"+n+"}",i):"addRule"in t&&t.addRule(e,n,i)}function r(t,e){return Math.atan2(t,e)*(180/Math.PI)}function s(t,e){return Math.abs(90-Math.abs(t))>=90-e?"horizontal":Math.abs(90-Math.abs(t))<=e&&"vertical"}function c(t,e){return t.hasAttribute(e)}function l(t,e){return t.getAttribute(e)}function u(t){return void 0!==t.item}function d(t,e){if(t=u(t)||t instanceof Array?t:[t],"[object Object]"===Object.prototype.toString.call(e))for(var n=t.length;n--;)for(var i in e)t[n].setAttribute(i,e[i])}function f(t,e){t=u(t)||t instanceof Array?t:[t],e=e instanceof Array?e:[e];for(var n=e.length,i=t.length;i--;)for(var a=n;a--;)t[i].removeAttribute(e[a])}function p(t){var e=t.cloneNode(!0);t.parentNode.insertBefore(e,t),t.remove(),t=null}function h(t){c(t,"hidden")||d(t,{hidden:""})}function v(t){c(t,"hidden")&&f(t,"hidden")}function m(t){return"boolean"==typeof t.complete?t.complete:"number"==typeof t.naturalWidth?0!==t.naturalWidth:void 0}function y(t){for(var e=document.createElement("fakeelement"),n=(t.length,0);n0?setTimeout(s,c):r()}var c=Math.min(o,10),l=a.indexOf("%")>=0?"%":"px",a=a.replace(l,""),u=Number(t.style[e].replace(n,"").replace(i,"").replace(l,"")),d=(a-u)/o*c;setTimeout(s,c)}Object.keys||(Object.keys=function(t){var e=[];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.push(n);return e}),function(){"use strict";"remove"in Element.prototype||(Element.prototype.remove=function(){this.parentNode&&this.parentNode.removeChild(this)})}(),function(){"use strict";var t,e,n,i=window,a=document,o=Object,r="length",s="item contains add remove toggle toString toLocaleString".split(" "),c=s[2],l=s[3],u=s[4],d="prototype",f="defineProperty"in o||"__defineGetter__"in o[d]||null,p=function(t,e,n,i){o.defineProperty?o.defineProperty(t,e,{configurable:!1===f||!!i,get:n}):t.__defineGetter__(e,n)},h=function(t,e){var n=this,i=[],a={},d=0,f=0,h=function(){if(d>=f)for(;f>>0,t[e]=i.join(" "),h())},n[l]=function(){v.apply(n,o=arguments);for(var o,s={},c=0,l=[];c>>0,t[e]=i.join(" "),h()},n[u]=function(t,e){return v.apply(n,[t]),void 0!==e?e?(n[c](t),!0):(n[l](t),!1):a[t]?(n[l](t),!1):(n[c](t),!0)},function(t,e){if(e)for(var n=0;n<7;++n)e(t,s[n],{enumerable:!1})}(n,o.defineProperty),n},v=function(t,e,n){p(t[d],e,function(){var t,i=this,o="__defineGetter__defineProperty"+e;if(i[o])return t;if(i[o]=!0,!1===f){for(var s,c=v.mirror=v.mirror||a.createElement("div"),l=c.childNodes,u=l[r],d=0;dt[r]&&(e=d[c],n=d[l],d[c]=function(){for(var t=0,n=arguments;t=ye&&t0&&t.forEach(function(t){t.disabled||(t.disabled=!0)}),e.length>0&&e.forEach(function(t){t.disabled&&(t.disabled=!1)})}}function V(t,e){t=t?t/1e3+"s":"",e=e||qt,e.style[I]=t,jt||(e.style[R]=t),Gt||(Ft.style[I]=t)}function K(){var t;if(Gt)if(Zt)t=-Zt*ye+"px";else{var e=P?de:Qt;t=100*-ye/e+"%"}else t=-Rt[ye]+"px";return t}function J(t){t||(t=K()),qt.style[he]=ve+t+me}function $(t,e,n,i){for(var a=t,o=t+Qt;a0)for(var n=0;n0&&ht(a,Re[n(s-1)]);break;case M.UP:case M.HOME:s>0&&ht(a,Re[n(0)]);break;case M.RIGHT:case M.PAGEDOWN:s0?Math.floor(n):Math.ceil(n),ye+=n}else{var i=-(nn+on);if(i<=0)ye=xe;else if(i>=Rt[Rt.length-1])ye=Ce;else{var a=0;do{a++,ye=on<0?a+1:a}while(a=Rt[a+1])}}0===t.type.indexOf("touch")?Te.emit("touchEnd",Nt(t)):Te.emit("dragEnd",Nt(t)),tt()}if(dn){dn=!1;var o=gt(t);bt(o)&&b(o,{click:function t(e){xt(e),x(o,{click:t})}})}}function Tt(){Ft.style.cssText+="margin: 0px "+(_t.clientWidth%Zt+Jt)/2+"px"}function St(){Ft.style.height=Rt[ye+Qt]-Rt[ye]+"px"}function Dt(){Be=[];for(var t=!ie&&$t?ye-1:ye,e=t%Yt%Qt;eYt&&(e=Yt-Qt),Be.push(e),e+=Qt;(ie&&Be.length*Qt0)&&Be.unshift(0)}function Lt(){He&&!e.navContainer&&(Dt(),Be!==je&&(je.length>0&&je.forEach(function(t){d(Re[t],{hidden:""})}),Be.length>0&&Be.forEach(function(t){f(Re[t],"hidden")}),je=Be))}function Nt(t){return{container:qt,slideItems:Xt,navContainer:We,navItems:Re,controlsContainer:ze,prevButton:ke,nextButton:Oe,items:Qt,slideBy:Vt,cloneCount:ue,slideCount:Yt,slideCountNew:de,index:ye,indexCached:ge,navCurrent:_e,navCurrentCached:Fe,visibleNavIndexes:Be,visibleNavIndexesCached:je,event:t||{}}}e=t({container:N.querySelector(".slider"),mode:"carousel",axis:"horizontal",items:1,gutter:0,edgePadding:0,fixedWidth:!1,slideBy:1,controls:!0,controlsText:["prev","next"],controlsContainer:!1,nav:!0,navContainer:!1,arrowKeys:!1,speed:300,autoplay:!1,autoplayTimeout:5e3,autoplayDirection:"forward",autoplayText:["start","stop"],autoplayHoverPause:!1,autoplayButton:!1,autoplayResetOnVisibility:!0,loop:!0,rewind:!1,autoHeight:!1,responsive:!1,lazyload:!1,touch:!0,mouseDrag:!1,nested:!1,onInit:!1},e||{});for(var Mt=["container","controlsContainer","navContainer","autoplayButton"],At=4;At--;){var kt=e[Mt[At]];"string"==typeof kt&&(e[Mt[At]]=document.querySelector(kt))}if(e.container&&e.container.nodeName&&!(e.container.children.length<2)){if("gallery"===e.mode){e.axis="horizontal",e.edgePadding=!1,e.loop=!0,e.autoHeight=!0,e.slideBy="page";var Ot="tns-fadeIn",Pt="tns-fadeOut",It=e.animateNormal||"tns-normal",zt=!1;W&&B&&(Ot=e.animateIn||Ot,Pt=e.animateOut||Pt,zt=e.animateDelay||zt)}var Rt,Ht,Wt,Bt,jt="carousel"===e.mode,Gt="horizontal"===e.axis,_t=N.createElement("div"),Ft=N.createElement("div"),qt=e.container,Ut=qt.parentNode,Xt=qt.children,Yt=Xt.length,Qt=Math.min(e.items,Yt),Vt="page"===e.slideBy?Qt:e.slideBy,Kt=e.nested,Jt=e.gutter,$t=e.edgePadding,Zt=!!e.fixedWidth&&e.fixedWidth+Number(e.gutter),te=e.arrowKeys,ee=e.speed,ne=e.rewind,ie=!e.rewind&&e.loop,ae=e.autoHeight,oe=!Zt&&e.responsive,re=!1,se=a(),ce=e.lazyload,le=[],ue=ie?2*Yt:$t?1:0,de=jt?Yt+2*ue:Yt+ue,fe=!(!Zt||ie||$t),pe=!jt||!ie,he=Gt?"left":"top",ve="",me="",ye=jt?ue:0,ge=ye,be=$t?1:0,xe=be,Ce=de-Qt-be,Ee=!1,we=e.onInit,Te=new C,Se=qt.id,De=qt.className,Le=Xt[0].id,Ne=Xt[0].className,Me=qt.id||i(),Ae=!1;if(oe&&(oe[0]||(oe[0]=Math.min(e.items,Yt)),re=Object.keys(oe).sort(function(t,e){return t-e})),e.controls)var ke,Oe,Pe=e.controls,Ie=e.controlsText,ze=e.controlsContainer;if(e.nav)var Re,He=e.nav,We=e.navContainer,Be=[],je=Be,Ge=-1,_e=0,Fe=0;if(e.autoplay)var qe,Ue=e.autoplay,Xe=e.autoplayTimeout,Ye="forward"===e.autoplayDirection?1:-1,Qe=e.autoplayText,Ve=e.autoplayHoverPause,Ke=e.autoplayButton,Je=!1,$e=!1,Ze='Stop Animation',tn=e.autoplayResetOnVisibility,en=!1;if(e.touch)var nn,an,on,rn=e.touch,sn=null,cn=null;if(e.mouseDrag)var ln=e.mouseDrag,un=!1,dn=!1;P&&(he=P,ve="translate",ve+=Gt?"X(":"Y(",me=")");var fn=function(){return Zt?function(){return Math.max(1,Math.min(Yt,Math.floor(Ht/Zt)))}:function(){var t;return re.forEach(function(e){Ht>=e&&(t=oe[e])}),Math.max(1,Math.min(Yt,t))}}();Te.on("itemsChanged",function(){Ce=de-Qt-be,"page"===e.slideBy&&(Vt=Qt),X()}),function(){_t.appendChild(Ft),Ut.insertBefore(_t,qt),Ft.appendChild(qt);var t="tns-outer",i="tns-inner",a=" tns-slider tns-"+e.mode;if(jt&&(Gt&&($t||Jt&&!Zt)?t+=" tns-ovh":i+=" tns-ovh"),_t.className=t,Ft.className=i,ae&&(Ft.className+=" tns-ah",Ft.style[I]=ee/1e3+"s"),""===qt.id&&(qt.id=Me),a+=k?" tns-subpixel":" tns-no-subpixel",a+=A?" tns-calc":" tns-no-calc",jt&&(a+=" tns-"+e.axis),qt.className+=a,t=i=a=null,$t)if(Zt)Tt();else{var r=$t+Jt,s=$t;Ft.style.cssText+=Gt?"margin: 0 "+s+"px 0 "+r+"px":"padding: "+r+"px 0 "+s+"px 0"}Ht=y();for(var c=0;c