There are 1 previous version of this script.
// ==UserScript==
// @name Scrollbar Anywhere
// @description Use the scrollbar from anywhere on the page, or mimic grab-n-drag style scrolling
// @namespace aeosynth
// @include *
// ==/UserScript==
const grabndrag = false// <-- user preference
var X, Y, ratioX, ratioY
window.addEventListener('mousedown', function(e) {if (e.button == 1) start(e)}, true)
function start(e) {
X = e.clientX
Y = e.clientY
ratioX = grabndrag ? -1 : (window.innerWidth + window.scrollMaxX) / window.innerWidth
ratioY = grabndrag ? -1 : (window.innerHeight + window.scrollMaxY) / window.innerHeight
window.addEventListener('mousemove', move, true)
window.addEventListener('mouseup', end, true)
}
function move(e) {
window.scrollBy( ratioX * (e.clientX - X), ratioY * (e.clientY - Y) )
X = e.clientX
Y = e.clientY
}
function end() {
window.removeEventListener('mousemove', move, true)
window.removeEventListener('mouseup', end, true)
}
