GitHub Network graph Intercept arrow keys

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.

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

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

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==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();
      }
    }
  }
});