dom-autoscroller
Advanced tools
Comparing version 1.3.1 to 1.4.0
@@ -1,2 +0,2 @@ | ||
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.autoScroller = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.autoScroll = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
var createPointCB = require('create-point-cb'); | ||
@@ -3,0 +3,0 @@ |
@@ -1,2 +0,2 @@ | ||
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.autoScroller = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.autoScroll = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
function AutoScroller(e,t){function n(){w=!0}function o(){w=!1}function i(t){if(s.autoScroll()&&t.target){var n,o=t.target;if(!h||!inside(c,h))if(!h&&o){for(h=null;o=o.parentNode;)for(var i=0;i<e.length;i++)if(e[i]===o&&inside(c,e[i])){h=e[i];break}}else{n=h,h=null;for(var i=0;i<e.length;i++)e[i]!==n&&inside(c,e[i])&&(h=e[i])}f&&r(f),h&&r(h)}}function r(e){var t=getRect(e);c.y<t.top+s.margin?l(e,-1,t):c.y>t.bottom-s.margin&&l(e,1,t),c.x<t.left+s.margin?u(e,-1,t):c.x>t.right-s.margin&&u(e,1,t)}function l(e,t,n){s.autoScroll()&&(s.scrollWhenOutside||inside(c,e,n))&&(e===window?window.scrollTo(e.pageXOffset,e.pageYOffset+t):e.scrollTop=e.scrollTop+t,setTimeout(function(){c.y<n.top+s.margin?l(e,t,n):c.y>n.bottom-s.margin&&l(e,t,n)},s.interval))}function u(e,t,n){s.autoScroll()&&(s.scrollWhenOutside||inside(c,e,n))&&(e===window?window.scrollTo(e.pageXOffset+t,e.pageYOffset):e.scrollLeft=e.scrollLeft+t,setTimeout(function(){c.x<n.left+s.margin?u(e,t,n):c.x>n.right-s.margin&&u(e,t,n)},s.interval))}var s=this,d=2;t=t||{},this.margin=t.margin||-1,this.scrolling=!1,this.scrollWhenOutside=t.scrollWhenOutside||!1;var c={},a=createPointCB(c),w=!1;window.addEventListener("mousemove",a,!1),window.addEventListener("touchmove",a,!1),isNaN(t.pixels)||(d=t.pixels),"boolean"==typeof t.autoScroll?this.autoScroll=t.autoScroll?function(){return!0}:function(){return!1}:"undefined"==typeof t.autoScroll?this.autoScroll=function(){return!1}:"function"==typeof t.autoScroll&&(this.autoScroll=t.autoScroll),this.destroy=function(){window.removeEventListener("mousemove",a,!1),window.removeEventListener("touchmove",a,!1),window.removeEventListener("mousedown",n,!1),window.removeEventListener("touchstart",n,!1),window.removeEventListener("mouseup",o,!1),window.removeEventListener("touchend",o,!1)};for(var f=null,v=[],g=0;g<e.length;g++){if(e[g]===window){f=window;break}v.push(e[g])}e=v,v=null,Object.defineProperties(this,{down:{get:function(){return w}},interval:{get:function(){return 1/d*1e3}},pixels:{set:function(e){d=e},get:function(){return d}}}),window.addEventListener("mousedown",n,!1),window.addEventListener("touchstart",n,!1),window.addEventListener("mouseup",o,!1),window.addEventListener("touchend",o,!1);var h;window.addEventListener("mousemove",i,!1),window.addEventListener("touchmove",i,!1)}function getRect(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 inside(e,t,n){return n=n||getRect(t),e.y>n.top&&e.y<n.bottom&&e.x>n.left&&e.x<n.right}var createPointCB=require("create-point-cb");module.exports=function(e,t){return new AutoScroller(e,t)}; | ||
@@ -3,0 +3,0 @@ },{"create-point-cb":2}],2:[function(require,module,exports){ |
{ | ||
"name": "dom-autoscroller", | ||
"version": "1.3.1", | ||
"version": "1.4.0", | ||
"description": "Auto scroll dom elements", | ||
@@ -11,4 +11,4 @@ "main": "index.js", | ||
"test": "echo \"Error: no test specified\" && exit 1", | ||
"build": "browserify index.js --standalone autoScroller > dist/dom-autoscroller.js", | ||
"minify": "browserify index.js -d -p [minifyify --no-map] --standalone autoScroller > dist/dom-autoscroller.min.js", | ||
"build": "browserify index.js --standalone autoScroll > dist/dom-autoscroller.js", | ||
"minify": "browserify index.js -d -p [minifyify --no-map] --standalone autoScroll > dist/dom-autoscroller.min.js", | ||
"gadd": "git add dist", | ||
@@ -15,0 +15,0 @@ "lint": "jshint .", |
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
27043