diff options
| author | jez | 2011-02-01 05:01:39 +0800 |
|---|---|---|
| committer | jez | 2011-02-01 11:12:57 +0800 |
| commit | 1133f348558e8e70aa5e76ca67a739a5303467bd (patch) | |
| tree | b09928d85e438f6297313aefc9b020cedf4ebf95 /linkHints.js | |
| parent | d31aa9fefc26f562f45043ad184846c469a580a9 (diff) | |
| download | vimium-1133f348558e8e70aa5e76ca67a739a5303467bd.tar.bz2 | |
Use only one key[event] handler for all modes.
Diffstat (limited to 'linkHints.js')
| -rw-r--r-- | linkHints.js | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/linkHints.js b/linkHints.js index e1889a47..ccd43cb6 100644 --- a/linkHints.js +++ b/linkHints.js @@ -15,7 +15,6 @@ var linkHints = { hintMarkers: [], hintMarkerContainingDiv: null, // The characters that were typed in while in "link hints" mode. - modeActivated: false, shouldOpenInNewTab: false, shouldOpenWithQueue: false, // Whether link hint's "open in current/new tab" setting is currently toggled @@ -59,11 +58,12 @@ var linkHints = { if (!this.cssAdded) addCssToPage(linkHintCss); // linkHintCss is declared by vimiumFrontend.js this.linkHintCssAdded = true; - this.modeActivated = true; this.setOpenLinkMode(openInNewTab, withQueue); this.buildLinkHints(); - document.addEventListener("keydown", this.onKeyDownInMode, true); - document.addEventListener("keyup", this.onKeyUpInMode, true); + handlerStack.push({ // modeKeyHandler is declared by vimiumFrontend.js + keydown: this.onKeyDownInMode, + keyup: this.onKeyUpInMode + }); }, setOpenLinkMode: function(openInNewTab, withQueue) { @@ -300,9 +300,7 @@ var linkHints = { that.hintMarkerContainingDiv.parentNode.removeChild(that.hintMarkerContainingDiv); that.hintMarkerContainingDiv = null; that.hintMarkers = []; - document.removeEventListener("keydown", that.onKeyDownInMode, true); - document.removeEventListener("keyup", that.onKeyUpInMode, true); - that.modeActivated = false; + handlerStack.pop(); HUD.hide(); } // we invoke the deactivate() function directly instead of using setTimeout(callback, 0) so that |
