Skip to content

Commit

Permalink
Remove auto-scroll element on stop
Browse files Browse the repository at this point in the history
  • Loading branch information
hackermare committed Apr 11, 2022
1 parent 1b87346 commit 2102e32
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions AutoScroll.plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @name AutoScroll
* @author programmerpony
* @description Autoscroll with the mouse wheel button on GNU/Linux and macOS!
* @version 0.2.2
* @version 0.2.3
* @updateUrl https://raw.githubusercontent.com/programmer-pony/BD-AutoScroll/main/AutoScroll.plugin.js
* @authorLink https://fosstodon.org/@Luna
* @donate https://ko-fi.com/programmerpony
Expand Down Expand Up @@ -50,6 +50,7 @@ let state = {
click: false,
scrolling: false
}
let outer;
let inner;
const math = {
hypot: (x, y) => {
Expand Down Expand Up @@ -111,7 +112,7 @@ module.exports = class AutoScroll {
return 'AutoScroll';
}
getVersion() {
return '0.2.2';
return '0.2.3';
}
getAuthor() {
return 'programmerpony';
Expand All @@ -123,9 +124,9 @@ module.exports = class AutoScroll {
start() {
htmlNode = document.documentElement;
bodyNode = document.body ? document.body : htmlNode;
let outer = document.createElementNS('http://www.w3.org/1999/xhtml', 'auto-scroll');
outer = document.createElement('auto-scroll');
let shadow = outer.attachShadow ? outer.attachShadow({ mode: 'closed' }) : outer.createShadowRoot();
inner = document.createElementNS('http://www.w3.org/1999/xhtml', 'div');
inner = document.createElement('div');
inner.style.setProperty('transform', 'translateZ(0)');
inner.style.setProperty('display', 'none');
inner.style.setProperty('position', 'fixed');
Expand All @@ -140,6 +141,7 @@ module.exports = class AutoScroll {
addEventListener('mousedown', mouseListener, true);
}
stop() {
outer.remove();
removeEventListener('mousedown', mouseListener, true);
}

Expand Down

0 comments on commit 2102e32

Please sign in to comment.