Skip to content

Instantly share code, notes, and snippets.

@relrod
Last active August 29, 2015 14:05
Show Gist options
  • Save relrod/5857df6cb4892b88c0f8 to your computer and use it in GitHub Desktop.
Save relrod/5857df6cb4892b88c0f8 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Disable Ctrl+s and Ctrl+t interceptions
// @description Stop websites from highjacking keyboard shortcuts
//
// @run-at document-start
// @include *
// @grant none
// ==/UserScript==
// This was taken from here: http://superuser.com/a/670040/307969 and modified slightly.
keycodes = [9, 83, 84];
(window.opera ? document.body : document).addEventListener('keydown', function(e) {
if (keycodes.indexOf(e.keyCode) != -1 && e.ctrlKey) {
e.cancelBubble = true;
e.stopImmediatePropagation();
}
return false;
}, !window.opera);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment