JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
numbered links: don't bind ^C
authorJason Woofenden <jason@jasonwoof.com>
Wed, 2 Apr 2014 21:31:37 +0000 (17:31 -0400)
committerJason Woofenden <jason@jasonwoof.com>
Tue, 24 Mar 2015 15:29:50 +0000 (11:29 -0400)
numbered_links.user.js

index ea6eff5..09684c0 100644 (file)
@@ -361,19 +361,11 @@ function init() {
        document.addEventListener(
                'keydown',
                function(e) {
        document.addEventListener(
                'keydown',
                function(e) {
-                       // [de]activate on ^C
                        // deactivate on ESC
                        // deactivate on ESC
-                       if(
-                               (e.ctrlKey && e.keyCode == 67)
-                               || (e.keyCode == 27 && active == 1)
-                       ) {
-                               if(active) {
-                                       got = '';
-                                       removeAllHints();
-                               } else {
-                                       followLinks(got);
-                               }
-                               active = 1 - active;
+                       if(e.keyCode == 27 && active == 1) {
+                               got = '';
+                               removeAllHints();
+                               active = 0;
                                return stop_event(e);
                        } else {
                                if(active == 1 && !e.ctrlKey && !e.shiftKey && !e.altKey) {
                                return stop_event(e);
                        } else {
                                if(active == 1 && !e.ctrlKey && !e.shiftKey && !e.altKey) {
@@ -383,7 +375,7 @@ function init() {
                                                return stop_event(e);
                                        }
                                } else {
                                                return stop_event(e);
                                        }
                                } else {
-                                       // general keybinding, unrelated to numbered links
+                                       // general keybinding, (mostly unrelated to numbered links)
                                        var active_type = (document.activeElement.type || 'a').toLowerCase();
                                        var typing = true;
                                        if (document.activeElement == document.body) {
                                        var active_type = (document.activeElement.type || 'a').toLowerCase();
                                        var typing = true;
                                        if (document.activeElement == document.body) {