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.1.2 to 2.1.3

7

dist/bundle.es.js

@@ -135,2 +135,4 @@ import createPointCB from 'create-point-cb';

window.addEventListener('mouseleave', onMouseOut, false);
function onDown() {

@@ -143,4 +145,9 @@ down = true;

cancelFrame(animationFrame);
cancelFrame(windowAnimationFrame);
}
function onMouseOut() {
down = false;
}
function getTarget(target) {

@@ -147,0 +154,0 @@ if (!target) {

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

window.addEventListener('mouseleave', onMouseOut, false);
function onDown() {

@@ -147,4 +149,9 @@ down = true;

cancelFrame(animationFrame);
cancelFrame(windowAnimationFrame);
}
function onMouseOut() {
down = false;
}
function getTarget(target) {

@@ -151,0 +158,0 @@ if (!target) {

@@ -195,2 +195,4 @@ var autoScroll = (function () {

window.addEventListener('mouseleave', onMouseOut, false);
function onDown() {

@@ -203,4 +205,9 @@ down = true;

cancelFrame(animationFrame);
cancelFrame(windowAnimationFrame);
}
function onMouseOut() {
down = false;
}
function getTarget(target) {

@@ -207,0 +214,0 @@ if (!target) {

2

dist/dom-autoscroller.min.js

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

var autoScroll=function(){"use strict";function e(e){function t(e){return"string"==typeof e?document.querySelector(e):e}function a(){S=!0}function l(){S=!1,u(Y)}function c(t){if(!t)return null;if(X===t)return t;for(var n=0;n<e.length;n++)if(e[n]===t)return t;for(;t=t.parentNode;)for(var n=0;n<e.length;n++)if(e[n]===t)return t;return null}function d(){for(var t=null,n=0;n<e.length;n++)o(L,e[n])&&(t=e[n]);return t}function f(e){if(p.autoScroll()){var t=e.target,n=document.body;X&&!o(L,X)&&(X=null),t&&t.parentNode===n?X=d():(t=c(t),X=t?t:d()),x&&(u(T),T=r(s)),X&&(u(Y),Y=r(m))}}function s(){w(x),u(T),T=r(s)}function m(){X&&(w(X),u(Y),Y=r(m))}function w(e){var t=n(e),o=void 0,i=void 0;o=L.x<t.left+p.margin?Math.floor(Math.max(-1,(L.x-t.left)/p.margin-1)*p.maxSpeed):L.x>t.right-p.margin?Math.ceil(Math.min(1,(L.x-t.right)/p.margin+1)*p.maxSpeed):0,i=L.y<t.top+p.margin?Math.floor(Math.max(-1,(L.y-t.top)/p.margin-1)*p.maxSpeed):L.y>t.bottom-p.margin?Math.ceil(Math.min(1,(L.y-t.bottom)/p.margin+1)*p.maxSpeed):0,setTimeout(function(){i&&h(e,i),o&&g(e,o)})}function h(e,t){e===window?window.scrollTo(e.pageXOffset,e.pageYOffset+t):e.scrollTop+=t}function g(e,t){e===window?window.scrollTo(e.pageXOffset+t,e.pageYOffset):e.scrollLeft+=t}var v=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},p=this,y=4;this.margin=v.margin||-1,this.scrolling=!1,this.scrollWhenOutside=v.scrollWhenOutside||!1;var L={},E=i(L),S=!1;window.addEventListener("mousemove",E,!1),window.addEventListener("touchmove",E,!1),isNaN(v.maxSpeed)||(y=v.maxSpeed),"boolean"==typeof v.autoScroll?this.autoScroll=v.autoScroll?function(){return!0}:function(){return!1}:"undefined"==typeof v.autoScroll?this.autoScroll=function(){return!1}:"function"==typeof v.autoScroll&&(this.autoScroll=v.autoScroll),this.destroy=function(){window.removeEventListener("mousemove",E,!1),window.removeEventListener("touchmove",E,!1),window.removeEventListener("mousedown",a,!1),window.removeEventListener("touchstart",a,!1),window.removeEventListener("mouseup",l,!1),window.removeEventListener("touchend",l,!1),e=[]},this.add=function(n){n=t(n);for(var o=0;o<e.length;o++)if(e[o]===n)return this;return e.push(n),this},this.remove=function(n){n=t(n);for(var o=0;o<e.length;o++)if(n===e[o])return e.splice(o,1),this;return this};var x=null,T=void 0;!function(t){e=[],t.forEach(function(e){e===window?x=window:p.add(e)})}(e),Object.defineProperties(this,{down:{get:function(){return S}},maxSpeed:{get:function(){return y}}});var X=null,Y=void 0;window.addEventListener("mousedown",a,!1),window.addEventListener("touchstart",a,!1),window.addEventListener("mouseup",l,!1),window.addEventListener("touchend",l,!1),window.addEventListener("mousemove",f,!1),window.addEventListener("touchmove",f,!1)}function t(t,n){return new e(t,n)}function n(e){if(e===window)return{top:0,left:0,right:window.innerWidth,bottom:window.innerHeight,width:window.innerWidth,height:window.innerHeight};try{return e.getBoundingClientRect()}catch(t){throw new TypeError("Can't call getBoundingClientRect on "+e)}}function o(e,t,o){return o=o||n(t),e.y>o.top&&e.y<o.bottom&&e.x>o.left&&e.x<o.right}var i=function(e){return function(t){if(t=t||window.event,e.target=t.target||t.srcElement||t.originalTarget,e.element=this,e.type=t.type,t.targetTouches)e.x=t.targetTouches[0].clientX,e.y=t.targetTouches[0].clientY,e.pageX=t.pageX,e.pageY=t.pageY;else{if(null===t.pageX&&null!==t.clientX){var n=t.target&&t.target.ownerDocument||document,o=n.documentElement,i=n.body;e.pageX=t.clientX+(o&&o.scrollLeft||i&&i.scrollLeft||0)-(o&&o.clientLeft||i&&i.clientLeft||0),e.pageY=t.clientY+(o&&o.scrollTop||i&&i.scrollTop||0)-(o&&o.clientTop||i&&i.clientTop||0)}else e.pageX=t.pageX,e.pageY=t.pageY;e.x=t.clientX,e.y=t.clientY}}},r=function(){return requestAnimationFrame?requestAnimationFrame:function(e){return setTimeout(e)}}(),u=function(){return cancelAnimationFrame?cancelAnimationFrame:clearTimeout}();return t}();
var autoScroll=function(){"use strict";function e(e){function t(e){return"string"==typeof e?document.querySelector(e):e}function a(){x=!0}function l(){x=!1,u(b),u(X)}function c(){x=!1}function d(t){if(!t)return null;if(Y===t)return t;for(var n=0;n<e.length;n++)if(e[n]===t)return t;for(;t=t.parentNode;)for(var n=0;n<e.length;n++)if(e[n]===t)return t;return null}function f(){for(var t=null,n=0;n<e.length;n++)o(E,e[n])&&(t=e[n]);return t}function s(e){if(y.autoScroll()){var t=e.target,n=document.body;Y&&!o(E,Y)&&(Y=null),t&&t.parentNode===n?Y=f():(t=d(t),Y=t?t:f()),T&&(u(X),X=r(m)),Y&&(u(b),b=r(w))}}function m(){h(T),u(X),X=r(m)}function w(){Y&&(h(Y),u(b),b=r(w))}function h(e){var t=n(e),o=void 0,i=void 0;o=E.x<t.left+y.margin?Math.floor(Math.max(-1,(E.x-t.left)/y.margin-1)*y.maxSpeed):E.x>t.right-y.margin?Math.ceil(Math.min(1,(E.x-t.right)/y.margin+1)*y.maxSpeed):0,i=E.y<t.top+y.margin?Math.floor(Math.max(-1,(E.y-t.top)/y.margin-1)*y.maxSpeed):E.y>t.bottom-y.margin?Math.ceil(Math.min(1,(E.y-t.bottom)/y.margin+1)*y.maxSpeed):0,setTimeout(function(){i&&g(e,i),o&&v(e,o)})}function g(e,t){e===window?window.scrollTo(e.pageXOffset,e.pageYOffset+t):e.scrollTop+=t}function v(e,t){e===window?window.scrollTo(e.pageXOffset+t,e.pageYOffset):e.scrollLeft+=t}var p=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},y=this,L=4;this.margin=p.margin||-1,this.scrolling=!1,this.scrollWhenOutside=p.scrollWhenOutside||!1;var E={},S=i(E),x=!1;window.addEventListener("mousemove",S,!1),window.addEventListener("touchmove",S,!1),isNaN(p.maxSpeed)||(L=p.maxSpeed),"boolean"==typeof p.autoScroll?this.autoScroll=p.autoScroll?function(){return!0}:function(){return!1}:"undefined"==typeof p.autoScroll?this.autoScroll=function(){return!1}:"function"==typeof p.autoScroll&&(this.autoScroll=p.autoScroll),this.destroy=function(){window.removeEventListener("mousemove",S,!1),window.removeEventListener("touchmove",S,!1),window.removeEventListener("mousedown",a,!1),window.removeEventListener("touchstart",a,!1),window.removeEventListener("mouseup",l,!1),window.removeEventListener("touchend",l,!1),e=[]},this.add=function(n){n=t(n);for(var o=0;o<e.length;o++)if(e[o]===n)return this;return e.push(n),this},this.remove=function(n){n=t(n);for(var o=0;o<e.length;o++)if(n===e[o])return e.splice(o,1),this;return this};var T=null,X=void 0;!function(t){e=[],t.forEach(function(e){e===window?T=window:y.add(e)})}(e),Object.defineProperties(this,{down:{get:function(){return x}},maxSpeed:{get:function(){return L}}});var Y=null,b=void 0;window.addEventListener("mousedown",a,!1),window.addEventListener("touchstart",a,!1),window.addEventListener("mouseup",l,!1),window.addEventListener("touchend",l,!1),window.addEventListener("mousemove",s,!1),window.addEventListener("touchmove",s,!1),window.addEventListener("mouseleave",c,!1)}function t(t,n){return new e(t,n)}function n(e){if(e===window)return{top:0,left:0,right:window.innerWidth,bottom:window.innerHeight,width:window.innerWidth,height:window.innerHeight};try{return e.getBoundingClientRect()}catch(t){throw new TypeError("Can't call getBoundingClientRect on "+e)}}function o(e,t,o){return o=o||n(t),e.y>o.top&&e.y<o.bottom&&e.x>o.left&&e.x<o.right}var i=function(e){return function(t){if(t=t||window.event,e.target=t.target||t.srcElement||t.originalTarget,e.element=this,e.type=t.type,t.targetTouches)e.x=t.targetTouches[0].clientX,e.y=t.targetTouches[0].clientY,e.pageX=t.pageX,e.pageY=t.pageY;else{if(null===t.pageX&&null!==t.clientX){var n=t.target&&t.target.ownerDocument||document,o=n.documentElement,i=n.body;e.pageX=t.clientX+(o&&o.scrollLeft||i&&i.scrollLeft||0)-(o&&o.clientLeft||i&&i.clientLeft||0),e.pageY=t.clientY+(o&&o.scrollTop||i&&i.scrollTop||0)-(o&&o.clientTop||i&&i.clientTop||0)}else e.pageX=t.pageX,e.pageY=t.pageY;e.x=t.clientX,e.y=t.clientY}}},r=function(){return requestAnimationFrame?requestAnimationFrame:function(e){return setTimeout(e)}}(),u=function(){return cancelAnimationFrame?cancelAnimationFrame:clearTimeout}();return t}();
{
"name": "dom-autoscroller",
"version": "2.1.2",
"version": "2.1.3",
"description": "Auto scroll dom elements",

@@ -5,0 +5,0 @@ "main": "dist/bundle.js",

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