Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dom-autoscroller

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dom-autoscroller - npm Package Compare versions

Comparing version 2.2.2 to 2.2.3

2

dist/dom-autoscroller.js

@@ -519,3 +519,3 @@ var autoScroll = (function () {

if (rect.x === undefined) {
rext.x = rect.left;
rect.x = rect.left;
rect.y = rect.top;

@@ -522,0 +522,0 @@ }

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

var autoScroll=function(){"use strict";function e(e,n){return"undefined"==typeof e?"undefined"==typeof n?e:n:e}function n(n,t){return n=e(n,t),"function"==typeof n?function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return!!n.apply(this,t)}:n?function(){return!0}:function(){return!1}}function t(e,n){if(n=u(n,!0),!y(n))return-1;for(var t=0;t<e.length;t++)if(e[t]===n)return t;return-1}function r(e,n){return-1!==t(e,n)}function o(e,n){for(var t=0;t<n.length;t++)r(e,n[t])||e.push(n[t]);return n}function i(e){for(var n=arguments.length,t=Array(n>1?n-1:0),r=1;r<n;r++)t[r-1]=arguments[r];return t=t.map(u),o(e,t)}function a(e){for(var n=arguments.length,r=Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.map(u).reduce(function(n,r){var o=t(e,r);return o!==-1?n.concat(e.splice(o,1)):n},[])}function u(e,n){if("string"==typeof e)try{return document.querySelector(e)}catch(e){throw e}if(!y(e)&&!n)throw new TypeError(e+" is not a DOM element.");return e}function l(){var e={top:{value:0,enumerable:!0},left:{value:0,enumerable:!0},right:{value:window.innerWidth,enumerable:!0},bottom:{value:window.innerHeight,enumerable:!0},width:{value:window.innerWidth,enumerable:!0},height:{value:window.innerHeight,enumerable:!0},x:{value:0,enumerable:!0},y:{value:0,enumerable:!0}};if(Object.create)return Object.create({},e);var n={};return Object.defineProperties(n,e),n}function c(e){if(e===window)return l();try{var n=e.getBoundingClientRect();return void 0===n.x&&(rext.x=n.left,n.y=n.top),n}catch(n){throw new TypeError("Can't call getBoundingClientRect on "+e)}}function f(e,n){var t=c(n);return e.y>t.top&&e.y<t.bottom&&e.x>t.left&&e.x<t.right}function d(e){function t(n){for(var t=0;t<e.length;t++)if(e[t]===n.target){L=!0;break}L&&v(function(){return L=!1})}function o(){j=!0}function u(){j=!1,p(q),p(F)}function l(){j=!1}function f(n){if(!n)return null;if(X===n)return n;if(r(e,n))return n;for(;n=n.parentNode;)if(r(e,n))return n;return null}function d(){for(var n=null,t=0;t<e.length;t++)w(T,e[t])&&(n=e[t]);return n}function m(e){if(E.autoScroll()){var n=e.target,t=document.body;X&&!w(T,X)&&(E.scrollWhenOutside||(X=null)),n&&n.parentNode===t?n=d():(n=f(n),n||(n=d())),n&&n!==X&&(X=n),M&&(p(F),F=v(s)),X&&(p(q),q=v(h))}}function s(){y(M),p(F),F=v(s)}function h(){X&&(y(X),p(q),q=v(h))}function y(e){var n=c(e),t=void 0,r=void 0;t=T.x<n.left+E.margin?Math.floor(Math.max(-1,(T.x-n.left)/E.margin-1)*E.maxSpeed):T.x>n.right-E.margin?Math.ceil(Math.min(1,(T.x-n.right)/E.margin+1)*E.maxSpeed):0,r=T.y<n.top+E.margin?Math.floor(Math.max(-1,(T.y-n.top)/E.margin-1)*E.maxSpeed):T.y>n.bottom-E.margin?Math.ceil(Math.min(1,(T.y-n.bottom)/E.margin+1)*E.maxSpeed):0,setTimeout(function(){r&&g(e,r),t&&x(e,t)})}function g(e,n){e===window?window.scrollTo(e.pageXOffset,e.pageYOffset+n):e.scrollTop+=n}function x(e,n){e===window?window.scrollTo(e.pageXOffset+n,e.pageYOffset):e.scrollLeft+=n}var A=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},E=this,S=4,L=!1;this.margin=A.margin||-1,this.scrollWhenOutside=A.scrollWhenOutside||!1;var T={},O=b(T),j=!1;window.addEventListener("mousemove",O,!1),window.addEventListener("touchmove",O,!1),isNaN(A.maxSpeed)||(S=A.maxSpeed),this.autoScroll=n(A.autoScroll),this.destroy=function(){window.removeEventListener("mousemove",O,!1),window.removeEventListener("touchmove",O,!1),window.removeEventListener("mousedown",o,!1),window.removeEventListener("touchstart",o,!1),window.removeEventListener("mouseup",u,!1),window.removeEventListener("touchend",u,!1),window.removeEventListener("scroll",t,!0),e=[]},this.add=function(){for(var n=arguments.length,t=Array(n),r=0;r<n;r++)t[r]=arguments[r];return i.apply(void 0,[e].concat(t)),this},this.remove=function(){for(var n=arguments.length,t=Array(n),r=0;r<n;r++)t[r]=arguments[r];return a.apply(void 0,[e].concat(t))};var M=null,F=void 0;"[object Array]"!==Object.prototype.toString.call(e)&&(e=[e]),function(n){e=[],n.forEach(function(e){e===window?M=window:E.add(e)})}(e),Object.defineProperties(this,{down:{get:function(){return j}},maxSpeed:{get:function(){return S}},point:{get:function(){return T}},scrolling:{get:function(){return L}}});var X=null,q=void 0;window.addEventListener("mousedown",o,!1),window.addEventListener("touchstart",o,!1),window.addEventListener("mouseup",u,!1),window.addEventListener("touchend",u,!1),window.addEventListener("mousemove",m,!1),window.addEventListener("touchmove",m,!1),window.addEventListener("mouseleave",l,!1),window.addEventListener("scroll",t,!0)}function m(e,n){return new d(e,n)}function w(e,n,t){return t?e.y>t.top&&e.y<t.bottom&&e.x>t.left&&e.x<t.right:f(e,n)}var s=["webkit","moz","ms","o"],v=function(){for(var e=0,n=s.length;e<n&&!window.requestAnimationFrame;++e)window.requestAnimationFrame=window[s[e]+"RequestAnimationFrame"];return window.requestAnimationFrame||!function(){var e=0;window.requestAnimationFrame=function(n){var t=(new Date).getTime(),r=Math.max(0,16-t-e),o=window.setTimeout(function(){return n(t+r)},r);return e=t+r,o}}(),window.requestAnimationFrame.bind(window)}(),p=function(){for(var e=0,n=s.length;e<n&&!window.cancelAnimationFrame;++e)window.cancelAnimationFrame=window[s[e]+"CancelAnimationFrame"]||window[s[e]+"CancelRequestAnimationFrame"];return window.cancelAnimationFrame||(window.cancelAnimationFrame=function(e){window.clearTimeout(e)}),window.cancelAnimationFrame.bind(window)}(),h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},y=function(e){return null!=e&&"object"===("undefined"==typeof e?"undefined":h(e))&&1===e.nodeType&&"object"===h(e.style)&&"object"===h(e.ownerDocument)},g=function(){var e=function(e){return"function"==typeof e},n=function(e){var n=Number(e);return isNaN(n)?0:0!==n&&isFinite(n)?(n>0?1:-1)*Math.floor(Math.abs(n)):n},t=Math.pow(2,53)-1,r=function(e){var r=n(e);return Math.min(Math.max(r,0),t)},o=function(e){if(null!=e){if(["string","number","boolean","symbol"].indexOf(typeof e)>-1)return Symbol.iterator;if("undefined"!=typeof Symbol&&"iterator"in Symbol&&Symbol.iterator in e)return Symbol.iterator;if("@@iterator"in e)return"@@iterator"}},i=function(n,t){if(null!=n&&null!=t){var r=n[t];if(null==r)return;if(!e(r))throw new TypeError(r+" is not a function");return r}},a=function(e){var n=e.next(),t=Boolean(n.done);return!t&&n};return function(n){var t,u=this,l=arguments.length>1?arguments[1]:void 0;if("undefined"!=typeof l){if(!e(l))throw new TypeError("Array.from: when provided, the second argument must be a function");arguments.length>2&&(t=arguments[2])}var c,f,d=i(n,o(n));if(void 0!==d){c=e(u)?Object(new u):[];var m=d.call(n);if(null==m)throw new TypeError("Array.from requires an array-like or iterable object");f=0;for(var w,s;;){if(w=a(m),!w)return c.length=f,c;s=w.value,l?c[f]=l.call(t,s,f):c[f]=s,f++}}else{var v=Object(n);if(null==n)throw new TypeError("Array.from requires an array-like object - not null or undefined");var p=r(v.length);c=e(u)?Object(new u(p)):new Array(p),f=0;for(var h;f<p;)h=v[f],l?c[f]=l.call(t,h,f):c[f]=h,f++;c.length=p}return c}}(),b=("function"==typeof Array.from?Array.from:g,Array.isArray,Object.prototype.toString,function(e,n){n=n||{};var t;return t="function"==typeof n.allowUpdate?n.allowUpdate:function(){return!0},function(n){if(n=n||window.event,e.target=n.target||n.srcElement||n.originalTarget,e.element=this,e.type=n.type,t(n))if(n.targetTouches)e.x=n.targetTouches[0].clientX,e.y=n.targetTouches[0].clientY,e.pageX=n.pageX,e.pageY=n.pageY;else{if(null===n.pageX&&null!==n.clientX){var r=n.target&&n.target.ownerDocument||document,o=r.documentElement,i=r.body;e.pageX=n.clientX+(o&&o.scrollLeft||i&&i.scrollLeft||0)-(o&&o.clientLeft||i&&i.clientLeft||0),e.pageY=n.clientY+(o&&o.scrollTop||i&&i.scrollTop||0)-(o&&o.clientTop||i&&i.clientTop||0)}else e.pageX=n.pageX,e.pageY=n.pageY;e.x=n.clientX,e.y=n.clientY}}});return m}();
var autoScroll=function(){"use strict";function e(e,n){return"undefined"==typeof e?"undefined"==typeof n?e:n:e}function n(n,t){return n=e(n,t),"function"==typeof n?function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return!!n.apply(this,t)}:n?function(){return!0}:function(){return!1}}function t(e,n){if(n=u(n,!0),!y(n))return-1;for(var t=0;t<e.length;t++)if(e[t]===n)return t;return-1}function r(e,n){return-1!==t(e,n)}function o(e,n){for(var t=0;t<n.length;t++)r(e,n[t])||e.push(n[t]);return n}function i(e){for(var n=arguments.length,t=Array(n>1?n-1:0),r=1;r<n;r++)t[r-1]=arguments[r];return t=t.map(u),o(e,t)}function a(e){for(var n=arguments.length,r=Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.map(u).reduce(function(n,r){var o=t(e,r);return o!==-1?n.concat(e.splice(o,1)):n},[])}function u(e,n){if("string"==typeof e)try{return document.querySelector(e)}catch(e){throw e}if(!y(e)&&!n)throw new TypeError(e+" is not a DOM element.");return e}function l(){var e={top:{value:0,enumerable:!0},left:{value:0,enumerable:!0},right:{value:window.innerWidth,enumerable:!0},bottom:{value:window.innerHeight,enumerable:!0},width:{value:window.innerWidth,enumerable:!0},height:{value:window.innerHeight,enumerable:!0},x:{value:0,enumerable:!0},y:{value:0,enumerable:!0}};if(Object.create)return Object.create({},e);var n={};return Object.defineProperties(n,e),n}function c(e){if(e===window)return l();try{var n=e.getBoundingClientRect();return void 0===n.x&&(n.x=n.left,n.y=n.top),n}catch(n){throw new TypeError("Can't call getBoundingClientRect on "+e)}}function f(e,n){var t=c(n);return e.y>t.top&&e.y<t.bottom&&e.x>t.left&&e.x<t.right}function d(e){function t(n){for(var t=0;t<e.length;t++)if(e[t]===n.target){L=!0;break}L&&v(function(){return L=!1})}function o(){j=!0}function u(){j=!1,p(q),p(F)}function l(){j=!1}function f(n){if(!n)return null;if(X===n)return n;if(r(e,n))return n;for(;n=n.parentNode;)if(r(e,n))return n;return null}function d(){for(var n=null,t=0;t<e.length;t++)w(T,e[t])&&(n=e[t]);return n}function m(e){if(E.autoScroll()){var n=e.target,t=document.body;X&&!w(T,X)&&(E.scrollWhenOutside||(X=null)),n&&n.parentNode===t?n=d():(n=f(n),n||(n=d())),n&&n!==X&&(X=n),M&&(p(F),F=v(s)),X&&(p(q),q=v(h))}}function s(){y(M),p(F),F=v(s)}function h(){X&&(y(X),p(q),q=v(h))}function y(e){var n=c(e),t=void 0,r=void 0;t=T.x<n.left+E.margin?Math.floor(Math.max(-1,(T.x-n.left)/E.margin-1)*E.maxSpeed):T.x>n.right-E.margin?Math.ceil(Math.min(1,(T.x-n.right)/E.margin+1)*E.maxSpeed):0,r=T.y<n.top+E.margin?Math.floor(Math.max(-1,(T.y-n.top)/E.margin-1)*E.maxSpeed):T.y>n.bottom-E.margin?Math.ceil(Math.min(1,(T.y-n.bottom)/E.margin+1)*E.maxSpeed):0,setTimeout(function(){r&&g(e,r),t&&A(e,t)})}function g(e,n){e===window?window.scrollTo(e.pageXOffset,e.pageYOffset+n):e.scrollTop+=n}function A(e,n){e===window?window.scrollTo(e.pageXOffset+n,e.pageYOffset):e.scrollLeft+=n}var x=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},E=this,S=4,L=!1;this.margin=x.margin||-1,this.scrollWhenOutside=x.scrollWhenOutside||!1;var T={},O=b(T),j=!1;window.addEventListener("mousemove",O,!1),window.addEventListener("touchmove",O,!1),isNaN(x.maxSpeed)||(S=x.maxSpeed),this.autoScroll=n(x.autoScroll),this.destroy=function(){window.removeEventListener("mousemove",O,!1),window.removeEventListener("touchmove",O,!1),window.removeEventListener("mousedown",o,!1),window.removeEventListener("touchstart",o,!1),window.removeEventListener("mouseup",u,!1),window.removeEventListener("touchend",u,!1),window.removeEventListener("scroll",t,!0),e=[]},this.add=function(){for(var n=arguments.length,t=Array(n),r=0;r<n;r++)t[r]=arguments[r];return i.apply(void 0,[e].concat(t)),this},this.remove=function(){for(var n=arguments.length,t=Array(n),r=0;r<n;r++)t[r]=arguments[r];return a.apply(void 0,[e].concat(t))};var M=null,F=void 0;"[object Array]"!==Object.prototype.toString.call(e)&&(e=[e]),function(n){e=[],n.forEach(function(e){e===window?M=window:E.add(e)})}(e),Object.defineProperties(this,{down:{get:function(){return j}},maxSpeed:{get:function(){return S}},point:{get:function(){return T}},scrolling:{get:function(){return L}}});var X=null,q=void 0;window.addEventListener("mousedown",o,!1),window.addEventListener("touchstart",o,!1),window.addEventListener("mouseup",u,!1),window.addEventListener("touchend",u,!1),window.addEventListener("mousemove",m,!1),window.addEventListener("touchmove",m,!1),window.addEventListener("mouseleave",l,!1),window.addEventListener("scroll",t,!0)}function m(e,n){return new d(e,n)}function w(e,n,t){return t?e.y>t.top&&e.y<t.bottom&&e.x>t.left&&e.x<t.right:f(e,n)}var s=["webkit","moz","ms","o"],v=function(){for(var e=0,n=s.length;e<n&&!window.requestAnimationFrame;++e)window.requestAnimationFrame=window[s[e]+"RequestAnimationFrame"];return window.requestAnimationFrame||!function(){var e=0;window.requestAnimationFrame=function(n){var t=(new Date).getTime(),r=Math.max(0,16-t-e),o=window.setTimeout(function(){return n(t+r)},r);return e=t+r,o}}(),window.requestAnimationFrame.bind(window)}(),p=function(){for(var e=0,n=s.length;e<n&&!window.cancelAnimationFrame;++e)window.cancelAnimationFrame=window[s[e]+"CancelAnimationFrame"]||window[s[e]+"CancelRequestAnimationFrame"];return window.cancelAnimationFrame||(window.cancelAnimationFrame=function(e){window.clearTimeout(e)}),window.cancelAnimationFrame.bind(window)}(),h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},y=function(e){return null!=e&&"object"===("undefined"==typeof e?"undefined":h(e))&&1===e.nodeType&&"object"===h(e.style)&&"object"===h(e.ownerDocument)},g=function(){var e=function(e){return"function"==typeof e},n=function(e){var n=Number(e);return isNaN(n)?0:0!==n&&isFinite(n)?(n>0?1:-1)*Math.floor(Math.abs(n)):n},t=Math.pow(2,53)-1,r=function(e){var r=n(e);return Math.min(Math.max(r,0),t)},o=function(e){if(null!=e){if(["string","number","boolean","symbol"].indexOf(typeof e)>-1)return Symbol.iterator;if("undefined"!=typeof Symbol&&"iterator"in Symbol&&Symbol.iterator in e)return Symbol.iterator;if("@@iterator"in e)return"@@iterator"}},i=function(n,t){if(null!=n&&null!=t){var r=n[t];if(null==r)return;if(!e(r))throw new TypeError(r+" is not a function");return r}},a=function(e){var n=e.next(),t=Boolean(n.done);return!t&&n};return function(n){var t,u=this,l=arguments.length>1?arguments[1]:void 0;if("undefined"!=typeof l){if(!e(l))throw new TypeError("Array.from: when provided, the second argument must be a function");arguments.length>2&&(t=arguments[2])}var c,f,d=i(n,o(n));if(void 0!==d){c=e(u)?Object(new u):[];var m=d.call(n);if(null==m)throw new TypeError("Array.from requires an array-like or iterable object");f=0;for(var w,s;;){if(w=a(m),!w)return c.length=f,c;s=w.value,l?c[f]=l.call(t,s,f):c[f]=s,f++}}else{var v=Object(n);if(null==n)throw new TypeError("Array.from requires an array-like object - not null or undefined");var p=r(v.length);c=e(u)?Object(new u(p)):new Array(p),f=0;for(var h;f<p;)h=v[f],l?c[f]=l.call(t,h,f):c[f]=h,f++;c.length=p}return c}}(),b=("function"==typeof Array.from?Array.from:g,Array.isArray,Object.prototype.toString,function(e,n){n=n||{};var t;return t="function"==typeof n.allowUpdate?n.allowUpdate:function(){return!0},function(n){if(n=n||window.event,e.target=n.target||n.srcElement||n.originalTarget,e.element=this,e.type=n.type,t(n))if(n.targetTouches)e.x=n.targetTouches[0].clientX,e.y=n.targetTouches[0].clientY,e.pageX=n.pageX,e.pageY=n.pageY;else{if(null===n.pageX&&null!==n.clientX){var r=n.target&&n.target.ownerDocument||document,o=r.documentElement,i=r.body;e.pageX=n.clientX+(o&&o.scrollLeft||i&&i.scrollLeft||0)-(o&&o.clientLeft||i&&i.clientLeft||0),e.pageY=n.clientY+(o&&o.scrollTop||i&&i.scrollTop||0)-(o&&o.clientTop||i&&i.clientTop||0)}else e.pageX=n.pageX,e.pageY=n.pageY;e.x=n.clientX,e.y=n.clientY}}});return m}();
{
"name": "dom-autoscroller",
"version": "2.2.2",
"version": "2.2.3",
"description": "Auto scroll dom elements",

@@ -26,3 +26,3 @@ "main": "dist/bundle.js",

"create-point-cb": "^1.0.0",
"dom-plane": "^1.0.0",
"dom-plane": "^1.0.1",
"dom-set": "^1.0.1",

@@ -29,0 +29,0 @@ "type-func": "^1.0.1"

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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