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

seamless-scroll-polyfill

Package Overview
Dependencies
Maintainers
1
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

seamless-scroll-polyfill - npm Package Compare versions

Comparing version 0.4.2 to 0.4.3

14

dist/smoothscroll.js

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

/* smoothscroll v0.4.1 - 2018 - Dustan Kasten, Jeremias Menichelli - MIT License */
/* smoothscroll v0.4.3 - 2018 - Dustan Kasten, Jeremias Menichelli - MIT License */
(function () {

@@ -222,4 +222,2 @@ 'use strict';

userInterrupt = false;
w.removeEventListener('wheel', userIsScrilling);
w.removeEventListener('touchmove', userIsScrilling);
}

@@ -255,4 +253,10 @@

w.addEventListener('wheel', userIsScrilling, { passive: true });
w.addEventListener('touchmove', userIsScrilling, { passive: true });
w.addEventListener('wheel', userIsScrilling, {
passive: true,
once: true
});
w.addEventListener('touchmove', userIsScrilling, {
passive: true,
once: true
});

@@ -259,0 +263,0 @@ // scroll looping over a frame

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

!function(){"use strict";function t(t){var p=window,d=document;if(t=t||{},!("scrollBehavior"in d.documentElement.style&&!0!==t.force)){var e,o,l=p.HTMLElement||p.Element,n=~~t.duration||468,h={scroll:p.scroll||p.scrollTo,scrollBy:p.scrollBy,elementScroll:l.prototype.scroll||a,scrollIntoView:l.prototype.scrollIntoView},c=p.performance&&p.performance.now?p.performance.now.bind(p.performance):Date.now,r=(e=p.navigator.userAgent,new RegExp(["MSIE ","Trident/","Edge/"].join("|")).test(e)?1:0),s=!1;p.scroll=p.scrollTo=function(){void 0!==arguments[0]&&(!0!==v(arguments[0])?y.call(p,d.body,void 0!==arguments[0].left?~~arguments[0].left:p.scrollX||p.pageXOffset,void 0!==arguments[0].top?~~arguments[0].top:p.scrollY||p.pageYOffset):h.scroll.call(p,void 0!==arguments[0].left?arguments[0].left:"object"!=typeof arguments[0]?arguments[0]:p.scrollX||p.pageXOffset,void 0!==arguments[0].top?arguments[0].top:void 0!==arguments[1]?arguments[1]:p.scrollY||p.pageYOffset))},p.scrollBy=function(){void 0!==arguments[0]&&(v(arguments[0])?h.scrollBy.call(p,void 0!==arguments[0].left?arguments[0].left:"object"!=typeof arguments[0]?arguments[0]:0,void 0!==arguments[0].top?arguments[0].top:void 0!==arguments[1]?arguments[1]:0):y.call(p,d.body,~~arguments[0].left+(p.scrollX||p.pageXOffset),~~arguments[0].top+(p.scrollY||p.pageYOffset)))},l.prototype.scroll=l.prototype.scrollTo=function(){if(void 0!==arguments[0])if(!0!==v(arguments[0])){var t=arguments[0].left,e=arguments[0].top;y.call(this,this,void 0===t?this.scrollLeft:~~t,void 0===e?this.scrollTop:~~e)}else{if("number"==typeof arguments[0]&&void 0===arguments[1])throw new SyntaxError("Value could not be converted");h.elementScroll.call(this,void 0!==arguments[0].left?~~arguments[0].left:"object"!=typeof arguments[0]?~~arguments[0]:this.scrollLeft,void 0!==arguments[0].top?~~arguments[0].top:void 0!==arguments[1]?~~arguments[1]:this.scrollTop)}},l.prototype.scrollBy=function(){void 0!==arguments[0]&&(!0!==v(arguments[0])?this.scroll({left:~~arguments[0].left+this.scrollLeft,top:~~arguments[0].top+this.scrollTop,behavior:arguments[0].behavior}):h.elementScroll.call(this,void 0!==arguments[0].left?~~arguments[0].left+this.scrollLeft:~~arguments[0]+this.scrollLeft,void 0!==arguments[0].top?~~arguments[0].top+this.scrollTop:~~arguments[1]+this.scrollTop))},l.prototype.scrollIntoView=function(){if(!0!==v(arguments[0])){var t,e,o,l,r,i,n=function(t){for(var e,o,l;!1==((t=t.parentNode)===d.body)&&!1===(o=u(e=t,"Y")&&m(e,"Y"),l=u(e,"X")&&m(e,"X"),o||l););return t}(this),s=n.getBoundingClientRect(),c=this.getBoundingClientRect(),a=arguments[0].inline||"nearest",f=arguments[0].block||"start";switch(a){case"start":t=c.left-s.left,r=s.left,o=c.left;break;case"center":t=c.left-s.left+c.width/2-s.width/2,r=(s.left+s.right-p.innerWidth)/2,o=(c.left+c.right-p.innerWidth)/2;break;case"end":t=c.right-s.right,r=s.right-p.innerWidth,o=c.right-p.innerWidth;break;case"nearest":o=r=t=0}switch(f){case"start":e=c.top-s.top,i=s.top,l=c.top;break;case"center":e=c.top-s.top+c.height/2-s.height/2,i=(s.top+s.bottom-p.innerHeight)/2,l=(c.top+c.bottom-p.innerHeight)/2;break;case"end":e=c.bottom-s.bottom,i=s.bottom-p.innerHeight,l=c.bottom-p.innerHeight;break;case"nearest":l=i=e=0}n!==d.body?(y.call(this,n,n.scrollLeft+t,n.scrollTop+e),"fixed"!==p.getComputedStyle(n).position&&p.scrollBy({left:r,top:i,behavior:"smooth"})):p.scrollBy({left:o,top:l,behavior:"smooth"})}else h.scrollIntoView.call(this,void 0===arguments[0]||arguments[0])}}function a(t,e){this.scrollLeft=t,this.scrollTop=e}function v(t){if(null===t||"object"!=typeof t||void 0===t.behavior||"auto"===t.behavior||"instant"===t.behavior)return!0;if("object"==typeof t&&"smooth"===t.behavior)return!1;throw new TypeError("behavior member of ScrollOptions "+t.behavior+" is not a valid value for enumeration ScrollBehavior.")}function u(t,e){return"Y"===e?t.clientHeight+r<t.scrollHeight:"X"===e?t.clientWidth+r<t.scrollWidth:void 0}function m(t,e){var o=p.getComputedStyle(t,null)["overflow"+e];return"auto"===o||"scroll"===o}function f(t){if(!s){var e,o,l,r,i=(c()-t.startTime)/n;r=i=1<i?1:i,e=.5*(1-Math.cos(Math.PI*r)),o=t.startX+(t.x-t.startX)*e,l=t.startY+(t.y-t.startY)*e,t.method.call(t.scrollable,o,l),o===t.x&&l===t.y||p.requestAnimationFrame(f.bind(p,t))}}function b(){s=!0,clearTimeout(o),o=setTimeout(i,n)}function i(){s=!1,p.removeEventListener("wheel",b),p.removeEventListener("touchmove",b)}function y(t,e,o){var l,r,i,n,s=c();t===d.body?(r=(l=p).scrollX||p.pageXOffset,i=p.scrollY||p.pageYOffset,n=h.scroll):(r=(l=t).scrollLeft,i=t.scrollTop,n=a),p.addEventListener("wheel",b,{passive:!0}),p.addEventListener("touchmove",b,{passive:!0}),f({scrollable:l,method:n,startTime:s,startX:r,startY:i,x:e,y:o})}}if("object"==typeof exports&&"undefined"!=typeof module)module.exports={polyfill:t};else if("function"==typeof define&&define.amd)define(t);else{var e="undefined"!=typeof document&&(document.currentScript||document.querySelector("script[data-polyfill]")||document.querySelector("script[data-duration]"));if(e){var o=e.dataset.polyfill,l=~~e.dataset.duration;"force"!==o&&"auto"!==o||t({force:"force"===o,duration:0<l?l:void 0})}global.polyfill=t}}();
!function(){"use strict";function t(t){var p=window,d=document;if(t=t||{},!("scrollBehavior"in d.documentElement.style&&!0!==t.force)){var o,e,l=p.HTMLElement||p.Element,n=~~t.duration||468,h={scroll:p.scroll||p.scrollTo,scrollBy:p.scrollBy,elementScroll:l.prototype.scroll||a,scrollIntoView:l.prototype.scrollIntoView},c=p.performance&&p.performance.now?p.performance.now.bind(p.performance):Date.now,r=(o=p.navigator.userAgent,new RegExp(["MSIE ","Trident/","Edge/"].join("|")).test(o)?1:0),s=!1;p.scroll=p.scrollTo=function(){void 0!==arguments[0]&&(!0!==u(arguments[0])?y.call(p,d.body,void 0!==arguments[0].left?~~arguments[0].left:p.scrollX||p.pageXOffset,void 0!==arguments[0].top?~~arguments[0].top:p.scrollY||p.pageYOffset):h.scroll.call(p,void 0!==arguments[0].left?arguments[0].left:"object"!=typeof arguments[0]?arguments[0]:p.scrollX||p.pageXOffset,void 0!==arguments[0].top?arguments[0].top:void 0!==arguments[1]?arguments[1]:p.scrollY||p.pageYOffset))},p.scrollBy=function(){void 0!==arguments[0]&&(u(arguments[0])?h.scrollBy.call(p,void 0!==arguments[0].left?arguments[0].left:"object"!=typeof arguments[0]?arguments[0]:0,void 0!==arguments[0].top?arguments[0].top:void 0!==arguments[1]?arguments[1]:0):y.call(p,d.body,~~arguments[0].left+(p.scrollX||p.pageXOffset),~~arguments[0].top+(p.scrollY||p.pageYOffset)))},l.prototype.scroll=l.prototype.scrollTo=function(){if(void 0!==arguments[0])if(!0!==u(arguments[0])){var t=arguments[0].left,o=arguments[0].top;y.call(this,this,void 0===t?this.scrollLeft:~~t,void 0===o?this.scrollTop:~~o)}else{if("number"==typeof arguments[0]&&void 0===arguments[1])throw new SyntaxError("Value could not be converted");h.elementScroll.call(this,void 0!==arguments[0].left?~~arguments[0].left:"object"!=typeof arguments[0]?~~arguments[0]:this.scrollLeft,void 0!==arguments[0].top?~~arguments[0].top:void 0!==arguments[1]?~~arguments[1]:this.scrollTop)}},l.prototype.scrollBy=function(){void 0!==arguments[0]&&(!0!==u(arguments[0])?this.scroll({left:~~arguments[0].left+this.scrollLeft,top:~~arguments[0].top+this.scrollTop,behavior:arguments[0].behavior}):h.elementScroll.call(this,void 0!==arguments[0].left?~~arguments[0].left+this.scrollLeft:~~arguments[0]+this.scrollLeft,void 0!==arguments[0].top?~~arguments[0].top+this.scrollTop:~~arguments[1]+this.scrollTop))},l.prototype.scrollIntoView=function(){if(!0!==u(arguments[0])){var t,o,e,l,r,i,n=function(t){for(var o,e,l;!1==((t=t.parentNode)===d.body)&&!1===(e=v(o=t,"Y")&&m(o,"Y"),l=v(o,"X")&&m(o,"X"),e||l););return t}(this),s=n.getBoundingClientRect(),c=this.getBoundingClientRect(),a=arguments[0].inline||"nearest",f=arguments[0].block||"start";switch(a){case"start":t=c.left-s.left,r=s.left,e=c.left;break;case"center":t=c.left-s.left+c.width/2-s.width/2,r=(s.left+s.right-p.innerWidth)/2,e=(c.left+c.right-p.innerWidth)/2;break;case"end":t=c.right-s.right,r=s.right-p.innerWidth,e=c.right-p.innerWidth;break;case"nearest":e=r=t=0}switch(f){case"start":o=c.top-s.top,i=s.top,l=c.top;break;case"center":o=c.top-s.top+c.height/2-s.height/2,i=(s.top+s.bottom-p.innerHeight)/2,l=(c.top+c.bottom-p.innerHeight)/2;break;case"end":o=c.bottom-s.bottom,i=s.bottom-p.innerHeight,l=c.bottom-p.innerHeight;break;case"nearest":l=i=o=0}n!==d.body?(y.call(this,n,n.scrollLeft+t,n.scrollTop+o),"fixed"!==p.getComputedStyle(n).position&&p.scrollBy({left:r,top:i,behavior:"smooth"})):p.scrollBy({left:e,top:l,behavior:"smooth"})}else h.scrollIntoView.call(this,void 0===arguments[0]||arguments[0])}}function a(t,o){this.scrollLeft=t,this.scrollTop=o}function u(t){if(null===t||"object"!=typeof t||void 0===t.behavior||"auto"===t.behavior||"instant"===t.behavior)return!0;if("object"==typeof t&&"smooth"===t.behavior)return!1;throw new TypeError("behavior member of ScrollOptions "+t.behavior+" is not a valid value for enumeration ScrollBehavior.")}function v(t,o){return"Y"===o?t.clientHeight+r<t.scrollHeight:"X"===o?t.clientWidth+r<t.scrollWidth:void 0}function m(t,o){var e=p.getComputedStyle(t,null)["overflow"+o];return"auto"===e||"scroll"===e}function f(t){if(!s){var o,e,l,r,i=(c()-t.startTime)/n;r=i=1<i?1:i,o=.5*(1-Math.cos(Math.PI*r)),e=t.startX+(t.x-t.startX)*o,l=t.startY+(t.y-t.startY)*o,t.method.call(t.scrollable,e,l),e===t.x&&l===t.y||p.requestAnimationFrame(f.bind(p,t))}}function b(){s=!0,clearTimeout(e),e=setTimeout(i,n)}function i(){s=!1}function y(t,o,e){var l,r,i,n,s=c();t===d.body?(r=(l=p).scrollX||p.pageXOffset,i=p.scrollY||p.pageYOffset,n=h.scroll):(r=(l=t).scrollLeft,i=t.scrollTop,n=a),p.addEventListener("wheel",b,{passive:!0,once:!0}),p.addEventListener("touchmove",b,{passive:!0,once:!0}),f({scrollable:l,method:n,startTime:s,startX:r,startY:i,x:o,y:e})}}if("object"==typeof exports&&"undefined"!=typeof module)module.exports={polyfill:t};else if("function"==typeof define&&define.amd)define(t);else{var o="undefined"!=typeof document&&(document.currentScript||document.querySelector("script[data-polyfill]")||document.querySelector("script[data-duration]"));if(o){var e=o.dataset.polyfill,l=~~o.dataset.duration;"force"!==e&&"auto"!==e||t({force:"force"===e,duration:0<l?l:void 0})}global.polyfill=t}}();

@@ -5,3 +5,3 @@ {

"description": "Smooth Scroll behavior polyfill",
"version": "0.4.2",
"version": "0.4.3",
"author": {

@@ -8,0 +8,0 @@ "name": "Dustan Kasten",

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