AutoScroll2

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

目前为 2020-08-15 提交的版本。查看 最新版本

// ==UserScript==
// @name        AutoScroll2
// @description AutoScroll - 自动向下滚动页面,支持快捷键
// @include     http*
// @version     2020/04/21
// @author      Eilen https://github.com/EilenC
// @grant       none
// @namespace https://gf.qytechs.cn/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);

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址