Auto scroller

use alt= to scroll down, alt- to scroll up(both can be faster by pressing more), and alt+0 to stop.

目前為 2019-06-18 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Auto scroller
// @namespace    https://greasyfork.org/zh-TW/users/11333-bendwarn
// @version      0.1
// @description  use alt= to scroll down, alt- to scroll up(both can be faster by pressing more), and alt+0 to stop.
// @author       bendwarn
// @match        *://*/*
// @run-at       document-idle
// @license      MIT License
// ==/UserScript==
let intervalid = null
let time = 16
let speed = 0
let move = _ => {document.body.scrollTop += speed}
document.body.onkeydown = e => {
  if (e.altKey) {
    let key = e.key
    if (key == '+' || key == '=' || key == '-') {
      speed += (key == '-') ? -2 : 2
      if (intervalid === null) intervalid = setInterval(move, time)
      else {
        clearInterval(intervalid)
        if (speed) intervalid = setInterval(move, time)
        else intervalid = null
      }
    } else if (key == '0') {
      clearInterval(intervalid)
      intervalid = null
      speed = 0
    }
  }
}