AutoScroll2

AutoScroll - 自动向下滚动页面,支持快捷键

目前為 2020-08-15 提交的版本,檢視 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name        AutoScroll2
// @description AutoScroll - 自动向下滚动页面,支持快捷键
// @include     http*
// @version     2020/04/21
// @author      Eilen https://github.com/EilenC
// @grant       none
// @namespace https://greasyfork.org/users/319354
// ==/UserScript==

;(function(document) {
    var enable = false;
    var handler = 0;
    var time = 200;
    var step = 1;
    var keyNum=1;
    function keyd(e){
        console.log(e.key);
        if(e.key == "`"){
            keyNum++;
            if(keyNum%2 == 1){
                enable = !enable;
                clearTimeout(handler);
                if (enable) aScroll();
            }
        }else if(e.key == "ArrowRight"){
            time -= 20;
        }else if(e.key == "ArrowLeft"){
            time += 20;
        }
    }

    document.body.removeEventListener('keydown', keyd);
    document.body.addEventListener('keydown', keyd);

    var aScroll = function() {
        if (enable) document.documentElement.scrollTop += 1;
        handler = setTimeout(aScroll, time);
    };
})(document);