New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

slideshow.js

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

slideshow.js - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

2

package.json
{
"name": "slideshow.js",
"description": "Native JS slideshow plugin with support for custom effects",
"version": "2.0.0",
"version": "2.0.1",
"keywords": [

@@ -6,0 +6,0 @@ "slides",

@@ -290,3 +290,3 @@ (function() {

if ((_ref = this.options.onWillChange) != null) {
_ref.call(this, currentSlide, targetSlide, indexOf(this.slides, targetSlide));
_ref.call(this, currentSlide, targetSlide, this.current + 1);
}

@@ -338,6 +338,6 @@ progress = initialProgress != null ? initialProgress : 0;

if (callback != null) {
callback.call(this, currentSlide, targetSlide, indexOf(this.slides, targetSlide));
callback.call(this, currentSlide, targetSlide, this.current);
}
if ((_ref1 = this.options.onDidChange) != null) {
_ref1.call(this, currentSlide, targetSlide, indexOf(this.slides, targetSlide));
_ref1.call(this, currentSlide, targetSlide, this.current);
}

@@ -487,2 +487,6 @@ }

Slideshow.prototype.getCurrentIndex = function() {
return this.current;
};
Slideshow.prototype.getNextSlide = function() {

@@ -489,0 +493,0 @@ return this.getSlide(this.current + 1);

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

(function(){"use strict";var t,e,n,i,r,s=[].slice,o={}.hasOwnProperty;!function(t){var e,n,i,r,s;for(n=0,r=["ms","moz","webkit","o"],e=0;e<r.length&&!t.requestAnimationFrame;)i=r[e++],t.requestAnimationFrame=t[i+"RequestAnimationFrame"],t.cancelAnimationFrame=null!=(s=t[i+"CancelAnimationFrame"])?s:t[i+"CancelRequestAnimationFrame"];return null==t.requestAnimationFrame&&(t.requestAnimationFrame=function(e){var i,r,s;return i=(new Date).getTime(),s=Math.max(0,16-(i-n)),r=t.setTimeout(function(){return e(i+s)},s),n=i+s,r}),null==t.cancelAnimationFrame?t.cancelAnimationFrame=function(t){return clearTimeout(t)}:void 0}("undefined"!=typeof window&&null!==window?window:this),r=function(t,e){var n,i,r,s;if(null!=t){if(null!=Array.prototype.indexOf)return Array.prototype.indexOf.call(Array.prototype.slice.call(t),e);for(n=r=0,s=t.length;s>r;n=++r)if(i=t[n],i===e)return n;return-1}},i=function(){var t,e,n,i,r,l;if(i=arguments[0],e=2<=arguments.length?s.call(arguments,1):[],"object"==typeof i){for(r=0,l=e.length;l>r;r++){t=e[r];for(n in t)o.call(t,n)&&(i[n]=t[n])}return i}},n=function(t){return i({},t)},e=function(t,e){return function(){return t.apply(e,[].slice.call(arguments))}},t=function(){function t(t,e){if(null==e&&(e={}),1!==t.nodeType&&(null!=t[0]&&(t=t[0]),null!=t.el&&(t=t.el)),1!==t.nodeType)throw new Error("No valid element provided");this.configure(e),this.el=t,h.call(this)}var s,o,l,u,a,c,h,f,d,p,v;return t.prototype.configure=function(t){var e;return this.options=i({},o,t),"string"==typeof this.options.effect&&null!=l[this.options.effect]?(this.options.effect=n(l[this.options.effect]),null!=(e=this.options.effect).conditions?e.conditions:e.conditions=l["default"].conditions.concat()):void 0},o={touchEventsEnabled:!0,mouseEventsEnabled:!0,preventDefaultEvents:!0,animationDuration:400,animationDirection:"x",effect:"default"},l={"default":function(){var t;return t=function(){var t,e,n,i,r,s;if(e=document.createElement("div").style,null!=e.transform)return"transform";for(s=["moz","webkit","khtml","o","ms"],i=0,r=s.length;r>i;i++)if(n=s[i],t=n+"Transform",null!=e[t])return t;return!1}(),{conditions:[{progress:.1,time:250,durationModifier:.5},{progress:.3,time:500},{progress:.5}],before:function(e,n){var i;return n.style.display="block",i=100*-e,t?n.style[t]="translateX("+i+"%)":n.style.left=i+"%"},progress:function(e,n,i){var r;return r=100*n*(1-e/Math.abs(n)),t?i.style[t]="translateX("+r+"%)":i.style.left=r+"%"},after:function(t,e){return e.style.display=t>0?"block":"none"}}}()},h=function(){return d.call(this),f.call(this)},d=function(){var t,e,n,i,r,s,o,l,u;for(this.el.style.position="relative",this.el.style.overflow="hidden",e=this.options.effect.before,t=this.options.effect.after,this.slides=null!=(o=this.el.children)?o:this.el.childNodes,this.current=0,l=this.slides,u=[],n=r=0,s=l.length;s>r;n=++r)i=l[n],n!==this.current&&(i.style.position="absolute",n===this.current?(null!=e&&e.call(this,0,this.slides[this.current]),u.push(null!=t?t.call(this,1,this.slides[this.current]):void 0)):(null!=e&&e.call(this,1,i),u.push(null!=t?t.call(this,0,i):void 0)));return u},f=function(){var t,n,i,r,s;if("undefined"!=typeof TouchEvent&&null!==TouchEvent&&this.options.touchEventsEnabled&&(this.el.addEventListener("touchstart",e(c,this)),this.el.addEventListener("touchmove",e(a,this)),this.el.addEventListener("touchend",e(u,this))),"undefined"!=typeof MouseEvent&&null!==MouseEvent&&this.options.mouseEventsEnabled){for(this.el.addEventListener("mousedown",e(c,this)),this.el.addEventListener("mousemove",e(a,this)),this.el.addEventListener("mouseup",e(u,this)),this.el.addEventListener("mouseleave",e(u,this)),r=this.slides,s=[],n=0,i=r.length;i>n;n++)t=r[n],t.addEventListener("mousedown",function(t){return t.preventDefault()}),t.addEventListener("mousemove",function(t){return t.preventDefault()}),s.push(t.addEventListener("mouseup",function(t){return t.preventDefault()}));return s}},v=function(t){return this.current=r(this.slides,t)},s=function(t,n,i,s){var o,l,u,a,c,h,f;return o=i.direction,c=i.initialProgress,u=i.durationMod,null==this.currentAnimation?(null!=(f=this.options.onWillChange)&&f.call(this,t,n,r(this.slides,n)),h=null!=c?c:0,null==u&&(u=1),l=Math.max(1,this.options.animationDuration*(1-h)*u),null==this.currentEvent&&(a=this.options.effect.before,null!=a&&a.call(this,0,t),null!=a&&a.call(this,0>o?1:-1,n)),this.currentAnimation={start:Date.now(),currentSlide:t,targetSlide:n,direction:o,duration:l,progress:h,callback:s},requestAnimationFrame(e(p,this))):void 0},p=function(){var t,n,i,s,o,l,u,a,c,h,f,d,m;return a=requestAnimationFrame(e(p,this)),t=this.currentAnimation,d=this.currentAnimation,h=d.start,c=d.progress,o=d.duration,s=d.direction,i=d.currentSlide,f=d.targetSlide,n=d.callback,c+=(Date.now()-h)/o*(1-c),c>=1&&(c=1,this.currentAnimation=null,cancelAnimationFrame(a),l=this.options.effect.after,null!=l&&l.call(this,0,i),null!=l&&l.call(this,1,f),v.call(this,f),null!=n&&n.call(this,i,f,r(this.slides,f)),null!=(m=this.options.onDidChange)&&m.call(this,i,f,r(this.slides,f))),u=this.options.effect.progress,null!=u&&u.call(this,0,c*s,i),null!=u?u.call(this,1,c*s,f):void 0},c=function(t){var e,n,i,r,s,o,l,u,a,c;return this.options.preventDefaultEvents&&t.preventDefault(),null==this.currentAnimation&&null==this.currentEvent?(e=this.getCurrentSlide(),o=this.getPrevSlide(),i=this.getNextSlide(),n=this.options.effect.before,null!=n&&n.call(this,0,e),null!=n&&n.call(this,-1,o),null!=n&&n.call(this,1,i),l=t.timeStamp,c=null!=(u=null!=(a=t.touches)?a[0]:void 0)?u:t,r=c.pageX,s=c.pageY,this.currentEvent={currentSlide:e,prevSlide:o,nextSlide:i,timeStamp:l,pageX:r,pageY:s}):void 0},a=function(t){var e,n,i,r,s,o,l;return this.options.preventDefaultEvents&&t.preventDefault(),this.currentAnimation||null==this.currentEvent?void 0:(l=null!=(s=null!=(o=t.touches)?o[0]:void 0)?s:t,e=l.pageX,n=l.pageY,i=function(){switch(this.options.animationDirection){case"x":return(e-this.currentEvent.pageX)/this.el.clientWidth;case"y":return(n-this.currentEvent.pageY)/this.el.clientHeight}}.call(this),r=0>i?this.currentEvent.nextSlide:this.currentEvent.prevSlide,requestAnimationFrame(function(t){return function(){var e;return e=t.options.effect.progress,e.call(t,0,i,t.currentEvent.currentSlide),e.call(t,1,i,r)}}(this)))},u=function(t){var e,n,i,r,o,l,u,a,c,h,f,d,p,v,m,g,E,y,S,A;if(this.options.preventDefaultEvents&&t.preventDefault(),!this.currentAnimation&&null!=this.currentEvent){if(d=t.timeStamp,E=null!=(m=null!=(g=t.changedTouches)?g[0]:void 0)?m:t,l=E.pageX,u=E.pageY,a=function(){switch(this.options.animationDirection){case"x":return(l-this.currentEvent.pageX)/this.el.clientWidth;case"y":return(u-this.currentEvent.pageY)/this.el.clientHeight}}.call(this),0===a)return void(this.currentEvent=null);for(f=d-this.currentEvent.timeStamp,c=Math.abs(a),y=this.options.effect.conditions,p=0,v=y.length;v>p;p++)if(e=y[p],c>e.progress&&f<(null!=(S=e.time)?S:1/0)){r=null!=(A=e.durationModifier)?A:1;break}return null!=r?(n=this.currentEvent.currentSlide,i=a/c,h=1===i?this.currentEvent.prevSlide:this.currentEvent.nextSlide,o=c):(h=this.currentEvent.currentSlide,i=-a/c,n=1===i?this.currentEvent.nextSlide:this.currentEvent.prevSlide,o=1-c),s.call(this,n,h,{direction:i,initialProgress:o,durationMod:r},function(t){return function(){return t.currentEvent=null}}(this))}},t.prototype.getSlide=function(t){return t%=this.slides.length,0>t&&(t+=this.slides.length),this.slides[t]},t.prototype.getCurrentSlide=function(){return this.slides[this.current]},t.prototype.getNextSlide=function(){return this.getSlide(this.current+1)},t.prototype.getPrevSlide=function(){return this.getSlide(this.current-1)},t.prototype.getFirstSlide=function(){return this.slides[0]},t.prototype.getLastSlide=function(){return this.slides[this.slides.length-1]},t.prototype.goTo=function(t,e){var n,i,r;if(t!==this.current)return n=this.getCurrentSlide(),r=this.getSlide(t),i=t<this.current?1:-1,s.call(this,n,r,{direction:i},e)},t.prototype.goToNext=function(t){return this.goTo(this.current+1,t)},t.prototype.goToPrev=function(t){return this.goTo(this.current-1,t)},t.prototype.goToFirst=function(t){return this.goTo(0,t)},t.prototype.goToLast=function(t){return this.goTo(this.slides.length-1,t)},t.registerAsJQueryPlugin=function(e,n){return null==n&&(n="Slideshow"),e.fn[n]=function(e){var n,i,r,s;for(s=[],i=0,r=this.length;r>i;i++)n=this[i],s.push(new t(n,e));return s}},t.registerEffect=function(t,e){return null==e.conditions&&(e.conditions=l["default"].conditions.concat()),null!=l[t]?l[t]:l[t]=e},t}(),function(e){return"function"==typeof define&&define.amd?define([],function(){return t}):"undefined"!=typeof exports?module.exports=t:e.Slideshow=t}(this)}).call(this);
(function(){"use strict";var t,e,n,i,r,s=[].slice,o={}.hasOwnProperty;!function(t){var e,n,i,r,s;for(n=0,r=["ms","moz","webkit","o"],e=0;e<r.length&&!t.requestAnimationFrame;)i=r[e++],t.requestAnimationFrame=t[i+"RequestAnimationFrame"],t.cancelAnimationFrame=null!=(s=t[i+"CancelAnimationFrame"])?s:t[i+"CancelRequestAnimationFrame"];return null==t.requestAnimationFrame&&(t.requestAnimationFrame=function(e){var i,r,s;return i=(new Date).getTime(),s=Math.max(0,16-(i-n)),r=t.setTimeout(function(){return e(i+s)},s),n=i+s,r}),null==t.cancelAnimationFrame?t.cancelAnimationFrame=function(t){return clearTimeout(t)}:void 0}("undefined"!=typeof window&&null!==window?window:this),r=function(t,e){var n,i,r,s;if(null!=t){if(null!=Array.prototype.indexOf)return Array.prototype.indexOf.call(Array.prototype.slice.call(t),e);for(n=r=0,s=t.length;s>r;n=++r)if(i=t[n],i===e)return n;return-1}},i=function(){var t,e,n,i,r,l;if(i=arguments[0],e=2<=arguments.length?s.call(arguments,1):[],"object"==typeof i){for(r=0,l=e.length;l>r;r++){t=e[r];for(n in t)o.call(t,n)&&(i[n]=t[n])}return i}},n=function(t){return i({},t)},e=function(t,e){return function(){return t.apply(e,[].slice.call(arguments))}},t=function(){function t(t,e){if(null==e&&(e={}),1!==t.nodeType&&(null!=t[0]&&(t=t[0]),null!=t.el&&(t=t.el)),1!==t.nodeType)throw new Error("No valid element provided");this.configure(e),this.el=t,h.call(this)}var s,o,l,u,c,a,h,f,d,p,v;return t.prototype.configure=function(t){var e;return this.options=i({},o,t),"string"==typeof this.options.effect&&null!=l[this.options.effect]?(this.options.effect=n(l[this.options.effect]),null!=(e=this.options.effect).conditions?e.conditions:e.conditions=l["default"].conditions.concat()):void 0},o={touchEventsEnabled:!0,mouseEventsEnabled:!0,preventDefaultEvents:!0,animationDuration:400,animationDirection:"x",effect:"default"},l={"default":function(){var t;return t=function(){var t,e,n,i,r,s;if(e=document.createElement("div").style,null!=e.transform)return"transform";for(s=["moz","webkit","khtml","o","ms"],i=0,r=s.length;r>i;i++)if(n=s[i],t=n+"Transform",null!=e[t])return t;return!1}(),{conditions:[{progress:.1,time:250,durationModifier:.5},{progress:.3,time:500},{progress:.5}],before:function(e,n){var i;return n.style.display="block",i=100*-e,t?n.style[t]="translateX("+i+"%)":n.style.left=i+"%"},progress:function(e,n,i){var r;return r=100*n*(1-e/Math.abs(n)),t?i.style[t]="translateX("+r+"%)":i.style.left=r+"%"},after:function(t,e){return e.style.display=t>0?"block":"none"}}}()},h=function(){return d.call(this),f.call(this)},d=function(){var t,e,n,i,r,s,o,l,u;for(this.el.style.position="relative",this.el.style.overflow="hidden",e=this.options.effect.before,t=this.options.effect.after,this.slides=null!=(o=this.el.children)?o:this.el.childNodes,this.current=0,l=this.slides,u=[],n=r=0,s=l.length;s>r;n=++r)i=l[n],n!==this.current&&(i.style.position="absolute",n===this.current?(null!=e&&e.call(this,0,this.slides[this.current]),u.push(null!=t?t.call(this,1,this.slides[this.current]):void 0)):(null!=e&&e.call(this,1,i),u.push(null!=t?t.call(this,0,i):void 0)));return u},f=function(){var t,n,i,r,s;if("undefined"!=typeof TouchEvent&&null!==TouchEvent&&this.options.touchEventsEnabled&&(this.el.addEventListener("touchstart",e(a,this)),this.el.addEventListener("touchmove",e(c,this)),this.el.addEventListener("touchend",e(u,this))),"undefined"!=typeof MouseEvent&&null!==MouseEvent&&this.options.mouseEventsEnabled){for(this.el.addEventListener("mousedown",e(a,this)),this.el.addEventListener("mousemove",e(c,this)),this.el.addEventListener("mouseup",e(u,this)),this.el.addEventListener("mouseleave",e(u,this)),r=this.slides,s=[],n=0,i=r.length;i>n;n++)t=r[n],t.addEventListener("mousedown",function(t){return t.preventDefault()}),t.addEventListener("mousemove",function(t){return t.preventDefault()}),s.push(t.addEventListener("mouseup",function(t){return t.preventDefault()}));return s}},v=function(t){return this.current=r(this.slides,t)},s=function(t,n,i,r){var s,o,l,u,c,a,h;return s=i.direction,c=i.initialProgress,l=i.durationMod,null==this.currentAnimation?(null!=(h=this.options.onWillChange)&&h.call(this,t,n,this.current+1),a=null!=c?c:0,null==l&&(l=1),o=Math.max(1,this.options.animationDuration*(1-a)*l),null==this.currentEvent&&(u=this.options.effect.before,null!=u&&u.call(this,0,t),null!=u&&u.call(this,0>s?1:-1,n)),this.currentAnimation={start:Date.now(),currentSlide:t,targetSlide:n,direction:s,duration:o,progress:a,callback:r},requestAnimationFrame(e(p,this))):void 0},p=function(){var t,n,i,r,s,o,l,u,c,a,h,f,d;return u=requestAnimationFrame(e(p,this)),t=this.currentAnimation,f=this.currentAnimation,a=f.start,c=f.progress,s=f.duration,r=f.direction,i=f.currentSlide,h=f.targetSlide,n=f.callback,c+=(Date.now()-a)/s*(1-c),c>=1&&(c=1,this.currentAnimation=null,cancelAnimationFrame(u),o=this.options.effect.after,null!=o&&o.call(this,0,i),null!=o&&o.call(this,1,h),v.call(this,h),null!=n&&n.call(this,i,h,this.current),null!=(d=this.options.onDidChange)&&d.call(this,i,h,this.current)),l=this.options.effect.progress,null!=l&&l.call(this,0,c*r,i),null!=l?l.call(this,1,c*r,h):void 0},a=function(t){var e,n,i,r,s,o,l,u,c,a;return this.options.preventDefaultEvents&&t.preventDefault(),null==this.currentAnimation&&null==this.currentEvent?(e=this.getCurrentSlide(),o=this.getPrevSlide(),i=this.getNextSlide(),n=this.options.effect.before,null!=n&&n.call(this,0,e),null!=n&&n.call(this,-1,o),null!=n&&n.call(this,1,i),l=t.timeStamp,a=null!=(u=null!=(c=t.touches)?c[0]:void 0)?u:t,r=a.pageX,s=a.pageY,this.currentEvent={currentSlide:e,prevSlide:o,nextSlide:i,timeStamp:l,pageX:r,pageY:s}):void 0},c=function(t){var e,n,i,r,s,o,l;return this.options.preventDefaultEvents&&t.preventDefault(),this.currentAnimation||null==this.currentEvent?void 0:(l=null!=(s=null!=(o=t.touches)?o[0]:void 0)?s:t,e=l.pageX,n=l.pageY,i=function(){switch(this.options.animationDirection){case"x":return(e-this.currentEvent.pageX)/this.el.clientWidth;case"y":return(n-this.currentEvent.pageY)/this.el.clientHeight}}.call(this),r=0>i?this.currentEvent.nextSlide:this.currentEvent.prevSlide,requestAnimationFrame(function(t){return function(){var e;return e=t.options.effect.progress,e.call(t,0,i,t.currentEvent.currentSlide),e.call(t,1,i,r)}}(this)))},u=function(t){var e,n,i,r,o,l,u,c,a,h,f,d,p,v,m,g,E,y,S,A;if(this.options.preventDefaultEvents&&t.preventDefault(),!this.currentAnimation&&null!=this.currentEvent){if(d=t.timeStamp,E=null!=(m=null!=(g=t.changedTouches)?g[0]:void 0)?m:t,l=E.pageX,u=E.pageY,c=function(){switch(this.options.animationDirection){case"x":return(l-this.currentEvent.pageX)/this.el.clientWidth;case"y":return(u-this.currentEvent.pageY)/this.el.clientHeight}}.call(this),0===c)return void(this.currentEvent=null);for(f=d-this.currentEvent.timeStamp,a=Math.abs(c),y=this.options.effect.conditions,p=0,v=y.length;v>p;p++)if(e=y[p],a>e.progress&&f<(null!=(S=e.time)?S:1/0)){r=null!=(A=e.durationModifier)?A:1;break}return null!=r?(n=this.currentEvent.currentSlide,i=c/a,h=1===i?this.currentEvent.prevSlide:this.currentEvent.nextSlide,o=a):(h=this.currentEvent.currentSlide,i=-c/a,n=1===i?this.currentEvent.nextSlide:this.currentEvent.prevSlide,o=1-a),s.call(this,n,h,{direction:i,initialProgress:o,durationMod:r},function(t){return function(){return t.currentEvent=null}}(this))}},t.prototype.getSlide=function(t){return t%=this.slides.length,0>t&&(t+=this.slides.length),this.slides[t]},t.prototype.getCurrentSlide=function(){return this.slides[this.current]},t.prototype.getCurrentIndex=function(){return this.current},t.prototype.getNextSlide=function(){return this.getSlide(this.current+1)},t.prototype.getPrevSlide=function(){return this.getSlide(this.current-1)},t.prototype.getFirstSlide=function(){return this.slides[0]},t.prototype.getLastSlide=function(){return this.slides[this.slides.length-1]},t.prototype.goTo=function(t,e){var n,i,r;if(t!==this.current)return n=this.getCurrentSlide(),r=this.getSlide(t),i=t<this.current?1:-1,s.call(this,n,r,{direction:i},e)},t.prototype.goToNext=function(t){return this.goTo(this.current+1,t)},t.prototype.goToPrev=function(t){return this.goTo(this.current-1,t)},t.prototype.goToFirst=function(t){return this.goTo(0,t)},t.prototype.goToLast=function(t){return this.goTo(this.slides.length-1,t)},t.registerAsJQueryPlugin=function(e,n){return null==n&&(n="Slideshow"),e.fn[n]=function(e){var n,i,r,s;for(s=[],i=0,r=this.length;r>i;i++)n=this[i],s.push(new t(n,e));return s}},t.registerEffect=function(t,e){return null==e.conditions&&(e.conditions=l["default"].conditions.concat()),null!=l[t]?l[t]:l[t]=e},t}(),function(e){return"function"==typeof define&&define.amd?define([],function(){return t}):"undefined"!=typeof exports?module.exports=t:e.Slideshow=t}(this)}).call(this);

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc