Created
August 13, 2014 03:00
-
-
Save mamacdon/ac192ba0692d27fb2527 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Disable keyboard shortcuts | |
// @description Stop websites from highjacking keyboard shortcuts | |
// | |
// @run-at document-start | |
// @include * | |
// @grant none | |
// ==/UserScript== | |
keycodes = [191] // Keycode for '/', 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; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment