Skip to content

Instantly share code, notes, and snippets.

@Akdeniz
Last active December 7, 2017 09:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Akdeniz/4e4fb92d310cde764e1b410c7eaeade7 to your computer and use it in GitHub Desktop.
Save Akdeniz/4e4fb92d310cde764e1b410c7eaeade7 to your computer and use it in GitHub Desktop.
Prevents you accidentally running and submitting questions on leetcode.
// ==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