您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
将 'ww' 映射为 Page Up 和 'ss' 映射为 Page Down
当前为
// ==UserScript== // @name Double W and Double S Key Page Scroll // @namespace http://tampermonkey.net/ // @version 0.1 // @description 将 'ww' 映射为 Page Up 和 'ss' 映射为 Page Down // @author yueli // @match *://*/* // @license MIT // @grant none // ==/UserScript== (function() { 'use strict'; let wCount = 0; let sCount = 0; const resetTime = 500; // 毫秒 document.addEventListener('keydown', function(event) { if (event.key === 'w') { wCount++; sCount = 0; setTimeout(() => wCount = 0, resetTime); if (wCount === 2) { window.scrollBy(0, -window.innerHeight); wCount = 0; } } else if (event.key === 's') { sCount++; wCount = 0; setTimeout(() => sCount = 0, resetTime); if (sCount === 2) { window.scrollBy(0, window.innerHeight); sCount = 0; } } }); })();