Socket
Socket
Sign inDemoInstall

swipejs

Package Overview
Dependencies
26
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.2.16 to 2.2.17

2

build/swipe.min.js

@@ -1,1 +0,1 @@

!function(t,e){"function"==typeof define&&define.amd?define([],function(){return t.Swipe=e(),t.Swipe}):"object"==typeof module&&module.exports?module.exports=e():t.Swipe=e()}(this,function(){var e,Q="object"==typeof self&&self.self===self&&self||"object"==typeof global&&global.global===global&&global||this,W=Q.document;function Swipe(s,a){"use strict";function e(){}function n(t){return!!t&&("boolean"!=typeof t.cancelable||t.cancelable)}var u,t,l={},c={},v=(a=a||{}).auto||0,i=!1,r=function(t){setTimeout(t||e,0)};Element.prototype.matches||(Element.prototype.matches=Element.prototype.matchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.oMatchesSelector||Element.prototype.webkitMatchesSelector||function(t){for(var e=(this.document||this.ownerDocument).querySelectorAll(t),n=e.length;0<=--n&&e.item(n)!==this;);return-1<n});var d={addEventListener:!!Q.addEventListener,passiveEvents:function(){var e=!1;try{var t=Object.defineProperty({},"passive",{get:function(){e=!0}});Q.addEventListener("testEvent",null,t),Q.removeEventListener("testEvent",null,t)}catch(t){e=!1}return e}(),touch:"ontouchstart"in Q||Q.DocumentTouch&&W instanceof DocumentTouch,transitions:function(t){var e=["transitionProperty","WebkitTransition","MozTransition","OTransition","msTransition"];for(var n in e)if(void 0!==t.style[e[n]])return!0;return!1}(W.createElement("swipe"))};if(s){var f,m,h,p,E=s.children[0],y=parseInt(a.startSlide,10)||0,g=a.speed||300;a.continuous=void 0===a.continuous||a.continuous;var o,b,T=(o="direction",s.currentStyle?b=s.currentStyle[o]:Q.getComputedStyle&&(b=Q.getComputedStyle(s,null).getPropertyValue(o)),"rtl"===b?"right":"left");a.autoRestart=void 0!==a.autoRestart&&a.autoRestart;var x=function(n,i){i=i||100;var o=null;function r(){o&&clearTimeout(o)}function t(){var t=this,e=arguments;r(),o=setTimeout(function(){o=null,n.apply(t,e)},i)}return t.cancel=r,t}(S),L={handleEvent:function(t){if(!i){switch(t.type){case"mousedown":case"touchstart":this.start(t);break;case"mousemove":case"touchmove":this.move(t);break;case"mouseup":case"mouseleave":case"touchend":this.end(t);break;case"webkitTransitionEnd":case"msTransitionEnd":case"oTransitionEnd":case"otransitionend":case"transitionend":this.transitionEnd(t);break;case"resize":x()}a.stopPropagation&&t.stopPropagation()}},start:function(t){var e,n,i;X(t)?(e=t).preventDefault():e=t.touches[0],a.ignore&&e.target.matches(a.ignore)||(l={x:e.pageX,y:e.pageY,time:+new Date},u=void 0,c={},X(t)?(E.addEventListener("mousemove",this,!1),E.addEventListener("mouseup",this,!1),E.addEventListener("mouseleave",this,!1)):(E.addEventListener("touchmove",this,!!d.passiveEvents&&{passive:!1}),E.addEventListener("touchend",this,!1)),n=j(),i=f[y],a.dragStart&&a.dragStart(n,i))},move:function(t){var e;if(X(t))e=t;else{if(1<t.touches.length||t.scale&&1!==t.scale)return;a.disableScroll&&n(t)&&t.preventDefault(),e=t.touches[0]}c={x:e.pageX-l.x,y:e.pageY-l.y},void 0===u&&(u=!!(u||Math.abs(c.x)<Math.abs(c.y))),u||(n(t)&&t.preventDefault(),I(),a.continuous?(R(A(y-1),c.x+m[A(y-1)],0),R(y,c.x+m[y],0),R(A(y+1),c.x+m[A(y+1)],0)):(c.x=c.x/(!y&&0<c.x||y===f.length-1&&c.x<0?Math.abs(c.x)/h+1:1),R(y-1,c.x+m[y-1],0),R(y,c.x+m[y],0),R(y+1,c.x+m[y+1],0)))},end:function(t){var e=new Date-l.time,n=Number(e)<250&&20<Math.abs(c.x)||Math.abs(c.x)>h/2,i=!y&&0<c.x||y===f.length-1&&c.x<0;a.continuous&&(i=!1);var o,r,s=Math.abs(c.x)/c.x;u||(n&&!i?(y=s<0?(a.continuous?(P(A(y-1),-h,0),P(A(y+2),h,0)):P(y-1,-h,0),P(y,m[y]-h,g),P(A(y+1),m[A(y+1)]-h,g),A(y+1)):(a.continuous?(P(A(y+1),h,0),P(A(y-2),-h,0)):P(y+1,h,0),P(y,m[y]+h,g),P(A(y-1),m[A(y-1)]+h,g),A(y-1)),k(j(),f[y],s)):a.continuous?(P(A(y-1),-h,g),P(y,0,g),P(A(y+1),h,g)):(P(y-1,-h,g),P(y,0,g),P(y+1,h,g))),X(t)?(E.removeEventListener("mousemove",L,!1),E.removeEventListener("mouseup",L,!1),E.removeEventListener("mouseleave",L,!1)):(E.removeEventListener("touchmove",L,!!d.passiveEvents&&{passive:!1}),E.removeEventListener("touchend",L,!1)),o=j(),r=f[y],a.dragEnd&&a.dragEnd(o,r)},transitionEnd:function(t){parseInt(t.target.getAttribute("data-index"),10)===y&&((v||a.autoRestart)&&N(),z(j(),f[y]))}};return S(),C(),{setup:S,slide:function(t,e){I(),O(t,e)},prev:function(){I(),function(){if(i)return;(a.continuous||y)&&O(y-1)}()},next:function(){I(),M()},restart:N,stop:I,getPos:j,disable:function(){I(),i=!0},enable:function(){i=!1,N()},getNumSlides:function(){return p},kill:function(){I(),s.style.visibility="",E.style.width="",E.style[T]="";var t=f.length;for(;t--;){d.transitions&&R(t,0,0);var e=f[t];if(e.getAttribute("data-cloned"))e.parentElement.removeChild(e);e.style.width="",e.style[T]="",e.style.webkitTransitionDuration=e.style.MozTransitionDuration=e.style.msTransitionDuration=e.style.OTransitionDuration=e.style.transitionDuration="",e.style.webkitTransform=e.style.msTransform=e.style.MozTransform=e.style.OTransform=""}w(),x.cancel()}}}function w(){d.addEventListener?(E.removeEventListener("touchstart",L,!!d.passiveEvents&&{passive:!0}),E.removeEventListener("mousedown",L,!1),E.removeEventListener("webkitTransitionEnd",L,!1),E.removeEventListener("msTransitionEnd",L,!1),E.removeEventListener("oTransitionEnd",L,!1),E.removeEventListener("otransitionend",L,!1),E.removeEventListener("transitionend",L,!1),Q.removeEventListener("resize",L,!1)):Q.onresize=null}function D(t){var e=t.cloneNode(!0);E.appendChild(e),e.setAttribute("data-cloned",!0),e.removeAttribute("id")}function S(t){if(null!=t)for(var e in t)a[e]=t[e];f=E.children,p=f.length;for(var n=0;n<f.length;n++)f[n].getAttribute("data-cloned")&&p--;if(f.length<2&&(a.continuous=!1),d.transitions&&a.continuous&&f.length<3&&(D(f[0]),D(f[1]),f=E.children),"right"===T)for(var i=0;i<f.length;i++)f[i].style.float="right";m=new Array(f.length),h=s.getBoundingClientRect().width||s.offsetWidth,E.style.width=f.length*h*2+"px";for(var o=f.length;o--;){var r=f[o];r.style.width=h+"px",r.setAttribute("data-index",o),d.transitions&&(r.style[T]=o*-h+"px",P(o,o<y?-h:y<o?h:0,0))}a.continuous&&d.transitions&&(P(A(y-1),-h,0),P(A(y+1),h,0)),d.transitions||(E.style[T]=y*-h+"px"),s.style.visibility="visible",w(),d.addEventListener?(d.touch&&E.addEventListener("touchstart",L,!!d.passiveEvents&&{passive:!0}),a.draggable&&E.addEventListener("mousedown",L,!1),d.transitions&&(E.addEventListener("webkitTransitionEnd",L,!1),E.addEventListener("msTransitionEnd",L,!1),E.addEventListener("oTransitionEnd",L,!1),E.addEventListener("otransitionend",L,!1),E.addEventListener("transitionend",L,!1)),Q.addEventListener("resize",L,!1)):Q.onresize=x}function M(){i||(a.continuous||y<f.length-1)&&O(y+1)}function k(t,e,n){a.callback&&a.callback(t,e,n)}function z(t,e){a.transitionEnd&&a.transitionEnd(t,e)}function A(t){return(f.length+t%f.length)%f.length}function j(){var t=y;return p<=t&&(t-=p),t}function O(t,e){if(t="number"!=typeof t?parseInt(t,10):t,y!==t){if(d.transitions){var n=Math.abs(y-t)/(y-t);if(a.continuous){var i=n;(n=-m[A(t)]/h)!==i&&(t=-n*f.length+t)}for(var o=Math.abs(y-t)-1;o--;)P(A((y<t?t:y)-o-1),h*n,0);t=A(t),P(y,h*n,e||g),P(t,0,e||g),a.continuous&&P(A(t-n),-h*n,0)}else t=A(t),function(e,n,i){if(!i)return E.style[T]=n+"px";var o=+new Date,r=setInterval(function(){var t=new Date-o;if(i<t)return E.style[T]=n+"px",(v||a.autoRestart)&&N(),z(j(),f[y]),void clearInterval(r);E.style[T]=(n-e)*(Math.floor(t/i*100)/100)+e+"px"},4)}(y*-h,t*-h,e||g);y=t,r(function(){k(j(),f[y],n)})}}function P(t,e,n){R(t,e,n),m[t]=e}function R(t,e,n){var i=f[t],o=i&&i.style;o&&(o.webkitTransitionDuration=o.MozTransitionDuration=o.msTransitionDuration=o.OTransitionDuration=o.transitionDuration=n+"ms",o.webkitTransform=o.msTransform=o.MozTransform=o.OTransform=o.transform="translateX("+e+"px)")}function C(){(v=a.auto||0)&&(t=setTimeout(M,v))}function I(){v=0,clearTimeout(t)}function N(){I(),C()}function X(t){return/^mouse/.test(t.type)}}return(Q.jQuery||Q.Zepto)&&((e=Q.jQuery||Q.Zepto).fn.Swipe=function(t){return this.each(function(){e(this).data("Swipe",new Swipe(e(this)[0],t))})}),Swipe});
!function(t,e){t=t||{},"function"==typeof define&&define.amd?define([],function(){return t.Swipe=e(),t.Swipe}):"object"==typeof module&&module.exports?module.exports=e():t.Swipe=e()}(this,function(){var e,Q="object"==typeof self&&self.self===self&&self||"object"==typeof global&&global.global===global&&global||this,W=Q.document;function Swipe(s,a){"use strict";function e(){}function n(t){return!!t&&("boolean"!=typeof t.cancelable||t.cancelable)}var u,t,l={},c={},v=(a=a||{}).auto||0,i=!1,r=function(t){setTimeout(t||e,0)};Element.prototype.matches||(Element.prototype.matches=Element.prototype.matchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.oMatchesSelector||Element.prototype.webkitMatchesSelector||function(t){for(var e=(this.document||this.ownerDocument).querySelectorAll(t),n=e.length;0<=--n&&e.item(n)!==this;);return-1<n});var d={addEventListener:!!Q.addEventListener,passiveEvents:function(){var e=!1;try{var t=Object.defineProperty({},"passive",{get:function(){e=!0}});Q.addEventListener("testEvent",null,t),Q.removeEventListener("testEvent",null,t)}catch(t){e=!1}return e}(),touch:"ontouchstart"in Q||Q.DocumentTouch&&W instanceof DocumentTouch,transitions:function(t){var e=["transitionProperty","WebkitTransition","MozTransition","OTransition","msTransition"];for(var n in e)if(void 0!==t.style[e[n]])return!0;return!1}(W.createElement("swipe"))};if(s){var f,m,h,p,E=s.children[0],y=parseInt(a.startSlide,10)||0,g=a.speed||300;a.continuous=void 0===a.continuous||a.continuous;var o,b,T=(o="direction",s.currentStyle?b=s.currentStyle[o]:Q.getComputedStyle&&(b=Q.getComputedStyle(s,null).getPropertyValue(o)),"rtl"===b?"right":"left");a.autoRestart=void 0!==a.autoRestart&&a.autoRestart;var x=function(n,i){i=i||100;var o=null;function r(){o&&clearTimeout(o)}function t(){var t=this,e=arguments;r(),o=setTimeout(function(){o=null,n.apply(t,e)},i)}return t.cancel=r,t}(S),L={handleEvent:function(t){if(!i){switch(t.type){case"mousedown":case"touchstart":this.start(t);break;case"mousemove":case"touchmove":this.move(t);break;case"mouseup":case"mouseleave":case"touchend":this.end(t);break;case"webkitTransitionEnd":case"msTransitionEnd":case"oTransitionEnd":case"otransitionend":case"transitionend":this.transitionEnd(t);break;case"resize":x()}a.stopPropagation&&t.stopPropagation()}},start:function(t){var e,n,i;X(t)?(e=t).preventDefault():e=t.touches[0],a.ignore&&e.target.matches(a.ignore)||(l={x:e.pageX,y:e.pageY,time:+new Date},u=void 0,c={},X(t)?(E.addEventListener("mousemove",this,!1),E.addEventListener("mouseup",this,!1),E.addEventListener("mouseleave",this,!1)):(E.addEventListener("touchmove",this,!!d.passiveEvents&&{passive:!1}),E.addEventListener("touchend",this,!1)),n=j(),i=f[y],a.dragStart&&a.dragStart(n,i))},move:function(t){var e;if(X(t))e=t;else{if(1<t.touches.length||t.scale&&1!==t.scale)return;a.disableScroll&&n(t)&&t.preventDefault(),e=t.touches[0]}c={x:e.pageX-l.x,y:e.pageY-l.y},void 0===u&&(u=!!(u||Math.abs(c.x)<Math.abs(c.y))),u||(n(t)&&t.preventDefault(),I(),a.continuous?(R(A(y-1),c.x+m[A(y-1)],0),R(y,c.x+m[y],0),R(A(y+1),c.x+m[A(y+1)],0)):(c.x=c.x/(!y&&0<c.x||y===f.length-1&&c.x<0?Math.abs(c.x)/h+1:1),R(y-1,c.x+m[y-1],0),R(y,c.x+m[y],0),R(y+1,c.x+m[y+1],0)))},end:function(t){var e=new Date-l.time,n=Number(e)<250&&20<Math.abs(c.x)||Math.abs(c.x)>h/2,i=!y&&0<c.x||y===f.length-1&&c.x<0;a.continuous&&(i=!1);var o,r,s=Math.abs(c.x)/c.x;u||(n&&!i?(y=s<0?(a.continuous?(P(A(y-1),-h,0),P(A(y+2),h,0)):P(y-1,-h,0),P(y,m[y]-h,g),P(A(y+1),m[A(y+1)]-h,g),A(y+1)):(a.continuous?(P(A(y+1),h,0),P(A(y-2),-h,0)):P(y+1,h,0),P(y,m[y]+h,g),P(A(y-1),m[A(y-1)]+h,g),A(y-1)),k(j(),f[y],s)):a.continuous?(P(A(y-1),-h,g),P(y,0,g),P(A(y+1),h,g)):(P(y-1,-h,g),P(y,0,g),P(y+1,h,g))),X(t)?(E.removeEventListener("mousemove",L,!1),E.removeEventListener("mouseup",L,!1),E.removeEventListener("mouseleave",L,!1)):(E.removeEventListener("touchmove",L,!!d.passiveEvents&&{passive:!1}),E.removeEventListener("touchend",L,!1)),o=j(),r=f[y],a.dragEnd&&a.dragEnd(o,r)},transitionEnd:function(t){parseInt(t.target.getAttribute("data-index"),10)===y&&((v||a.autoRestart)&&N(),z(j(),f[y]))}};return S(),C(),{setup:S,slide:function(t,e){I(),O(t,e)},prev:function(){I(),function(){if(i)return;(a.continuous||y)&&O(y-1)}()},next:function(){I(),M()},restart:N,stop:I,getPos:j,disable:function(){I(),i=!0},enable:function(){i=!1,N()},getNumSlides:function(){return p},kill:function(){I(),s.style.visibility="",E.style.width="",E.style[T]="";var t=f.length;for(;t--;){d.transitions&&R(t,0,0);var e=f[t];if(e.getAttribute("data-cloned"))e.parentElement.removeChild(e);e.style.width="",e.style[T]="",e.style.webkitTransitionDuration=e.style.MozTransitionDuration=e.style.msTransitionDuration=e.style.OTransitionDuration=e.style.transitionDuration="",e.style.webkitTransform=e.style.msTransform=e.style.MozTransform=e.style.OTransform=""}w(),x.cancel()}}}function w(){d.addEventListener?(E.removeEventListener("touchstart",L,!!d.passiveEvents&&{passive:!0}),E.removeEventListener("mousedown",L,!1),E.removeEventListener("webkitTransitionEnd",L,!1),E.removeEventListener("msTransitionEnd",L,!1),E.removeEventListener("oTransitionEnd",L,!1),E.removeEventListener("otransitionend",L,!1),E.removeEventListener("transitionend",L,!1),Q.removeEventListener("resize",L,!1)):Q.onresize=null}function D(t){var e=t.cloneNode(!0);E.appendChild(e),e.setAttribute("data-cloned",!0),e.removeAttribute("id")}function S(t){if(null!=t)for(var e in t)a[e]=t[e];f=E.children,p=f.length;for(var n=0;n<f.length;n++)f[n].getAttribute("data-cloned")&&p--;if(f.length<2&&(a.continuous=!1),d.transitions&&a.continuous&&f.length<3&&(D(f[0]),D(f[1]),f=E.children),"right"===T)for(var i=0;i<f.length;i++)f[i].style.float="right";m=new Array(f.length),h=s.getBoundingClientRect().width||s.offsetWidth,E.style.width=f.length*h*2+"px";for(var o=f.length;o--;){var r=f[o];r.style.width=h+"px",r.setAttribute("data-index",o),d.transitions&&(r.style[T]=o*-h+"px",P(o,o<y?-h:y<o?h:0,0))}a.continuous&&d.transitions&&(P(A(y-1),-h,0),P(A(y+1),h,0)),d.transitions||(E.style[T]=y*-h+"px"),s.style.visibility="visible",w(),d.addEventListener?(d.touch&&E.addEventListener("touchstart",L,!!d.passiveEvents&&{passive:!0}),a.draggable&&E.addEventListener("mousedown",L,!1),d.transitions&&(E.addEventListener("webkitTransitionEnd",L,!1),E.addEventListener("msTransitionEnd",L,!1),E.addEventListener("oTransitionEnd",L,!1),E.addEventListener("otransitionend",L,!1),E.addEventListener("transitionend",L,!1)),Q.addEventListener("resize",L,!1)):Q.onresize=x}function M(){i||(a.continuous||y<f.length-1)&&O(y+1)}function k(t,e,n){a.callback&&a.callback(t,e,n)}function z(t,e){a.transitionEnd&&a.transitionEnd(t,e)}function A(t){return(f.length+t%f.length)%f.length}function j(){var t=y;return p<=t&&(t-=p),t}function O(t,e){if(t="number"!=typeof t?parseInt(t,10):t,y!==t){if(d.transitions){var n=Math.abs(y-t)/(y-t);if(a.continuous){var i=n;(n=-m[A(t)]/h)!==i&&(t=-n*f.length+t)}for(var o=Math.abs(y-t)-1;o--;)P(A((y<t?t:y)-o-1),h*n,0);t=A(t),P(y,h*n,e||g),P(t,0,e||g),a.continuous&&P(A(t-n),-h*n,0)}else t=A(t),function(e,n,i){if(!i)return E.style[T]=n+"px";var o=+new Date,r=setInterval(function(){var t=new Date-o;if(i<t)return E.style[T]=n+"px",(v||a.autoRestart)&&N(),z(j(),f[y]),void clearInterval(r);E.style[T]=(n-e)*(Math.floor(t/i*100)/100)+e+"px"},4)}(y*-h,t*-h,e||g);y=t,r(function(){k(j(),f[y],n)})}}function P(t,e,n){R(t,e,n),m[t]=e}function R(t,e,n){var i=f[t],o=i&&i.style;o&&(o.webkitTransitionDuration=o.MozTransitionDuration=o.msTransitionDuration=o.OTransitionDuration=o.transitionDuration=n+"ms",o.webkitTransform=o.msTransform=o.MozTransform=o.OTransform=o.transform="translateX("+e+"px)")}function C(){(v=a.auto||0)&&(t=setTimeout(M,v))}function I(){v=0,clearTimeout(t)}function N(){I(),C()}function X(t){return/^mouse/.test(t.type)}}return(Q.jQuery||Q.Zepto)&&((e=Q.jQuery||Q.Zepto).fn.Swipe=function(t){return this.each(function(){e(this).data("Swipe",new Swipe(e(this)[0],t))})}),Swipe});
{
"name": "swipejs",
"version": "2.2.16",
"version": "2.2.17",
"main": "swipe.js",

@@ -5,0 +5,0 @@ "types": "types/swipe.d.ts",

/*!
* React Swipe 2.2.16
* React Swipe 2.2.17
*

@@ -4,0 +4,0 @@ * Felix Liu

/*!
* Swipe 2.2.16
* Swipe 2.2.17
*

@@ -12,2 +12,3 @@ * Brad Birdsall

;(function (root, factory) {
root = root || {};
// eslint-disable-next-line no-undef

@@ -14,0 +15,0 @@ if (typeof define === 'function' && define.amd) {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc