diff --git a/ajax/libs/swipe/2.0/swipe.min.js b/ajax/libs/swipe/2.0/swipe.min.js index e15c930d9..2d90b783e 100644 --- a/ajax/libs/swipe/2.0/swipe.min.js +++ b/ajax/libs/swipe/2.0/swipe.min.js @@ -1 +1 @@ -function Swipe(n,t){"use strict";function e(){w=x.children,p=w.length,2>w.length&&(t.continuous=!1),f.transitions&&t.continuous&&3>w.length&&(x.appendChild(w[0].cloneNode(!0)),x.appendChild(x.children[1].cloneNode(!0)),w=x.children),E=Array(w.length),m=n.getBoundingClientRect().width||n.offsetWidth,x.style.width=w.length*m+"px";for(var e=w.length;e--;){var i=w[e];i.style.width=m+"px",i.setAttribute("data-index",e),f.transitions&&(i.style.left=e*-m+"px",a(e,b>e?-m:e>b?m:0,0))}t.continuous&&f.transitions&&(a(s(b-1),-m,0),a(s(b+1),m,0)),f.transitions||(x.style.left=b*-m+"px"),n.style.visibility="visible"}function i(){t.continuous?r(b-1):b&&r(b-1)}function o(){t.continuous?r(b+1):w.length-1>b&&r(b+1)}function s(n){return(w.length+n%w.length)%w.length}function r(n,e){if(b!=n){if(f.transitions){var i=Math.abs(b-n)/(b-n);if(t.continuous){var o=i;i=-E[s(n)]/m,i!==o&&(n=-i*w.length+n)}for(var r=Math.abs(b-n)-1;r--;)a(s((n>b?n:b)-r-1),m*i,0);n=s(n),a(b,m*i,e||g),a(n,0,e||g),t.continuous&&a(s(n-i),-(m*i),0)}else n=s(n),c(b*-m,n*-m,e||g);b=n,h(t.callback&&t.callback(b,w[b]))}}function a(n,t,e){u(n,t,e),E[n]=t}function u(n,t,e){var i=w[n],o=i&&i.style;o&&(o.webkitTransitionDuration=o.MozTransitionDuration=o.msTransitionDuration=o.OTransitionDuration=o.transitionDuration=e+"ms",o.webkitTransform="translate("+t+"px,0)"+"translateZ(0)",o.msTransform=o.MozTransform=o.OTransform="translateX("+t+"px)")}function c(n,e,i){if(!i)return x.style.left=e+"px",void 0;var o=+new Date,s=setInterval(function(){var r=+new Date-o;return r>i?(x.style.left=e+"px",L&&d(),t.transitionEnd&&t.transitionEnd.call(event,b,w[b]),clearInterval(s),void 0):(x.style.left=(e-n)*(Math.floor(100*(r/i))/100)+n+"px",void 0)},4)}function d(){T=setTimeout(o,L)}function l(){L=0,clearTimeout(T)}var v=function(){},h=function(n){setTimeout(n||v,0)},f={addEventListener:!!window.addEventListener,touch:"ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch,transitions:function(n){var t=["transitionProperty","WebkitTransition","MozTransition","OTransition","msTransition"];for(var e in t)if(void 0!==n.style[t[e]])return!0;return!1}(document.createElement("swipe"))};if(n){var w,E,m,p,x=n.children[0];t=t||{};var b=parseInt(t.startSlide,10)||0,g=t.speed||300;t.continuous=void 0!==t.continuous?t.continuous:!0;var T,y,L=t.auto||0,k={},D={},M={handleEvent:function(n){switch(n.type){case"touchstart":this.start(n);break;case"touchmove":this.move(n);break;case"touchend":h(this.end(n));break;case"webkitTransitionEnd":case"msTransitionEnd":case"oTransitionEnd":case"otransitionend":case"transitionend":h(this.transitionEnd(n));break;case"resize":h(e.call())}t.stopPropagation&&n.stopPropagation()},start:function(n){var t=n.touches[0];k={x:t.pageX,y:t.pageY,time:+new Date},y=void 0,D={},x.addEventListener("touchmove",this,!1),x.addEventListener("touchend",this,!1)},move:function(n){if(!(n.touches.length>1||n.scale&&1!==n.scale)){t.disableScroll&&n.preventDefault();var e=n.touches[0];D={x:e.pageX-k.x,y:e.pageY-k.y},y===void 0&&(y=!!(y||Math.abs(D.x)0||b==w.length-1&&0>D.x?Math.abs(D.x)/m+1:1),u(b-1,D.x+E[b-1],0),u(b,D.x+E[b],0),u(b+1,D.x+E[b+1],0)))}},end:function(){var n=+new Date-k.time,e=250>Number(n)&&Math.abs(D.x)>20||Math.abs(D.x)>m/2,i=!b&&D.x>0||b==w.length-1&&0>D.x;t.continuous&&(i=!1);var o=0>D.x;y||(e&&!i?(o?(t.continuous?(a(s(b-1),-m,0),a(s(b+2),m,0)):a(b-1,-m,0),a(b,E[b]-m,g),a(s(b+1),E[s(b+1)]-m,g),b=s(b+1)):(t.continuous?(a(s(b+1),m,0),a(s(b-2),-m,0)):a(b+1,m,0),a(b,E[b]+m,g),a(s(b-1),E[s(b-1)]+m,g),b=s(b-1)),t.callback&&t.callback(b,w[b])):t.continuous?(a(s(b-1),-m,g),a(b,0,g),a(s(b+1),m,g)):(a(b-1,-m,g),a(b,0,g),a(b+1,m,g))),x.removeEventListener("touchmove",M,!1),x.removeEventListener("touchend",M,!1)},transitionEnd:function(n){parseInt(n.target.getAttribute("data-index"),10)==b&&(L&&d(),t.transitionEnd&&t.transitionEnd.call(n,b,w[b]))}};return e(),L&&d(),f.addEventListener?(f.touch&&x.addEventListener("touchstart",M,!1),f.transitions&&(x.addEventListener("webkitTransitionEnd",M,!1),x.addEventListener("msTransitionEnd",M,!1),x.addEventListener("oTransitionEnd",M,!1),x.addEventListener("otransitionend",M,!1),x.addEventListener("transitionend",M,!1)),window.addEventListener("resize",M,!1)):window.onresize=function(){e()},{setup:function(){e()},slide:function(n,t){l(),r(n,t)},prev:function(){l(),i()},next:function(){l(),o()},getPos:function(){return b},getNumSlides:function(){return p},kill:function(){l(),x.style.width="auto",x.style.left=0;for(var n=w.length;n--;){var t=w[n];t.style.width="100%",t.style.left=0,f.transitions&&u(n,0,0)}f.addEventListener?(x.removeEventListener("touchstart",M,!1),x.removeEventListener("webkitTransitionEnd",M,!1),x.removeEventListener("msTransitionEnd",M,!1),x.removeEventListener("oTransitionEnd",M,!1),x.removeEventListener("otransitionend",M,!1),x.removeEventListener("transitionend",M,!1),window.removeEventListener("resize",M,!1)):window.onresize=null}}}}(window.jQuery||window.Zepto)&&function(n){n.fn.Swipe=function(t){return this.each(function(){n(this).data("Swipe",new Swipe(n(this)[0],t))})}}(window.jQuery||window.Zepto); \ No newline at end of file +function Swipe(t,n){"use strict";function e(){h=E.children,w=Array(h.length),m=t.getBoundingClientRect().width||t.offsetWidth,E.style.width=h.length*m+"px";for(var n=h.length;n--;){var e=h[n];e.style.width=m+"px",e.setAttribute("data-index",n),f.transitions&&(e.style.left=n*-m+"px",a(n,b>n?-m:n>b?m:0,0))}f.transitions||(E.style.left=b*-m+"px"),t.style.visibility="visible"}function i(){b?r(b-1):n.continuous&&r(h.length-1)}function o(){h.length-1>b?r(b+1):n.continuous&&r(0)}function r(t,e){if(b!=t){if(f.transitions){for(var i=Math.abs(b-t)-1,o=Math.abs(b-t)/(b-t);i--;)a((t>b?t:b)-i-1,m*o,0);a(b,m*o,e||T),a(t,0,e||T)}else d(b*-m,t*-m,e||T);b=t,v(n.callback&&n.callback(b,h[b]))}}function a(t,n,e){s(t,n,e),w[t]=n}function s(t,n,e){var i=h[t],o=i&&i.style;o&&(o.webkitTransitionDuration=o.MozTransitionDuration=o.msTransitionDuration=o.OTransitionDuration=o.transitionDuration=e+"ms",o.webkitTransform="translate("+n+"px,0)"+"translateZ(0)",o.msTransform=o.MozTransform=o.OTransform="translateX("+n+"px)")}function d(t,e,i){if(!i)return E.style.left=e+"px",void 0;var o=+new Date,r=setInterval(function(){var a=+new Date-o;return a>i?(E.style.left=e+"px",y&&c(),n.transitionEnd&&n.transitionEnd.call(event,b,h[b]),clearInterval(r),void 0):(E.style.left=(e-t)*(Math.floor(100*(a/i))/100)+t+"px",void 0)},4)}function c(){p=setTimeout(o,y)}function u(){y=0,clearTimeout(p)}var l=function(){},v=function(t){setTimeout(t||l,0)},f={addEventListener:!!window.addEventListener,touch:"ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch,transitions:function(t){var n=["transformProperty","WebkitTransform","MozTransform","OTransform","msTransform"];for(var e in n)if(void 0!==t.style[n[e]])return!0;return!1}(document.createElement("swipe"))};if(t){var h,w,m,E=t.children[0];n=n||{};var p,x,b=parseInt(n.startSlide,10)||0,T=n.speed||300,y=n.auto||0,L={},g={},k={handleEvent:function(t){switch(t.type){case"touchstart":this.start(t);break;case"touchmove":this.move(t);break;case"touchend":v(this.end(t));break;case"webkitTransitionEnd":case"msTransitionEnd":case"oTransitionEnd":case"otransitionend":case"transitionend":v(this.transitionEnd(t));break;case"resize":v(e.call())}n.stopPropagation&&t.stopPropagation()},start:function(t){var n=t.touches[0];L={x:n.pageX,y:n.pageY,time:+new Date},x=void 0,g={},E.addEventListener("touchmove",this,!1),E.addEventListener("touchend",this,!1)},move:function(t){if(!(t.touches.length>1||t.scale&&1!==t.scale)){n.disableScroll&&t.preventDefault();var e=t.touches[0];g={x:e.pageX-L.x,y:e.pageY-L.y},x===void 0&&(x=!!(x||Math.abs(g.x)0||b==h.length-1&&0>g.x?Math.abs(g.x)/m+1:1),s(b-1,g.x+w[b-1],0),s(b,g.x+w[b],0),s(b+1,g.x+w[b+1],0))}},end:function(){var t=+new Date-L.time,e=250>Number(t)&&Math.abs(g.x)>20||Math.abs(g.x)>m/2,i=!b&&g.x>0||b==h.length-1&&0>g.x,o=0>g.x;x||(e&&!i?(o?(a(b-1,-m,0),a(b,w[b]-m,T),a(b+1,w[b+1]-m,T),b+=1):(a(b+1,m,0),a(b,w[b]+m,T),a(b-1,w[b-1]+m,T),b+=-1),n.callback&&n.callback(b,h[b])):(a(b-1,-m,T),a(b,0,T),a(b+1,m,T))),E.removeEventListener("touchmove",k,!1),E.removeEventListener("touchend",k,!1)},transitionEnd:function(t){parseInt(t.target.getAttribute("data-index"),10)==b&&(y&&c(),n.transitionEnd&&n.transitionEnd.call(t,b,h[b]))}};return e(),y&&c(),f.addEventListener?(f.touch&&E.addEventListener("touchstart",k,!1),f.transitions&&(E.addEventListener("webkitTransitionEnd",k,!1),E.addEventListener("msTransitionEnd",k,!1),E.addEventListener("oTransitionEnd",k,!1),E.addEventListener("otransitionend",k,!1),E.addEventListener("transitionend",k,!1)),window.addEventListener("resize",k,!1)):window.onresize=function(){e()},{setup:function(){e()},slide:function(t,n){r(t,n)},prev:function(){u(),i()},next:function(){u(),o()},getPos:function(){return b},kill:function(){u(),E.style.width="auto",E.style.left=0;for(var t=h.length;t--;){var n=h[t];n.style.width="100%",n.style.left=0,f.transitions&&s(t,0,0)}f.addEventListener?(E.removeEventListener("touchstart",k,!1),E.removeEventListener("webkitTransitionEnd",k,!1),E.removeEventListener("msTransitionEnd",k,!1),E.removeEventListener("oTransitionEnd",k,!1),E.removeEventListener("otransitionend",k,!1),E.removeEventListener("transitionend",k,!1),window.removeEventListener("resize",k,!1)):window.onresize=null}}}}(window.jQuery||window.Zepto)&&function(t){t.fn.Swipe=function(n){return this.each(function(){t(this).data("Swipe",new Swipe(t(this)[0],n))})}}(window.jQuery||window.Zepto); \ No newline at end of file