1. 程式人生 > >how to disable github hotkeys/keyboard shortcuts

how to disable github hotkeys/keyboard shortcuts

Tampermonkey, The chrome app, is able to achieve this. The script is as following.

// ==UserScript==
// @name           Disable keyboard shortcuts at github
// @description    Stop websites from highjacking keyboard shortcuts
//
// @run-at         document-start
// @include        *github.com*
// @grant          none
// Disable keyboard shortcuts on GitHub? - Web Applications Stack Exchange // https://webapps.stackexchange.com/questions/51256/disable-keyboard-shortcuts-on-github // where to find keycodes // JavaScript Event KeyCodes // http://keycode.info/ // ==/UserScript== keycodes = [83] // Keycode for 's', add more keycodes to disable other key captures
document.addEventListener('keydown', function(e) { // alert(e.keyCode); //uncomment to find out the keycode for any given key if (keycodes.indexOf(e.keyCode) != -1) { e.cancelBubble = true; e.stopImmediatePropagation(); } return false; });

step by step

create a new script

這裡寫圖片描述

paste the script

The previous scrip just disable the key s.
這裡寫圖片描述

save the script

After saving the script and refreshing the github page, the keyboard shortcut s in github is disabled.

ref