您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Stops the arrow keys from scrolling the page, because GitHub forgot to use "e.preventDefault();" when they made the keyboard shortcuts for the Network graph.
// ==UserScript== // @name GitHub Network graph Intercept arrow keys // @namespace Violentmonkey Scripts // @match https://github.com/* // @grant none // @version 1.0 // @description Stops the arrow keys from scrolling the page, because GitHub forgot to use "e.preventDefault();" when they made the keyboard shortcuts for the Network graph. // @license MIT // @inject-into content // ==/UserScript== const regex = /^https:\/\/github\.com\/\S+\/network$/; document.addEventListener("keydown", function(e){ if (e.keyCode==37 || e.keyCode==38 || e.keyCode==39 || e.keyCode==40){ if (document.location.href.match(regex)){ if(document.activeElement.tagName!="INPUT"){ e.preventDefault(); } } } });