aboutsummaryrefslogtreecommitdiffstats
path: root/vimiumFrontend.js
diff options
context:
space:
mode:
authorPhil Crosby2012-04-06 13:52:18 -0700
committerPhil Crosby2012-04-06 13:52:18 -0700
commit269042a28230bb35406d1447fac8955ca1a5c0b3 (patch)
treed22b6c2f5739601bf2aa36aa0f2b9538f8bef451 /vimiumFrontend.js
parentd15f3abceb2c3ba0006999a194729c1c7cb1a095 (diff)
parent97127e056a27f8c397e97e7948a66d525e1c6a24 (diff)
downloadvimium-269042a28230bb35406d1447fac8955ca1a5c0b3.tar.bz2
Merge pull request #511 from dmacdougall/browser_icon
Browser icon and immediate disable
Diffstat (limited to 'vimiumFrontend.js')
-rw-r--r--vimiumFrontend.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/vimiumFrontend.js b/vimiumFrontend.js
index 58863c6f..343a7906 100644
--- a/vimiumFrontend.js
+++ b/vimiumFrontend.js
@@ -177,6 +177,12 @@ function initializePreDomReady() {
port.onMessage.addListener(function (args) {
refreshCompletionKeys(args.completionKeys);
});
+ } else if (port.name == "getActiveState") {
+ port.onMessage.addListener(function(args) {
+ port.postMessage({ enabled: isEnabledForUrl });
+ });
+ } else if (port.name == "disableVimium") {
+ port.onMessage.addListener(function(args) { disableVimium(); });
}
});
}
@@ -194,6 +200,19 @@ function initializeWhenEnabled() {
enterInsertModeIfElementIsFocused();
}
+/*
+ * Used to disable Vimium without needing to reload the page.
+ * This is called if the current page's url is blacklisted using the popup UI.
+ */
+function disableVimium() {
+ document.removeEventListener("keydown", onKeydown, true);
+ document.removeEventListener("keypress", onKeypress, true);
+ document.removeEventListener("keyup", onKeyup, true);
+ document.removeEventListener("focus", onFocusCapturePhase, true);
+ document.removeEventListener("blur", onBlurCapturePhase, true);
+ document.removeEventListener("DOMActivate", onDOMActivate, true);
+ isEnabledForUrl = false;
+}
/*
* The backend needs to know which frame has focus.