embla-carousel-autoplay
Advanced tools
Comparing version 8.5.1 to 8.5.2
@@ -77,3 +77,3 @@ 'use strict'; | ||
} | ||
if (options.playOnInit && !documentIsHidden()) startAutoplay(); | ||
if (options.playOnInit) startAutoplay(); | ||
} | ||
@@ -106,2 +106,6 @@ function destroy() { | ||
if (destroyed) return; | ||
if (documentIsHidden()) { | ||
playOnDocumentVisible = true; | ||
return; | ||
} | ||
if (!autoplayActive) emblaApi.emit('autoplay:play'); | ||
@@ -108,0 +112,0 @@ setTimer(); |
{ | ||
"name": "embla-carousel-autoplay", | ||
"version": "8.5.1", | ||
"version": "8.5.2", | ||
"author": "David Jerleke", | ||
@@ -51,3 +51,3 @@ "description": "An autoplay plugin for Embla Carousel", | ||
"peerDependencies": { | ||
"embla-carousel": "8.5.1" | ||
"embla-carousel": "8.5.2" | ||
}, | ||
@@ -54,0 +54,0 @@ "main": "embla-carousel-autoplay.cjs.js", |
@@ -1,1 +0,1 @@ | ||
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(n="undefined"!=typeof globalThis?globalThis:n||self).EmblaCarouselAutoplay=t()}(this,(function(){"use strict";const n={active:!0,breakpoints:{},delay:4e3,jump:!1,playOnInit:!0,stopOnFocusIn:!0,stopOnInteraction:!0,stopOnMouseEnter:!1,stopOnLastSnap:!1,rootNode:null};function t(o={}){let e,i,s,l,r=null,u=0,a=!1,c=!1,p=!1,f=!1;function d(){s||(a||i.emit("autoplay:play"),function(){const{ownerWindow:n}=i.internalEngine();n.clearTimeout(u),u=n.setTimeout(E,l[i.selectedScrollSnap()]),r=(new Date).getTime(),i.emit("autoplay:timerset")}(),a=!0)}function m(){s||(a&&i.emit("autoplay:stop"),function(){const{ownerWindow:n}=i.internalEngine();n.clearTimeout(u),u=0,r=null,i.emit("autoplay:timerstopped")}(),a=!1)}function y(){if(g())return p=a,m();p&&d()}function g(){const{ownerDocument:n}=i.internalEngine();return"hidden"===n.visibilityState}function O(){c||m()}function S(){c||d()}function w(){c=!0,m()}function b(){c=!1,d()}function E(){const{index:n}=i.internalEngine(),t=n.clone().add(1).get(),o=i.scrollSnapList().length-1,s=e.stopOnLastSnap&&t===o;if(i.canScrollNext()?i.scrollNext(f):i.scrollTo(0,f),i.emit("autoplay:select"),s)return m();d()}return{name:"autoplay",options:o,init:function(r,u){i=r;const{mergeOptions:a,optionsAtMedia:c}=u,p=a(n,t.globalOptions),E=a(p,o);if(e=c(E),i.scrollSnapList().length<=1)return;f=e.jump,s=!1,l=function(n,t){const o=n.scrollSnapList();return"number"==typeof t?o.map((()=>t)):t(o,n)}(i,e.delay);const{eventStore:I,ownerDocument:h}=i.internalEngine(),T=!!i.internalEngine().options.watchDrag,v=function(n,t){const o=n.rootNode();return t&&t(o)||o}(i,e.rootNode);I.add(h,"visibilitychange",y),T&&i.on("pointerDown",O),T&&!e.stopOnInteraction&&i.on("pointerUp",S),e.stopOnMouseEnter&&I.add(v,"mouseenter",w),e.stopOnMouseEnter&&!e.stopOnInteraction&&I.add(v,"mouseleave",b),e.stopOnFocusIn&&i.on("slideFocusStart",m),e.stopOnFocusIn&&!e.stopOnInteraction&&I.add(i.containerNode(),"focusout",d),e.playOnInit&&!g()&&d()},destroy:function(){i.off("pointerDown",O).off("pointerUp",S).off("slideFocusStart",m),m(),s=!0,a=!1},play:function(n){void 0!==n&&(f=n),d()},stop:function(){a&&m()},reset:function(){a&&d()},isPlaying:function(){return a},timeUntilNext:function(){return r?l[i.selectedScrollSnap()]-((new Date).getTime()-r):null}}}return t.globalOptions=void 0,t})); | ||
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(n="undefined"!=typeof globalThis?globalThis:n||self).EmblaCarouselAutoplay=t()}(this,(function(){"use strict";const n={active:!0,breakpoints:{},delay:4e3,jump:!1,playOnInit:!0,stopOnFocusIn:!0,stopOnInteraction:!0,stopOnMouseEnter:!1,stopOnLastSnap:!1,rootNode:null};function t(o={}){let e,i,s,l,r=null,u=0,a=!1,c=!1,p=!1,f=!1;function d(){s||(g()?p=!0:(a||i.emit("autoplay:play"),function(){const{ownerWindow:n}=i.internalEngine();n.clearTimeout(u),u=n.setTimeout(E,l[i.selectedScrollSnap()]),r=(new Date).getTime(),i.emit("autoplay:timerset")}(),a=!0))}function m(){s||(a&&i.emit("autoplay:stop"),function(){const{ownerWindow:n}=i.internalEngine();n.clearTimeout(u),u=0,r=null,i.emit("autoplay:timerstopped")}(),a=!1)}function y(){if(g())return p=a,m();p&&d()}function g(){const{ownerDocument:n}=i.internalEngine();return"hidden"===n.visibilityState}function O(){c||m()}function S(){c||d()}function w(){c=!0,m()}function b(){c=!1,d()}function E(){const{index:n}=i.internalEngine(),t=n.clone().add(1).get(),o=i.scrollSnapList().length-1,s=e.stopOnLastSnap&&t===o;if(i.canScrollNext()?i.scrollNext(f):i.scrollTo(0,f),i.emit("autoplay:select"),s)return m();d()}return{name:"autoplay",options:o,init:function(r,u){i=r;const{mergeOptions:a,optionsAtMedia:c}=u,p=a(n,t.globalOptions),g=a(p,o);if(e=c(g),i.scrollSnapList().length<=1)return;f=e.jump,s=!1,l=function(n,t){const o=n.scrollSnapList();return"number"==typeof t?o.map((()=>t)):t(o,n)}(i,e.delay);const{eventStore:E,ownerDocument:I}=i.internalEngine(),h=!!i.internalEngine().options.watchDrag,T=function(n,t){const o=n.rootNode();return t&&t(o)||o}(i,e.rootNode);E.add(I,"visibilitychange",y),h&&i.on("pointerDown",O),h&&!e.stopOnInteraction&&i.on("pointerUp",S),e.stopOnMouseEnter&&E.add(T,"mouseenter",w),e.stopOnMouseEnter&&!e.stopOnInteraction&&E.add(T,"mouseleave",b),e.stopOnFocusIn&&i.on("slideFocusStart",m),e.stopOnFocusIn&&!e.stopOnInteraction&&E.add(i.containerNode(),"focusout",d),e.playOnInit&&d()},destroy:function(){i.off("pointerDown",O).off("pointerUp",S).off("slideFocusStart",m),m(),s=!0,a=!1},play:function(n){void 0!==n&&(f=n),d()},stop:function(){a&&m()},reset:function(){a&&d()},isPlaying:function(){return a},timeUntilNext:function(){return r?l[i.selectedScrollSnap()]-((new Date).getTime()-r):null}}}return t.globalOptions=void 0,t})); |
@@ -75,3 +75,3 @@ const defaultOptions = { | ||
} | ||
if (options.playOnInit && !documentIsHidden()) startAutoplay(); | ||
if (options.playOnInit) startAutoplay(); | ||
} | ||
@@ -104,2 +104,6 @@ function destroy() { | ||
if (destroyed) return; | ||
if (documentIsHidden()) { | ||
playOnDocumentVisible = true; | ||
return; | ||
} | ||
if (!autoplayActive) emblaApi.emit('autoplay:play'); | ||
@@ -106,0 +110,0 @@ setTimer(); |
{ | ||
"name": "embla-carousel-autoplay", | ||
"version": "8.5.1", | ||
"version": "8.5.2", | ||
"author": "David Jerleke", | ||
@@ -51,3 +51,3 @@ "description": "An autoplay plugin for Embla Carousel", | ||
"peerDependencies": { | ||
"embla-carousel": "8.5.1" | ||
"embla-carousel": "8.5.2" | ||
}, | ||
@@ -54,0 +54,0 @@ "module": "embla-carousel-autoplay.esm.js", |
{ | ||
"name": "embla-carousel-autoplay", | ||
"version": "8.5.1", | ||
"version": "8.5.2", | ||
"author": "David Jerleke", | ||
@@ -62,3 +62,3 @@ "description": "An autoplay plugin for Embla Carousel", | ||
"peerDependencies": { | ||
"embla-carousel": "8.5.1" | ||
"embla-carousel": "8.5.2" | ||
}, | ||
@@ -65,0 +65,0 @@ "exports": { |
@@ -112,4 +112,2 @@ <br /> | ||
<img src="https://avatars2.githubusercontent.com/u/3440094?s=120&v=4" title="wopian" width="50" height="50" style="max-width: 100%" /> | ||
</a><a href="https://github.com/nikrowell"> | ||
<img src="https://avatars2.githubusercontent.com/u/260039?s=120&v=4" title="nikrowell" width="50" height="50" style="max-width: 100%" /> | ||
</a><a href="https://github.com/horseeyephil"> | ||
@@ -137,2 +135,4 @@ <img src="https://avatars2.githubusercontent.com/u/32337092?s=120&v=4" title="horseeyephil" width="50" height="50" style="max-width: 100%" /> | ||
<img src="https://avatars2.githubusercontent.com/u/8763144?s=120&v=4" title="tlo-johnson" width="50" height="50" style="max-width: 100%" /> | ||
</a><a href="https://github.com/yasuhiro-yamamoto"> | ||
<img src="https://avatars2.githubusercontent.com/u/25109330?s=120&v=4" title="yasuhiro-yamamoto" width="50" height="50" style="max-width: 100%" /> | ||
</a><a href="https://github.com/anzbert"> | ||
@@ -144,2 +144,4 @@ <img src="https://avatars2.githubusercontent.com/u/38823700?s=120&v=4" title="anzbert" width="50" height="50" style="max-width: 100%" /> | ||
<img src="https://avatars2.githubusercontent.com/u/9334305?s=120&v=4" title="silllli" width="50" height="50" style="max-width: 100%" /> | ||
</a><a href="https://github.com/nikrowell"> | ||
<img src="https://avatars2.githubusercontent.com/u/260039?s=120&v=4" title="nikrowell" width="50" height="50" style="max-width: 100%" /> | ||
</a><a href="https://github.com/mujahidfa"> | ||
@@ -146,0 +148,0 @@ <img src="https://avatars2.githubusercontent.com/u/17759705?s=120&v=4" title="mujahidfa" width="50" height="50" style="max-width: 100%" /> |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
67073
536
232