From ac565d5ccbd31cdd961192069ecfc4f9cda11810 Mon Sep 17 00:00:00 2001 From: William Lin 22 Date: Thu, 29 Sep 2016 10:30:24 -0400 Subject: [PATCH] fixed a length issue when parent has non-zero padding --- README.md | 2 +- bower.json | 4 +- changelog.md | 3 ++ dist/min/tiny-slider.ie8.js | 2 +- dist/min/tiny-slider.js | 2 +- dist/min/tiny-slider.native.js | 2 +- dist/tiny-slider.ie8.js | 40 +++++++++++++++ dist/tiny-slider.js | 93 ++++++++++++++++++++++------------ dist/tiny-slider.native.js | 4 +- gulpfile.js | 6 ++- package.json | 2 +- src/tiny-slider.native.js | 4 +- tests/index.html | 67 ++++++++++++------------ 13 files changed, 154 insertions(+), 77 deletions(-) diff --git a/README.md b/README.md index e6365d97..4e1e21bc 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # tiny-slider -![version](https://img.shields.io/badge/Version-0.4.1-green.svg) +![version](https://img.shields.io/badge/Version-0.4.2-green.svg) Tiny slider for all purposes, inspired by [Owl Carousel](http://owlcarousel.owlgraphic.com/). Works on morden browsers and IE8+. [demo](http://creatiointl.org/william/tiny-slider/v1/demo/) diff --git a/bower.json b/bower.json index 9dd3131c..19c1ae0b 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "tiny-slider", - "version": "0.4.1", + "version": "0.4.2", "homepage": "https://github.com/ganlanyuan/tiny-slider", "authors": [ "WilliamLin " @@ -27,7 +27,7 @@ "gulpfile.js" ], "devDependencies": { - "go-native": "0.0.8" + "go-native": "0.x" }, "dependencies": {} } diff --git a/changelog.md b/changelog.md index 8ed1ac77..ad947df7 100644 --- a/changelog.md +++ b/changelog.md @@ -27,6 +27,9 @@ class `tiny-next` => attribute `[data-controls="next"`. - Fixed: an issue with `items`, when container width is shorter than one slide in fixedWidth slider. --> +#### v0.4.2 +- Fixed: a length issue when slider parent element has non-zero `padding`. + #### v0.4.1 - Added: `gutterPosition` option. - Fixed: `margin` attribute is added even gutter is 0. diff --git a/dist/min/tiny-slider.ie8.js b/dist/min/tiny-slider.ie8.js index 6405aeba..4fa7fcf5 100644 --- a/dist/min/tiny-slider.ie8.js +++ b/dist/min/tiny-slider.ie8.js @@ -1,2 +1,2 @@ -Object.keys||(Object.keys=function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t}),function(){if(!Element.prototype.addEventListener){var e=[],t=function(t,n){var r=this,o=function(e){e.target=e.srcElement,e.currentTarget=r,"undefined"!=typeof n.handleEvent?n.handleEvent(e):n.call(r,e)};if("DOMContentLoaded"==t){var i=function(e){"complete"==document.readyState&&o(e)};if(document.attachEvent("onreadystatechange",i),e.push({object:this,type:t,listener:n,wrapper:i}),"complete"==document.readyState){var c=new Event;c.srcElement=window,i(c)}}else this.attachEvent("on"+t,o),e.push({object:this,type:t,listener:n,wrapper:o})},n=function(t,n){for(var r=0;r=0;--n)if(e=t[n],1===e.nodeType)return e;return null}})}(),function(){"use strict";"previousElementSibling"in document.documentElement||Object.defineProperty(Element.prototype,"previousElementSibling",{get:function(){for(var e=this.previousSibling;e&&1!==e.nodeType;)e=e.previousSibling;return e}})}(),function(){"use strict";"nextElementSibling"in document.documentElement||Object.defineProperty(Element.prototype,"nextElementSibling",{get:function(){for(var e=this.nextSibling;e&&1!==e.nodeType;)e=e.nextSibling;return e}})}(); +Object.keys||(Object.keys=function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t}),function(){if(!Element.prototype.addEventListener){var e=[],t=function(t,n){var r=this,o=function(e){e.target=e.srcElement,e.currentTarget=r,"undefined"!=typeof n.handleEvent?n.handleEvent(e):n.call(r,e)};if("DOMContentLoaded"==t){var i=function(e){"complete"==document.readyState&&o(e)};if(document.attachEvent("onreadystatechange",i),e.push({object:this,type:t,listener:n,wrapper:i}),"complete"==document.readyState){var l=new Event;l.srcElement=window,i(l)}}else this.attachEvent("on"+t,o),e.push({object:this,type:t,listener:n,wrapper:o})},n=function(t,n){for(var r=0;r=0;--n)if(e=t[n],1===e.nodeType)return e;return null}})}(),function(){"use strict";"previousElementSibling"in document.documentElement||Object.defineProperty(Element.prototype,"previousElementSibling",{get:function(){for(var e=this.previousSibling;e&&1!==e.nodeType;)e=e.previousSibling;return e}})}(),function(){"use strict";"nextElementSibling"in document.documentElement||Object.defineProperty(Element.prototype,"nextElementSibling",{get:function(){for(var e=this.nextSibling;e&&1!==e.nodeType;)e=e.nextSibling;return e}})}(),function(){"use strict";window.getComputedStyle||(window.getComputedStyle=function(e){if(!e)return null;var t=e.currentStyle,n=e.getBoundingClientRect(),r=document.createElement("div"),o=r.style;for(var i in t)o[i]=t[i];return o.cssFloat=o.styleFloat,"auto"===o.width&&(o.width=n.right-n.left+"px"),"auto"===o.height&&(o.height=n.bottom-n.top+"px"),o})}(); //# sourceMappingURL=../sourcemaps/tiny-slider.ie8.js.map diff --git a/dist/min/tiny-slider.js b/dist/min/tiny-slider.js index 3a8f9fad..e729d17e 100644 --- a/dist/min/tiny-slider.js +++ b/dist/min/tiny-slider.js @@ -1,2 +1,2 @@ -!function(){"use strict";var t,e,n,i,r=window,o=document,a=Object,l=null,u=!0,s=!1,d=" ",c="Element",f="create"+c,v="DOMTokenList",m="__defineGetter__",h="defineProperty",p="class",b="List",g=p+b,y="rel",A=y+b,w="div",E="length",L="contains",x="apply",C="HTML",M=("item "+L+" add remove toggle toString toLocaleString").split(d),T=M[2],N=M[3],S=M[4],k="prototype",P=h in a||m in a[k]||l,D=function(t,e,n,i){a[h]?a[h](t,e,{configurable:s===P?u:!!i,get:n}):t[m](e,n)},W=function(e,n){var i=this,r=[],o={},l=0,c=0,f=function(){if(l>=c)for(;c>>0,e[n]=r.join(d),f())},i[N]=function(){v[x](i,t=arguments);for(var t,a={},s=0,c=[];s>>0,e[n]=r.join(d),f()},i[S]=function(e,n){return v[x](i,[e]),t!==n?n?(i[T](e),u):(i[N](e),s):o[e]?(i[N](e),s):(i[T](e),u)},function(t,e){if(e)for(var n=0;n<7;++n)e(t,M[n],{enumerable:s})}(i,a[h]),i},O=function(t,e,n){D(t[k],e,function(){var t,i=this,r=m+h+e;if(i[r])return t;if(i[r]=u,s===P){for(var a,l=O.mirror=O.mirror||o[f](w),d=l.childNodes,c=d[E],v=0;ve[E]&&(n=k[T],i=k[N],k[T]=function(){for(var t=0,e=arguments;t0&&e.right>0&&e.top0?e.cloneNode(!0):e,o=n[i],a=o.parentNode,l=o.nextSibling;r.appendChild(o),l?a.insertBefore(r,l):a.appendChild(r)}},gn.unwrap=function(t){for(var e=gn.isNodeList(t)?t:[t],n=e.length;n--;){for(var i=e[n],r=i.parentNode;i.firstChild;)r.insertBefore(i.firstChild,i);r.removeChild(i)}},Date.now||(Date.now=function(){return(new Date).getTime()}),function(){"use strict";for(var t=["webkit","moz"],e=0;e=t&&n=e&&i=e&&t_?(0===Lt?(X.disabled=!0,D(X,K)):X.disabled=!1,Lt===et-_?(K.disabled=!0,D(K,X)):K.disabled=!1):(0!==Lt&&(Lt=0,y()),X.disabled=!0,K.disabled=!0,X.setAttribute("tabindex","-1"),K.setAttribute("tabindex","-1"),X===document.activeElement&&X.blur(),K===document.activeElement&&K.blur()))}function b(){if(st&&!t.navContainer)for(var e=Y;e--;){var n=V[e];e<$?n.hasAttribute("hidden")&&n.removeAttribute("hidden"):n.hasAttribute("hidden")||n.setAttribute("hidden","")}}function g(){if(st){var e;if(Et===-1){var n=Lt<0?Lt+et:Lt>=et?Lt-et:Lt;if(e=t.navContainer?n:Math.floor(n/_),!bt&&!t.navContainer){var i=/^-?[0-9]+$/,r=i.test(et/_);r||Lt!==et-_||(e+=1)}}else e=Et,Et=-1;for(var o=$;o--;){var a=V[o];o===e?"false"===a.getAttribute("aria-selected")&&(a.setAttribute("tabindex","0"),a.setAttribute("aria-selected","true")):"true"===a.getAttribute("aria-selected")&&(a.setAttribute("tabindex","-1"),a.setAttribute("aria-selected","false"))}}}function y(){var t=Q.parentNode.offsetWidth;Pt=-B*Lt,ot&&!bt&&(Pt=Math.max(Pt,-Math.abs(et*B-it-t))),a?Q.style[a]="translate3d("+Pt+"px, 0, 0)":Q.style.left=Pt+"px"}function A(){u(),m(),y(),b(),g(),h(),p(),gt&&c(),At&&F()}function w(){if(bt){var t=yt?Lt<_-U:Lt<=-U,e=yt?Lt>et+U-2*_-1:Lt>=et+U-_;ot&&U&&!yt&&(e=Lt>=et+U-_-1),t&&(Lt+=et),e&&(Lt-=et),o&&(Q.style[o]="0s"),y()}}function E(t){Q.setAttribute("aria-busy","true"),v(t),y(),setTimeout(function(){w(),h(),p(),g(),F(),gt&&c(),xt=!1,Q.setAttribute("aria-busy","false")},ft*t)}function L(t){if(!xt){t=yt?t*_:t;var e=Math.abs(t);Lt=bt?Lt+t:Math.max(0,Math.min(Lt+t,et-_)),E(e)}}function x(){L(-1)}function C(){L(1)}function M(e){if(!xt){for(var n,i=e.target||e.srcElement;gn.indexOf(V,i)===-1;)i=i.parentNode;Et=n=Number(i.getAttribute("data-slide"));var r,o;r=t.navContainer?n:n*_,r=bt?r:Math.min(r,et-_),o=Math.abs(r-Lt),Lt=r,E(o)}}function T(){Mt=setInterval(function(){L(ht)},mt),Tt.setAttribute("data-action","stop"),Tt.innerHTML=""+pt[1],Nt=!0}function N(){clearInterval(Mt),Tt.setAttribute("data-action","start"),Tt.innerHTML=""+pt[0],Nt=!1}function S(){Nt?N():T()}function k(){Nt&&N()}function P(t){t=t||window.event,t.keyCode===l.LEFT?L(-1):t.keyCode===l.RIGHT&&L(1)}function D(t,e){"object"==typeof t&&"object"==typeof e&&t===document.activeElement&&(t.blur(),e.focus())}function W(t){t=t||window.event;var e=t.keyCode,n=document.activeElement;e!==l.LEFT&&e!==l.UP&&e!==l.HOME&&e!==l.PAGEUP||n!==X&&X.disabled!==!0&&D(n,X),e!==l.RIGHT&&e!==l.DOWN&&e!==l.END&&e!==l.PAGEDOWN||n!==K&&K.disabled!==!0&&D(n,K),e!==l.ENTER&&e!==l.SPACE||(n===K?C():x())}function O(t){t=t||window.event;var e=t.keyCode,n=document.activeElement;e!==l.LEFT&&e!==l.PAGEUP||n.getAttribute("data-slide")>0&&D(n,n.previousElementSibling),e!==l.UP&&e!==l.HOME||0!==n.getAttribute("data-slide")&&D(n,V[0]),e!==l.RIGHT&&e!==l.PAGEDOWN||n.getAttribute("data-slide")<$-1&&D(n,n.nextElementSibling),e!==l.DOWN&&e!==l.END||n.getAttribute("data-slide")<$-1&&D(n,V[$-1]),e!==l.ENTER&&e!==l.SPACE||M(t)}function F(){if(gn.isInViewport(Q)){var t=Q.querySelectorAll('[aria-hidden="false"] .tiny-lazy');if(0!==t.length)for(var e=0,n=t.length;e=qt[qt.length-1])e=It[It.length-1];else for(var i=0;i=qt[i]&&n<=qt[i+1]&&(e=It[i]);else e=t.items;return Math.max(Math.min(et,e),1)}}(),jt=function(){var e;return e=ot?!!t.maxContainerWidth&&Math.ceil(t.maxContainerWidth/ot):void 0!==It.length?Math.max.apply(Math,It):t.items,e?Math.min(et,e):e},Rt=function(){return ot?function(){return ot+it}:function(){return(Q.parentNode.offsetWidth+it)/_}}(),Gt=function(){return t.navContainer?function(){return et}:function(){return Math.ceil(et/_)}}(),zt=function(){return bt?function(){return Lt+U}:function(){return Lt}}();return _=Ht(),U=jt(),B=Rt(),$=Gt(),{init:function(){Q.classList.add("tiny-content"),0===Q.id.length?Q.id=z=e():z=Q.id,Z.className="tiny-slider",gn.wrap(Q,Z),navigator.msMaxTouchPoints&&(Z.classList.add("ms-touch"),Z.addEventListener("scroll",q,!1));for(var n=0;n';vt&&(u+='"),u='
'+u+"
",gn.append(Z,u),dt=Z.querySelector(".tiny-nav")}if(V=dt.querySelectorAll("[data-slide]"),Y=V.length,!dt.hasAttribute("aria-label")){dt.setAttribute("aria-label","Carousel Pagination");for(var d=0;d"),ut=Z.querySelector(".tiny-controls")),X=ut.querySelector('[data-controls="prev"]'),K=ut.querySelector('[data-controls="next"]'),ut.hasAttribute("tabindex")||(ut.setAttribute("aria-label","Carousel Navigation"),X.setAttribute("aria-controls",z),K.setAttribute("aria-controls",z),X.setAttribute("tabindex","-1"),K.setAttribute("tabindex","0"))),vt&&(dt||(gn.append(Z,'
"),dt=Z.querySelector(".tiny-nav")),Tt=dt.querySelector("[data-action]")),A(),wt&&(Q.addEventListener("touchstart",I,!1),Q.addEventListener("touchmove",H,!1),Q.addEventListener("touchend",j,!1),Q.addEventListener("touchcancel",j,!1)),at&&(p(),X.addEventListener("click",x,!1),K.addEventListener("click",C,!1),X.addEventListener("keydown",W,!1),K.addEventListener("keydown",W,!1)),st)for(var f=V.length;f--;)V[f].addEventListener("click",M,!1),V[f].addEventListener("keydown",O,!1);if(vt&&(T(),Tt.addEventListener("click",S,!1),at&&(X.addEventListener("click",k,!1),K.addEventListener("click",k,!1)),st))for(var v=0;v=90-e?"horizontal":Math.abs(90-Math.abs(t))<=e&&"vertical"}function r(t){if("object"==typeof t){for(var e=[],n=Object.keys(t),i=0,r=n.length;i=c)for(;c>>0,e[n]=r.join(u),f())},i[S]=function(){v[L](i,t=arguments);for(var t,a={},s=0,c=[];s>>0,e[n]=r.join(u),f()},i[N]=function(e,n){return v[L](i,[e]),t!==n?n?(i[M](e),d):(i[S](e),s):o[e]?(i[S](e),s):(i[M](e),d)},function(t,e){if(e)for(var n=0;n<7;++n)e(t,T[n],{enumerable:s})}(i,a[h]),i},F=function(t,e,n){D(t[P],e,function(){var t,i=this,r=m+h+e;if(i[r])return t;if(i[r]=d,s===k){for(var a,l=F.mirror=F.mirror||o[f](A),u=l.childNodes,c=u[E],v=0;ve[E]&&(n=P[M],i=P[S],P[M]=function(){for(var t=0,e=arguments;t0&&e.right>0&&e.top0?e.cloneNode(!0):e,o=n[i],a=o.parentNode,l=o.nextSibling;r.appendChild(o),l?a.insertBefore(r,l):a.appendChild(r)}},gn.unwrap=function(t){for(var e=gn.isNodeList(t)?t:[t],n=e.length;n--;){for(var i=e[n],r=i.parentNode;i.firstChild;)r.insertBefore(i.firstChild,i);r.removeChild(i)}},gn.getWidth=function(t){var e=/\d/,n=t.clientWidth,i=t.currentStyle||getComputedStyle(t),r=null===e.exec(i.paddingLeft)?"0px":i.paddingLeft,o=null===e.exec(i.paddingRight)?"0px":i.paddingRight;return n-=parseInt(Length.toPx(t,r))+parseInt(Length.toPx(t,o))};var tinySlider=function(){"use strict";function t(t){function d(){Q.style.width=B*nt+"px";var t;t=0!==it&&"marginLeft"===rt?gt?U*B+it:it:U*B,Q.style.marginLeft=-t+"px";for(var e=nt;e--;)tt[e].style.width=B-it+"px",0!==it&&(tt[e].style[rt]=it+"px")}function s(t){return"boolean"==typeof t.complete?t.complete:"number"==typeof t.naturalWidth?0!==t.naturalWidth:void 0}function u(t){for(var e=t.length;e--;)s(t[e])&&t.splice(e,1);0===t.length?f():setTimeout(function(){u(t)},16)}function c(){for(var t=Gt(),e=[],n=nt;n--;)if(n>=t&&n=e&&i=e&&t_?(0===xt?(X.disabled=!0,D(X,V)):X.disabled=!1,xt===et-_?(V.disabled=!0,D(V,X)):V.disabled=!1):(0!==xt&&(xt=0,y()),X.disabled=!0,V.disabled=!0,X.setAttribute("tabindex","-1"),V.setAttribute("tabindex","-1"),X===document.activeElement&&X.blur(),V===document.activeElement&&V.blur()))}function g(){if(st&&!t.navContainer)for(var e=K;e--;){var n=$[e];e=et?xt-et:xt;if(e=t.navContainer?n:Math.floor(n/_),!gt&&!t.navContainer){var i=/^-?[0-9]+$/,r=i.test(et/_);r||xt!==et-_||(e+=1)}}else e=Et,Et=-1;for(var o=Y;o--;){var a=$[o];o===e?"false"===a.getAttribute("aria-selected")&&(a.setAttribute("tabindex","0"),a.setAttribute("aria-selected","true")):"true"===a.getAttribute("aria-selected")&&(a.setAttribute("tabindex","-1"),a.setAttribute("aria-selected","false"))}}}function y(){var t=Q.parentNode.offsetWidth;kt=-B*xt,ot&&!gt&&(kt=Math.max(kt,-Math.abs(et*B-it-t))),a?Q.style[a]="translate3d("+kt+"px, 0, 0)":Q.style.left=kt+"px"}function w(){d(),m(),y(),g(),b(),h(),p(),bt&&c(),wt&&O()}function A(){if(gt){var t=yt?xt<_-U:xt<=-U,e=yt?xt>et+U-2*_-1:xt>=et+U-_;ot&&U&&!yt&&(e=xt>=et+U-_-1),t&&(xt+=et),e&&(xt-=et),o&&(Q.style[o]="0s"),y()}}function E(t){Q.setAttribute("aria-busy","true"),v(t),y(),setTimeout(function(){A(),h(),p(),b(),O(),bt&&c(),Lt=!1,Q.setAttribute("aria-busy","false")},ft*t)}function x(t){if(!Lt){t=yt?t*_:t;var e=Math.abs(t);xt=gt?xt+t:Math.max(0,Math.min(xt+t,et-_)),E(e)}}function L(){x(-1)}function C(){x(1)}function T(e){if(!Lt){for(var n,i=e.target||e.srcElement;gn.indexOf($,i)===-1;)i=i.parentNode;Et=n=Number(i.getAttribute("data-slide"));var r,o;r=t.navContainer?n:n*_,r=gt?r:Math.min(r,et-_),o=Math.abs(r-xt),xt=r,E(o)}}function M(){Tt=setInterval(function(){x(ht)},mt),Mt.setAttribute("data-action","stop"),Mt.innerHTML=""+pt[1],St=!0}function S(){clearInterval(Tt),Mt.setAttribute("data-action","start"),Mt.innerHTML=""+pt[0],St=!1}function N(){St?S():M()}function P(){St&&S()}function k(t){t=t||window.event,t.keyCode===l.LEFT?x(-1):t.keyCode===l.RIGHT&&x(1)}function D(t,e){"object"==typeof t&&"object"==typeof e&&t===document.activeElement&&(t.blur(),e.focus())}function W(t){t=t||window.event;var e=t.keyCode,n=document.activeElement;e!==l.LEFT&&e!==l.UP&&e!==l.HOME&&e!==l.PAGEUP||n!==X&&X.disabled!==!0&&D(n,X),e!==l.RIGHT&&e!==l.DOWN&&e!==l.END&&e!==l.PAGEDOWN||n!==V&&V.disabled!==!0&&D(n,V),e!==l.ENTER&&e!==l.SPACE||(n===V?C():L())}function F(t){t=t||window.event;var e=t.keyCode,n=document.activeElement;e!==l.LEFT&&e!==l.PAGEUP||n.getAttribute("data-slide")>0&&D(n,n.previousElementSibling),e!==l.UP&&e!==l.HOME||0!==n.getAttribute("data-slide")&&D(n,$[0]),e!==l.RIGHT&&e!==l.PAGEDOWN||n.getAttribute("data-slide")=It[It.length-1])e=qt[qt.length-1];else for(var i=0;i=It[i]&&n<=It[i+1]&&(e=qt[i]);else e=t.items;return Math.max(Math.min(et,e),1)}}(),zt=function(){var e;return e=ot?!!t.maxContainerWidth&&Math.ceil(t.maxContainerWidth/ot):void 0!==qt.length?Math.max.apply(Math,qt):t.items,e?Math.min(et,e):e},Rt=function(){return ot?function(){return ot+it}:function(){return(gn.getWidth(Q.parentNode)+it)/_}}(),jt=function(){return t.navContainer?function(){return et}:function(){return Math.ceil(et/_)}}(),Gt=function(){return gt?function(){return xt+U}:function(){return xt}}();return _=Ht(),U=zt(),B=Rt(),Y=jt(),{init:function(){Q.classList.add("tiny-content"),0===Q.id.length?Q.id=G=e():G=Q.id,Z.className="tiny-slider",gn.wrap(Q,Z),navigator.msMaxTouchPoints&&(Z.classList.add("ms-touch"),Z.addEventListener("scroll",I,!1));for(var n=0;n';vt&&(d+='"),d='
'+d+"
",gn.append(Z,d),ut=Z.querySelector(".tiny-nav")}if($=ut.querySelectorAll("[data-slide]"),K=$.length,!ut.hasAttribute("aria-label")){ut.setAttribute("aria-label","Carousel Pagination");for(var u=0;u"),dt=Z.querySelector(".tiny-controls")),X=dt.querySelector('[data-controls="prev"]'),V=dt.querySelector('[data-controls="next"]'),dt.hasAttribute("tabindex")||(dt.setAttribute("aria-label","Carousel Navigation"),X.setAttribute("aria-controls",G),V.setAttribute("aria-controls",G),X.setAttribute("tabindex","-1"),V.setAttribute("tabindex","0"))),vt&&(ut||(gn.append(Z,'
"),ut=Z.querySelector(".tiny-nav")),Mt=ut.querySelector("[data-action]")),w(),At&&(Q.addEventListener("touchstart",q,!1),Q.addEventListener("touchmove",H,!1),Q.addEventListener("touchend",z,!1),Q.addEventListener("touchcancel",z,!1)),at&&(p(),X.addEventListener("click",L,!1),V.addEventListener("click",C,!1),X.addEventListener("keydown",W,!1),V.addEventListener("keydown",W,!1)),st)for(var f=$.length;f--;)$[f].addEventListener("click",T,!1),$[f].addEventListener("keydown",F,!1);if(vt&&(M(),Mt.addEventListener("click",N,!1),at&&(X.addEventListener("click",P,!1),V.addEventListener("click",P,!1)),st))for(var v=0;v=90-e?"horizontal":Math.abs(90-Math.abs(t))<=e&&"vertical"}function r(t){if("object"==typeof t){for(var e=[],n=Object.keys(t),i=0,r=n.length;i=t&&n=e&&i=e&&tX?(0===xt?(K.disabled=!0,W(K,Y)):K.disabled=!1,xt===et-X?(Y.disabled=!0,W(Y,K)):Y.disabled=!1):(0!==xt&&(xt=0,g()),K.disabled=!0,Y.disabled=!0,K.setAttribute("tabindex","-1"),Y.setAttribute("tabindex","-1"),K===document.activeElement&&K.blur(),Y===document.activeElement&&Y.blur()))}function p(){if(dt&&!t.navContainer)for(var e=$;e--;){var n=V[e];e=et?xt-et:xt;if(e=t.navContainer?n:Math.floor(n/X),!pt&&!t.navContainer){var i=/^-?[0-9]+$/,r=i.test(et/X);r||xt!==et-X||(e+=1)}}else e=Lt,Lt=-1;for(var a=J;a--;){var o=V[a];a===e?"false"===o.getAttribute("aria-selected")&&(o.setAttribute("tabindex","0"),o.setAttribute("aria-selected","true")):"true"===o.getAttribute("aria-selected")&&(o.setAttribute("tabindex","-1"),o.setAttribute("aria-selected","false"))}}}function g(){var t=Z.parentNode.offsetWidth;Pt=-U*xt,at&&!pt&&(Pt=Math.max(Pt,-Math.abs(et*U-it-t))),o?Z.style[o]="translate3d("+Pt+"px, 0, 0)":Z.style.left=Pt+"px"}function E(){l(),h(),g(),p(),y(),m(),b(),yt&&c(),Et&&O()}function A(){if(pt){var t=gt?xtet+B-2*X-1:xt>=et+B-X;at&&B&&!gt&&(e=xt>=et+B-X-1),t&&(xt+=et),e&&(xt-=et),a&&(Z.style[a]="0s"),g()}}function L(t){Z.setAttribute("aria-busy","true"),f(t),g(),setTimeout(function(){A(),m(),b(),y(),O(),yt&&c(),wt=!1,Z.setAttribute("aria-busy","false")},vt*t)}function x(t){if(!wt){t=gt?t*X:t;var e=Math.abs(t);xt=pt?xt+t:Math.max(0,Math.min(xt+t,et-X)),L(e)}}function w(){x(-1)}function M(){x(1)}function C(e){if(!wt){for(var n,i=e.target||e.srcElement;gn.indexOf(V,i)===-1;)i=i.parentNode;Lt=n=Number(i.getAttribute("data-slide"));var r,a;r=t.navContainer?n:n*X,r=pt?r:Math.min(r,et-X),a=Math.abs(r-xt),xt=r,L(a)}}function T(){Ct=setInterval(function(){x(mt)},ht),Tt.setAttribute("data-action","stop"),Tt.innerHTML=""+bt[1],kt=!0}function k(){clearInterval(Ct),Tt.setAttribute("data-action","start"),Tt.innerHTML=""+bt[0],kt=!1}function S(){kt?k():T()}function N(){kt&&k()}function P(t){t=t||window.event,t.keyCode===s.LEFT?x(-1):t.keyCode===s.RIGHT&&x(1)}function W(t,e){"object"==typeof t&&"object"==typeof e&&t===document.activeElement&&(t.blur(),e.focus())}function D(t){t=t||window.event;var e=t.keyCode,n=document.activeElement;e!==s.LEFT&&e!==s.UP&&e!==s.HOME&&e!==s.PAGEUP||n!==K&&K.disabled!==!0&&W(n,K),e!==s.RIGHT&&e!==s.DOWN&&e!==s.END&&e!==s.PAGEDOWN||n!==Y&&Y.disabled!==!0&&W(n,Y),e!==s.ENTER&&e!==s.SPACE||(n===Y?M():w())}function I(t){t=t||window.event;var e=t.keyCode,n=document.activeElement;e!==s.LEFT&&e!==s.PAGEUP||n.getAttribute("data-slide")>0&&W(n,n.previousElementSibling),e!==s.UP&&e!==s.HOME||0!==n.getAttribute("data-slide")&&W(n,V[0]),e!==s.RIGHT&&e!==s.PAGEDOWN||n.getAttribute("data-slide")=Ht[Ht.length-1])e=qt[qt.length-1];else for(var i=0;i=Ht[i]&&n<=Ht[i+1]&&(e=qt[i]);else e=t.items;return Math.max(Math.min(et,e),1)}}(),zt=function(){var e;return e=at?!!t.maxContainerWidth&&Math.ceil(t.maxContainerWidth/at):void 0!==qt.length?Math.max.apply(Math,qt):t.items,e?Math.min(et,e):e},Rt=function(){return at?function(){return at+it}:function(){return(Z.parentNode.offsetWidth+it)/X}}(),jt=function(){return t.navContainer?function(){return et}:function(){return Math.ceil(et/X)}}(),Ft=function(){return pt?function(){return xt+B}:function(){return xt}}();return X=Gt(),B=zt(),U=Rt(),J=jt(),{init:function(){Z.classList.add("tiny-content"),0===Z.id.length?Z.id=F=e():F=Z.id,_.className="tiny-slider",gn.wrap(Z,_),navigator.msMaxTouchPoints&&(_.classList.add("ms-touch"),_.addEventListener("scroll",H,!1));for(var n=0;n';ft&&(l+='"),l='
'+l+"
",gn.append(_,l),ut=_.querySelector(".tiny-nav")}if(V=ut.querySelectorAll("[data-slide]"),$=V.length,!ut.hasAttribute("aria-label")){ut.setAttribute("aria-label","Carousel Pagination");for(var u=0;u<$;u++){var c=V[u];c.setAttribute("tabindex","-1"),c.setAttribute("aria-selected","false"),c.setAttribute("aria-controls",F+"item"+u)}}}if(ot&&(t.controlsContainer||(gn.append(_,'
"),lt=_.querySelector(".tiny-controls")),K=lt.querySelector('[data-controls="prev"]'),Y=lt.querySelector('[data-controls="next"]'),lt.hasAttribute("tabindex")||(lt.setAttribute("aria-label","Carousel Navigation"),K.setAttribute("aria-controls",F),Y.setAttribute("aria-controls",F),K.setAttribute("tabindex","-1"),Y.setAttribute("tabindex","0"))),ft&&(ut||(gn.append(_,'
"),ut=_.querySelector(".tiny-nav")),Tt=ut.querySelector("[data-action]")),E(),At&&(Z.addEventListener("touchstart",q,!1),Z.addEventListener("touchmove",G,!1),Z.addEventListener("touchend",z,!1),Z.addEventListener("touchcancel",z,!1)),ot&&(b(),K.addEventListener("click",w,!1),Y.addEventListener("click",M,!1),K.addEventListener("keydown",D,!1),Y.addEventListener("keydown",D,!1)),dt)for(var v=V.length;v--;)V[v].addEventListener("click",C,!1),V[v].addEventListener("keydown",I,!1);if(ft&&(T(),Tt.addEventListener("click",S,!1),ot&&(K.addEventListener("click",N,!1),Y.addEventListener("click",N,!1)),dt))for(var f=0;f<$;f++)V[f].addEventListener("click",N,!1);ct&&document.addEventListener("keydown",P,!1),window.addEventListener("resize",R,!1),window.addEventListener("scroll",j,!1)},destory:function(){if(Z.classList.remove("tiny-content"),Z.style.width="",Z.style[a]="",Z.style.transform="",Z.style.marginLeft="",Z.style.left="",gn.unwrap(_),pt)for(var e=B;e--;)tt[0].remove(),tt[tt.length-1].remove();if(void 0!==F){F=null,Z.removeAttribute("id");for(var n=et;n--;)tt[n].removeAttribute("id"),tt[n].removeAttribute("aria-hidden"),tt[n].style.width=""}if(At&&(Z.removeEventListener("touchstart",q,!1),Z.removeEventListener("touchmove",G,!1),Z.removeEventListener("touchend",z,!1),Z.removeEventListener("touchcancel",z,!1)),ot&&(t.controlsContainer?(lt.removeAttribute("aria-label"),K.removeAttribute("aria-controls"),K.removeAttribute("tabindex"),K.removeEventListener("click",w,!1),K.removeEventListener("keydown",D,!1),Y.removeAttribute("aria-controls"),Y.removeAttribute("tabindex"),Y.removeEventListener("click",M,!1),Y.removeEventListener("keydown",D,!1)):(lt.remove(),lt=null,K=null,Y=null)),dt){if(t.navContainer){ut.removeAttribute("aria-label");for(var i=V.length;i--;)V[i].removeAttribute("aria-selected"),V[i].removeAttribute("aria-controls"),V[i].removeEventListener("click",C,!1),V[i].removeEventListener("keydown",I,!1)}else ut.remove(),ut=null;V=null,$=null}if(ft)if(t.navContainer||null===ut){if(Tt.removeEventListener("click",S,!1),Tt=null,ot&&t.controlsContainer&&(K.removeEventListener("click",N,!1),Y.removeEventListener("click",N,!1)),dt&&t.navContainer)for(var r=0;r<$;r++)V[r].removeEventListener("click",N,!1)}else ut.remove(),ut=null;ct&&document.removeEventListener("keydown",ct,!1),window.removeEventListener("resize",R,!1),window.removeEventListener("scroll",j,!1)}}}function e(){return void 0===window.tinySliderNumber?window.tinySliderNumber=1:window.tinySliderNumber++,"tinySlider"+window.tinySliderNumber}function n(t){return t*(180/Math.PI)}function i(t,e){return Math.abs(90-Math.abs(t))>=90-e?"horizontal":Math.abs(90-Math.abs(t))<=e&&"vertical"}function r(t){if("object"==typeof t){for(var e=[],n=Object.keys(t),i=0,r=n.length;i=t&&n=e&&i=e&&tX?(0===xt?(K.disabled=!0,W(K,Y)):K.disabled=!1,xt===et-X?(Y.disabled=!0,W(Y,K)):Y.disabled=!1):(0!==xt&&(xt=0,g()),K.disabled=!0,Y.disabled=!0,K.setAttribute("tabindex","-1"),Y.setAttribute("tabindex","-1"),K===document.activeElement&&K.blur(),Y===document.activeElement&&Y.blur()))}function p(){if(dt&&!t.navContainer)for(var e=$;e--;){var n=V[e];e=et?xt-et:xt;if(e=t.navContainer?n:Math.floor(n/X),!pt&&!t.navContainer){var i=/^-?[0-9]+$/,r=i.test(et/X);r||xt!==et-X||(e+=1)}}else e=Lt,Lt=-1;for(var a=J;a--;){var o=V[a];a===e?"false"===o.getAttribute("aria-selected")&&(o.setAttribute("tabindex","0"),o.setAttribute("aria-selected","true")):"true"===o.getAttribute("aria-selected")&&(o.setAttribute("tabindex","-1"),o.setAttribute("aria-selected","false"))}}}function g(){var t=Z.parentNode.offsetWidth;Pt=-U*xt,at&&!pt&&(Pt=Math.max(Pt,-Math.abs(et*U-it-t))),o?Z.style[o]="translate3d("+Pt+"px, 0, 0)":Z.style.left=Pt+"px"}function E(){l(),h(),g(),p(),y(),m(),b(),yt&&c(),Et&&O()}function A(){if(pt){var t=gt?xtet+B-2*X-1:xt>=et+B-X;at&&B&&!gt&&(e=xt>=et+B-X-1),t&&(xt+=et),e&&(xt-=et),a&&(Z.style[a]="0s"),g()}}function L(t){Z.setAttribute("aria-busy","true"),f(t),g(),setTimeout(function(){A(),m(),b(),y(),O(),yt&&c(),wt=!1,Z.setAttribute("aria-busy","false")},vt*t)}function x(t){if(!wt){t=gt?t*X:t;var e=Math.abs(t);xt=pt?xt+t:Math.max(0,Math.min(xt+t,et-X)),L(e)}}function w(){x(-1)}function M(){x(1)}function C(e){if(!wt){for(var n,i=e.target||e.srcElement;gn.indexOf(V,i)===-1;)i=i.parentNode;Lt=n=Number(i.getAttribute("data-slide"));var r,a;r=t.navContainer?n:n*X,r=pt?r:Math.min(r,et-X),a=Math.abs(r-xt),xt=r,L(a)}}function T(){Ct=setInterval(function(){x(mt)},ht),Tt.setAttribute("data-action","stop"),Tt.innerHTML=""+bt[1],kt=!0}function k(){clearInterval(Ct),Tt.setAttribute("data-action","start"),Tt.innerHTML=""+bt[0],kt=!1}function S(){kt?k():T()}function N(){kt&&k()}function P(t){t=t||window.event,t.keyCode===s.LEFT?x(-1):t.keyCode===s.RIGHT&&x(1)}function W(t,e){"object"==typeof t&&"object"==typeof e&&t===document.activeElement&&(t.blur(),e.focus())}function D(t){t=t||window.event;var e=t.keyCode,n=document.activeElement;e!==s.LEFT&&e!==s.UP&&e!==s.HOME&&e!==s.PAGEUP||n!==K&&K.disabled!==!0&&W(n,K),e!==s.RIGHT&&e!==s.DOWN&&e!==s.END&&e!==s.PAGEDOWN||n!==Y&&Y.disabled!==!0&&W(n,Y),e!==s.ENTER&&e!==s.SPACE||(n===Y?M():w())}function I(t){t=t||window.event;var e=t.keyCode,n=document.activeElement;e!==s.LEFT&&e!==s.PAGEUP||n.getAttribute("data-slide")>0&&W(n,n.previousElementSibling),e!==s.UP&&e!==s.HOME||0!==n.getAttribute("data-slide")&&W(n,V[0]),e!==s.RIGHT&&e!==s.PAGEDOWN||n.getAttribute("data-slide")=Ht[Ht.length-1])e=qt[qt.length-1];else for(var i=0;i=Ht[i]&&n<=Ht[i+1]&&(e=qt[i]);else e=t.items;return Math.max(Math.min(et,e),1)}}(),zt=function(){var e;return e=at?!!t.maxContainerWidth&&Math.ceil(t.maxContainerWidth/at):void 0!==qt.length?Math.max.apply(Math,qt):t.items,e?Math.min(et,e):e},Rt=function(){return at?function(){return at+it}:function(){return(gn.getWidth(Z.parentNode)+it)/X}}(),jt=function(){return t.navContainer?function(){return et}:function(){return Math.ceil(et/X)}}(),Ft=function(){return pt?function(){return xt+B}:function(){return xt}}();return X=Gt(),B=zt(),U=Rt(),J=jt(),{init:function(){Z.classList.add("tiny-content"),0===Z.id.length?Z.id=F=e():F=Z.id,_.className="tiny-slider",gn.wrap(Z,_),navigator.msMaxTouchPoints&&(_.classList.add("ms-touch"),_.addEventListener("scroll",H,!1));for(var n=0;n';ft&&(l+='"),l='
'+l+"
",gn.append(_,l),ut=_.querySelector(".tiny-nav")}if(V=ut.querySelectorAll("[data-slide]"),$=V.length,!ut.hasAttribute("aria-label")){ut.setAttribute("aria-label","Carousel Pagination");for(var u=0;u<$;u++){var c=V[u];c.setAttribute("tabindex","-1"),c.setAttribute("aria-selected","false"),c.setAttribute("aria-controls",F+"item"+u)}}}if(ot&&(t.controlsContainer||(gn.append(_,'
"),lt=_.querySelector(".tiny-controls")),K=lt.querySelector('[data-controls="prev"]'),Y=lt.querySelector('[data-controls="next"]'),lt.hasAttribute("tabindex")||(lt.setAttribute("aria-label","Carousel Navigation"),K.setAttribute("aria-controls",F),Y.setAttribute("aria-controls",F),K.setAttribute("tabindex","-1"),Y.setAttribute("tabindex","0"))),ft&&(ut||(gn.append(_,'
"),ut=_.querySelector(".tiny-nav")),Tt=ut.querySelector("[data-action]")),E(),At&&(Z.addEventListener("touchstart",q,!1),Z.addEventListener("touchmove",G,!1),Z.addEventListener("touchend",z,!1),Z.addEventListener("touchcancel",z,!1)),ot&&(b(),K.addEventListener("click",w,!1),Y.addEventListener("click",M,!1),K.addEventListener("keydown",D,!1),Y.addEventListener("keydown",D,!1)),dt)for(var v=V.length;v--;)V[v].addEventListener("click",C,!1),V[v].addEventListener("keydown",I,!1);if(ft&&(T(),Tt.addEventListener("click",S,!1),ot&&(K.addEventListener("click",N,!1),Y.addEventListener("click",N,!1)),dt))for(var f=0;f<$;f++)V[f].addEventListener("click",N,!1);ct&&document.addEventListener("keydown",P,!1),window.addEventListener("resize",R,!1),window.addEventListener("scroll",j,!1)},destory:function(){if(Z.classList.remove("tiny-content"),Z.style.width="",Z.style[a]="",Z.style.transform="",Z.style.marginLeft="",Z.style.left="",gn.unwrap(_),pt)for(var e=B;e--;)tt[0].remove(),tt[tt.length-1].remove();if(void 0!==F){F=null,Z.removeAttribute("id");for(var n=et;n--;)tt[n].removeAttribute("id"),tt[n].removeAttribute("aria-hidden"),tt[n].style.width=""}if(At&&(Z.removeEventListener("touchstart",q,!1),Z.removeEventListener("touchmove",G,!1),Z.removeEventListener("touchend",z,!1),Z.removeEventListener("touchcancel",z,!1)),ot&&(t.controlsContainer?(lt.removeAttribute("aria-label"),K.removeAttribute("aria-controls"),K.removeAttribute("tabindex"),K.removeEventListener("click",w,!1),K.removeEventListener("keydown",D,!1),Y.removeAttribute("aria-controls"),Y.removeAttribute("tabindex"),Y.removeEventListener("click",M,!1),Y.removeEventListener("keydown",D,!1)):(lt.remove(),lt=null,K=null,Y=null)),dt){if(t.navContainer){ut.removeAttribute("aria-label");for(var i=V.length;i--;)V[i].removeAttribute("aria-selected"),V[i].removeAttribute("aria-controls"),V[i].removeEventListener("click",C,!1),V[i].removeEventListener("keydown",I,!1)}else ut.remove(),ut=null;V=null,$=null}if(ft)if(t.navContainer||null===ut){if(Tt.removeEventListener("click",S,!1),Tt=null,ot&&t.controlsContainer&&(K.removeEventListener("click",N,!1),Y.removeEventListener("click",N,!1)),dt&&t.navContainer)for(var r=0;r<$;r++)V[r].removeEventListener("click",N,!1)}else ut.remove(),ut=null;ct&&document.removeEventListener("keydown",ct,!1),window.removeEventListener("resize",R,!1),window.removeEventListener("scroll",j,!1)}}}function e(){return void 0===window.tinySliderNumber?window.tinySliderNumber=1:window.tinySliderNumber++,"tinySlider"+window.tinySliderNumber}function n(t){return t*(180/Math.PI)}function i(t,e){return Math.abs(90-Math.abs(t))>=90-e?"horizontal":Math.abs(90-Math.abs(t))<=e&&"vertical"}function r(t){if("object"==typeof t){for(var e=[],n=Object.keys(t),i=0,r=n.length;i