Last active
December 7, 2017 09:36
-
-
Save Akdeniz/4e4fb92d310cde764e1b410c7eaeade7 to your computer and use it in GitHub Desktop.
Prevents you accidentally running and submitting questions on leetcode.
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 leetcode shortcuts(ctrl+' and ctrl+Enter) | |
// @description Prevents accidentally running and submitting questions. | |
// @version 0.1 | |
// @author akdeniz | |
// @match https://leetcode.com/* | |
// @run-at document-start | |
// @include * | |
// @grant none | |
// ==/UserScript== | |
keycodes = [222,13]; | |
(window.opera ? document.body : document).addEventListener('keydown', function(e) { | |
// alert(e.keyCode ); //uncomment to find more keyCodes | |
if (keycodes.indexOf(e.keyCode) != -1 && e.ctrlKey) { | |
e.cancelBubble = true; | |
e.stopImmediatePropagation(); | |
alert("Gotcha!"); //ucomment to check if it's seeing the combo | |
} | |
return false; | |
}, !window.opera); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment