Created
May 1, 2011 00:03
-
-
Save Mardak/950116 to your computer and use it in GitHub Desktop.
Prevent the page from seeing "j" presses
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
https://github.com/Mardak/restartless/blob/watchWindows/bootstrap.js | |
diff --git a/bootstrap.js b/bootstrap.js | |
index d9f353c..d2a3cd8 100644 | |
--- a/bootstrap.js | |
+++ b/bootstrap.js | |
@@ -150,7 +150,17 @@ function unload(callback, container) { | |
/** | |
* Handle the add-on being activated on install/enable | |
*/ | |
-function startup(data, reason) {} | |
+function startup(data, reason) { | |
+ watchWindows(function(window) { | |
+ let noJ = function(event) { | |
+ if (String.fromCharCode(event.charCode) == "j") | |
+ event.stopPropagation(); | |
+ }; | |
+ | |
+ window.gBrowser.addEventListener("keypress", noJ, true); | |
+ unload(function() window.gBrowser.removeEventListener("keypress", noJ, true)); | |
+ }); | |
+} | |
/** | |
* Handle the add-on being deactivated on uninstall/disable |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment