slideshow.js
Advanced tools
Comparing version 1.6.0 to 1.6.1
{ | ||
"name": "slideshow.js", | ||
"description": "Native JS slideshow plugin with support for custom effects", | ||
"version": "1.6.0", | ||
"version": "1.6.1", | ||
"keywords": ["slides", "slideshow", "touch", "swipe"], | ||
@@ -6,0 +6,0 @@ "homepage": "https://olmokramer.github.io/slideshow.js/", |
@@ -1,2 +0,2 @@ | ||
# Slideshow.js 1.6.0 | ||
# Slideshow.js | ||
@@ -3,0 +3,0 @@ Slideshow.js is a javascript slideshow, with touch/swipe support. [Demo here](https://olmokramer.github.io/slideshow.js) |
@@ -262,2 +262,3 @@ (function() { | ||
this.el.addEventListener('mouseup', bind(eventEnd, this)); | ||
this.el.addEventListener('mouseleave', bind(evendEnd, this)); | ||
_ref = this.slides; | ||
@@ -264,0 +265,0 @@ _results = []; |
@@ -1,1 +0,1 @@ | ||
(function(){"use strict";var t,e,n,i,r,s,l,o,u=[].slice,a={}.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=null!=r?r:function(t){return s(t&&t!==+t)},s=function(t){return"[object Number]"===Object.prototype.toString.call(t)},l=function(t){var e;return"object"==(e=typeof t)||"function"===e},e=function(){var t,e,n,i,r,s;if(i=arguments[0],e=2<=arguments.length?u.call(arguments,1):[],l(i)){for(r=0,s=e.length;s>r;r++){t=e[r];for(n in t)a.call(t,n)&&(i[n]=t[n])}return i}},i=function(t,e){var n,i,r,s;if(null!=t){for(n=r=0,s=t.length;s>r;n=++r)if(i=t[n],i===e)return n;return-1}},t=function(t,e){return function(){return t.apply(e,[].slice.call(arguments))}},o=function(t){var e;return e={},function(n){var i,r,s,l,o,u;if(n in e)return e[n];if(r=t.document.createElement("div").style,n in r)return e[n]=n;for(n=n.charAt(0).toUpperCase()+n.slice(1),u=["moz","webkit","khtml","o","ms"],l=0,o=u.length;o>l;l++)if(s=u[l],i=""+s+n,i in r)return e[n]=i;return e[n]=!1}}("undefined"!=typeof window&&null!==window?window:this),n=function(){var n;return n=function(){function n(t,n){if(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.opts=e({},s,n),this.el=t,c.call(this)}var r,s,l,u,a,c,h,d,f,p,v;return v=o("transform"),s={touchEventsEnabled:!0,mouseEventsEnabled:!0,preventScroll:!0,animationDuration:400,onDidChange:function(){},onWillChange:function(){},animationDirection:"x",conditions:[{progress:.1,time:250,durationModifier:.5},{progress:.3,time:500},{progress:.5}],effect:{before:function(t,e){var n;return e.style.display="block",n=100*-t,v?e.style[v]="translateX("+n+"%)":e.style.left=n+"%"},progress:function(t,e,n){var i;return i=100*e*(1-t/Math.abs(e)),v?n.style[v]="translateX("+i+"%)":n.style.left=i+"%"},after:function(t,e){return e.style.display=t>0?"block":"none"}}},c=function(){return d.call(this),h.call(this)},d=function(){var t,e,n,i,r,s,l,o,u;for(this.el.style.position="relative",this.el.style.overflow="hidden",e=this.opts.effect.before,t=this.opts.effect.after,this.slides=null!=(l=this.el.children)?l:this.el.childNodes,this.current=0,o=this.slides,u=[],n=r=0,s=o.length;s>r;n=++r)i=o[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},h=function(){var e,n,i,r,s;if("undefined"!=typeof TouchEvent&&null!==TouchEvent&&this.opts.touchEventsEnabled&&(this.el.addEventListener("touchstart",t(a,this)),this.el.addEventListener("touchmove",t(u,this)),this.el.addEventListener("touchend",t(l,this))),"undefined"!=typeof MouseEvent&&null!==MouseEvent&&this.opts.mouseEventsEnabled){for(this.el.addEventListener("mousedown",t(a,this)),this.el.addEventListener("mousemove",t(u,this)),this.el.addEventListener("mouseup",t(l,this)),r=this.slides,s=[],n=0,i=r.length;i>n;n++)e=r[n],e.addEventListener("mousedown",function(t){return t.preventDefault()}),e.addEventListener("mousemove",function(t){return t.preventDefault()}),s.push(e.addEventListener("mouseup",function(t){return t.preventDefault()}));return s}},p=function(t){return this.current=i(this.slides,t)},r=function(e,n,i,r){var s,l,o,u,a;return l=i.direction,a=i.progress,u=i.durationMod,null==this.currentAnimation?(this.opts.onWillChange.call(this),null==a&&(a=0),null==u&&(u=1),o=Math.max(1,this.opts.animationDuration*(1-a)*u),null==this.currentTouchEvent&&(s=this.opts.effect.before,null!=s&&s.call(this,0,e),null!=s&&s.call(this,0>l?1:-1,n)),this.currentAnimation={start:(new Date).getTime(),currentSlide:e,targetSlide:n,direction:l,duration:o,progress:a,callback:r},requestAnimationFrame(t(f,this))):void 0},f=function(){var e,n,i,r,s;return i=requestAnimationFrame(t(f,this)),n=this.currentAnimation,r=Math.min(1,n.progress+((new Date).getTime()-n.start)/n.duration*(1-n.progress)),s=this.opts.effect.progress,null!=s&&s.call(this,0,r*n.direction,n.currentSlide),null!=s&&s.call(this,1,r*n.direction,n.targetSlide),r>=1?(this.currentAnimation=null,cancelAnimationFrame(i),e=this.opts.effect.after,null!=e&&e.call(this,0,n.currentSlide),null!=e&&e.call(this,1,n.targetSlide),"function"==typeof n.callback&&n.callback(),this.opts.onDidChange.call(this),p.call(this,n.targetSlide)):void 0},a=function(t){var e,n,i,r,s,l,o,u,a,c;return this.opts.preventDefaultEvents&&t.preventDefault(),null==this.currentAnimation&&null==this.currentEvent?(n=this.getCurrentSlide(),l=this.getPrevSlide(),i=this.getNextSlide(),e=this.opts.effect.before,null!=e&&e.call(this,0,n),null!=e&&e.call(this,-1,l),null!=e&&e.call(this,1,i),c=null!=(u=null!=(a=t.touches)?a[0]:void 0)?u:t,o=c.timeStamp,r=c.pageX,s=c.pageY,this.currentEvent={currentSlide:n,prevSlide:l,nextSlide:i,timeStamp:o,pageX:r,pageY:s}):void 0},u=function(t){var e,n,i,r,s,l,o;return this.opts.preventDefaultEvents&&t.preventDefault(),this.currentAnimation||null==this.currentEvent?void 0:(o=null!=(s=null!=(l=t.touches)?l[0]:void 0)?s:t,e=o.pageX,n=o.pageY,i=function(){switch(this.opts.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.opts.effect.progress,e.call(t,0,i,t.currentEvent.currentSlide),e.call(t,1,i,r)}}(this)))},l=function(t){var e,n,i,s,l,o,u,a,c,h,d,f,p,v,m,g,E,y,S;if(this.opts.preventDefaultEvents&&t.preventDefault(),!this.currentAnimation&&null!=this.currentEvent){for(g=null!=(v=null!=(m=t.changedTouches)?m[0]:void 0)?v:t,l=g.pageX,o=g.pageY,d=g.timeStamp,u=function(){switch(this.opts.animationDirection){case"x":return(l-this.currentEvent.pageX)/this.el.clientWidth;case"y":return(o-this.currentEvent.pageY)/this.el.clientHeight}}.call(this),h=d-this.currentEvent.timeStamp,a=Math.abs(u),E=this.opts.conditions,f=0,p=E.length;p>f;f++)if(e=E[f],a>e.progress&&h<(null!=(y=e.time)?y:1/0)){s=null!=(S=e.durationModifier)?S:1;break}return null!=s?(n=this.currentEvent.currentSlide,i=u/a,c=1===i?this.currentEvent.prevSlide:this.currentEvent.nextSlide,u=a):(c=this.currentEvent.currentSlide,i=-u/a,n=1===i?this.currentEvent.nextSlide:this.currentEvent.prevSlide,u=1-a),r.call(this,n,c,{direction:i,progress:u,durationMod:s},function(t){return function(){return t.currentEvent=null}}(this))}},n.prototype.getSlide=function(t){return t%=this.slides.length,0>t&&(t+=this.slides.length),this.slides[t]},n.prototype.getCurrentSlide=function(){return this.slides[this.current]},n.prototype.getNextSlide=function(){return this.getSlide(this.current+1)},n.prototype.getPrevSlide=function(){return this.getSlide(this.current-1)},n.prototype.getFirstSlide=function(){return this.slides[0]},n.prototype.getLastSlide=function(){return this.slides[this.slides.length-1]},n.prototype.goTo=function(t,e){var n,i,s;if(t!==this.current)return n=this.getCurrentSlide(),s=this.getSlide(t),i=t<this.current?1:-1,r.call(this,n,s,{direction:i},e)},n.prototype.goToNext=function(t){return this.goTo(this.current+1,t)},n.prototype.goToPrev=function(t){return this.goTo(this.current-1,t)},n.prototype.goToFirst=function(t){return this.goTo(0,t)},n.prototype.goToLast=function(t){return this.goTo(this.slides.length-1,t)},n.registerAsJQueryPlugin=function(t,e){return t.fn[e]=function(t){var e,i,r,s;for(s=[],i=0,r=this.length;r>i;i++)e=this[i],s.push(new n(e,t));return s}},n}()},function(t,e){var n;return n=e(t.document),"function"==typeof define&&define.amd?define([],function(){return n}):"undefined"!=typeof exports?module.exports=n:t.Slideshow=n}(this,n)}).call(this); | ||
(function(){"use strict";var t,e,n,i,r,s,l,o,u=[].slice,a={}.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=null!=r?r:function(t){return s(t&&t!==+t)},s=function(t){return"[object Number]"===Object.prototype.toString.call(t)},l=function(t){var e;return"object"==(e=typeof t)||"function"===e},e=function(){var t,e,n,i,r,s;if(i=arguments[0],e=2<=arguments.length?u.call(arguments,1):[],l(i)){for(r=0,s=e.length;s>r;r++){t=e[r];for(n in t)a.call(t,n)&&(i[n]=t[n])}return i}},i=function(t,e){var n,i,r,s;if(null!=t){for(n=r=0,s=t.length;s>r;n=++r)if(i=t[n],i===e)return n;return-1}},t=function(t,e){return function(){return t.apply(e,[].slice.call(arguments))}},o=function(t){var e;return e={},function(n){var i,r,s,l,o,u;if(n in e)return e[n];if(r=t.document.createElement("div").style,n in r)return e[n]=n;for(n=n.charAt(0).toUpperCase()+n.slice(1),u=["moz","webkit","khtml","o","ms"],l=0,o=u.length;o>l;l++)if(s=u[l],i=""+s+n,i in r)return e[n]=i;return e[n]=!1}}("undefined"!=typeof window&&null!==window?window:this),n=function(){var n;return n=function(){function n(t,n){if(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.opts=e({},s,n),this.el=t,c.call(this)}var r,s,l,u,a,c,h,d,f,p,v;return v=o("transform"),s={touchEventsEnabled:!0,mouseEventsEnabled:!0,preventScroll:!0,animationDuration:400,onDidChange:function(){},onWillChange:function(){},animationDirection:"x",conditions:[{progress:.1,time:250,durationModifier:.5},{progress:.3,time:500},{progress:.5}],effect:{before:function(t,e){var n;return e.style.display="block",n=100*-t,v?e.style[v]="translateX("+n+"%)":e.style.left=n+"%"},progress:function(t,e,n){var i;return i=100*e*(1-t/Math.abs(e)),v?n.style[v]="translateX("+i+"%)":n.style.left=i+"%"},after:function(t,e){return e.style.display=t>0?"block":"none"}}},c=function(){return d.call(this),h.call(this)},d=function(){var t,e,n,i,r,s,l,o,u;for(this.el.style.position="relative",this.el.style.overflow="hidden",e=this.opts.effect.before,t=this.opts.effect.after,this.slides=null!=(l=this.el.children)?l:this.el.childNodes,this.current=0,o=this.slides,u=[],n=r=0,s=o.length;s>r;n=++r)i=o[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},h=function(){var e,n,i,r,s;if("undefined"!=typeof TouchEvent&&null!==TouchEvent&&this.opts.touchEventsEnabled&&(this.el.addEventListener("touchstart",t(a,this)),this.el.addEventListener("touchmove",t(u,this)),this.el.addEventListener("touchend",t(l,this))),"undefined"!=typeof MouseEvent&&null!==MouseEvent&&this.opts.mouseEventsEnabled){for(this.el.addEventListener("mousedown",t(a,this)),this.el.addEventListener("mousemove",t(u,this)),this.el.addEventListener("mouseup",t(l,this)),this.el.addEventListener("mouseleave",t(evendEnd,this)),r=this.slides,s=[],n=0,i=r.length;i>n;n++)e=r[n],e.addEventListener("mousedown",function(t){return t.preventDefault()}),e.addEventListener("mousemove",function(t){return t.preventDefault()}),s.push(e.addEventListener("mouseup",function(t){return t.preventDefault()}));return s}},p=function(t){return this.current=i(this.slides,t)},r=function(e,n,i,r){var s,l,o,u,a;return l=i.direction,a=i.progress,u=i.durationMod,null==this.currentAnimation?(this.opts.onWillChange.call(this),null==a&&(a=0),null==u&&(u=1),o=Math.max(1,this.opts.animationDuration*(1-a)*u),null==this.currentTouchEvent&&(s=this.opts.effect.before,null!=s&&s.call(this,0,e),null!=s&&s.call(this,0>l?1:-1,n)),this.currentAnimation={start:(new Date).getTime(),currentSlide:e,targetSlide:n,direction:l,duration:o,progress:a,callback:r},requestAnimationFrame(t(f,this))):void 0},f=function(){var e,n,i,r,s;return i=requestAnimationFrame(t(f,this)),n=this.currentAnimation,r=Math.min(1,n.progress+((new Date).getTime()-n.start)/n.duration*(1-n.progress)),s=this.opts.effect.progress,null!=s&&s.call(this,0,r*n.direction,n.currentSlide),null!=s&&s.call(this,1,r*n.direction,n.targetSlide),r>=1?(this.currentAnimation=null,cancelAnimationFrame(i),e=this.opts.effect.after,null!=e&&e.call(this,0,n.currentSlide),null!=e&&e.call(this,1,n.targetSlide),"function"==typeof n.callback&&n.callback(),this.opts.onDidChange.call(this),p.call(this,n.targetSlide)):void 0},a=function(t){var e,n,i,r,s,l,o,u,a,c;return this.opts.preventDefaultEvents&&t.preventDefault(),null==this.currentAnimation&&null==this.currentEvent?(n=this.getCurrentSlide(),l=this.getPrevSlide(),i=this.getNextSlide(),e=this.opts.effect.before,null!=e&&e.call(this,0,n),null!=e&&e.call(this,-1,l),null!=e&&e.call(this,1,i),c=null!=(u=null!=(a=t.touches)?a[0]:void 0)?u:t,o=c.timeStamp,r=c.pageX,s=c.pageY,this.currentEvent={currentSlide:n,prevSlide:l,nextSlide:i,timeStamp:o,pageX:r,pageY:s}):void 0},u=function(t){var e,n,i,r,s,l,o;return this.opts.preventDefaultEvents&&t.preventDefault(),this.currentAnimation||null==this.currentEvent?void 0:(o=null!=(s=null!=(l=t.touches)?l[0]:void 0)?s:t,e=o.pageX,n=o.pageY,i=function(){switch(this.opts.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.opts.effect.progress,e.call(t,0,i,t.currentEvent.currentSlide),e.call(t,1,i,r)}}(this)))},l=function(t){var e,n,i,s,l,o,u,a,c,h,d,f,p,v,m,g,E,y,S;if(this.opts.preventDefaultEvents&&t.preventDefault(),!this.currentAnimation&&null!=this.currentEvent){for(g=null!=(v=null!=(m=t.changedTouches)?m[0]:void 0)?v:t,l=g.pageX,o=g.pageY,d=g.timeStamp,u=function(){switch(this.opts.animationDirection){case"x":return(l-this.currentEvent.pageX)/this.el.clientWidth;case"y":return(o-this.currentEvent.pageY)/this.el.clientHeight}}.call(this),h=d-this.currentEvent.timeStamp,a=Math.abs(u),E=this.opts.conditions,f=0,p=E.length;p>f;f++)if(e=E[f],a>e.progress&&h<(null!=(y=e.time)?y:1/0)){s=null!=(S=e.durationModifier)?S:1;break}return null!=s?(n=this.currentEvent.currentSlide,i=u/a,c=1===i?this.currentEvent.prevSlide:this.currentEvent.nextSlide,u=a):(c=this.currentEvent.currentSlide,i=-u/a,n=1===i?this.currentEvent.nextSlide:this.currentEvent.prevSlide,u=1-a),r.call(this,n,c,{direction:i,progress:u,durationMod:s},function(t){return function(){return t.currentEvent=null}}(this))}},n.prototype.getSlide=function(t){return t%=this.slides.length,0>t&&(t+=this.slides.length),this.slides[t]},n.prototype.getCurrentSlide=function(){return this.slides[this.current]},n.prototype.getNextSlide=function(){return this.getSlide(this.current+1)},n.prototype.getPrevSlide=function(){return this.getSlide(this.current-1)},n.prototype.getFirstSlide=function(){return this.slides[0]},n.prototype.getLastSlide=function(){return this.slides[this.slides.length-1]},n.prototype.goTo=function(t,e){var n,i,s;if(t!==this.current)return n=this.getCurrentSlide(),s=this.getSlide(t),i=t<this.current?1:-1,r.call(this,n,s,{direction:i},e)},n.prototype.goToNext=function(t){return this.goTo(this.current+1,t)},n.prototype.goToPrev=function(t){return this.goTo(this.current-1,t)},n.prototype.goToFirst=function(t){return this.goTo(0,t)},n.prototype.goToLast=function(t){return this.goTo(this.slides.length-1,t)},n.registerAsJQueryPlugin=function(t,e){return t.fn[e]=function(t){var e,i,r,s;for(s=[],i=0,r=this.length;r>i;i++)e=this[i],s.push(new n(e,t));return s}},n}()},function(t,e){var n;return n=e(t.document),"function"==typeof define&&define.amd?define([],function(){return n}):"undefined"!=typeof exports?module.exports=n:t.Slideshow=n}(this,n)}).call(this); |
Sorry, the diff of this file is not supported yet
850186
524