aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Blott2014-09-02 13:47:14 +0100
committerStephen Blott2014-09-02 14:02:44 +0100
commit76150e7b982b5cc6b68ad0dcf36c70382fdea30d (patch)
tree522ba9baa047dc52ae0a25dbd82af48f93be0543
parentf2596ae0eaaa09a1ec5d641f048d7472f19c812b (diff)
downloadvimium-76150e7b982b5cc6b68ad0dcf36c70382fdea30d.tar.bz2
Structured exclusion rules: Fix typos and minor issues.
-rw-r--r--background_scripts/main.coffee6
-rw-r--r--content_scripts/vimium_frontend.coffee4
-rw-r--r--manifest.json1
-rw-r--r--pages/options.coffee1
-rw-r--r--pages/options.html5
-rw-r--r--pages/popup.coffee3
6 files changed, 7 insertions, 13 deletions
diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee
index 4111ac06..47b215e5 100644
--- a/background_scripts/main.coffee
+++ b/background_scripts/main.coffee
@@ -74,9 +74,9 @@ getCurrentTabUrl = (request, sender) -> sender.tab.url
#
root.isEnabledForUrl = isEnabledForUrl = (request) ->
rule = Exclusions.getRule(request.url)
- return { rule: rule, isEnabledForUrl: true, passKeys: rule.passKeys } if rule and rule.passKeys
- return { rule: rule, isEnabledForUrl: false, passKeys: "" } if rule
- return { rule: rule, isEnabledForUrl: true, passKeys: "" }
+ newIsEnabled = !rule or rule.passKeys
+ newPassKeys = if newIsEnabled and rule then rule.passKeys else ""
+ { rule: rule, isEnabledForUrl: newIsEnabled, passKeys: newPassKeys }
# Called by the popup UI. If an existing exclusion rule has been changed, then the existing rule is updated.
# Otherwise, the new rule is added.
diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee
index e2ffa7f0..6db0d830 100644
--- a/content_scripts/vimium_frontend.coffee
+++ b/content_scripts/vimium_frontend.coffee
@@ -331,11 +331,11 @@ extend window,
false
-# Decide whether this keyChar be passed to the underlying page.
+# Decide whether this keyChar should be passed to the underlying page.
# Keystrokes are *never* considered passKeys if the keyQueue is not empty. So, for example, if 't' is a
# passKey, then 'gt' and '99t' will neverthless be handled by vimium.
isPassKey = ( keyChar ) ->
- return !keyQueue and 0 <= passKeys.indexOf(keyChar)
+ return !keyQueue and passKeys and 0 <= passKeys.indexOf(keyChar)
handledKeydownEvents = []
diff --git a/manifest.json b/manifest.json
index 3f4c877d..d376dca4 100644
--- a/manifest.json
+++ b/manifest.json
@@ -37,7 +37,6 @@
"lib/dom_utils.js",
"lib/handler_stack.js",
"lib/clipboard.js",
- "lib/exclusion_rule.js",
"content_scripts/link_hints.js",
"content_scripts/vomnibar.js",
"content_scripts/scroller.js",
diff --git a/pages/options.coffee b/pages/options.coffee
index cb6c1184..1b7faea0 100644
--- a/pages/options.coffee
+++ b/pages/options.coffee
@@ -89,6 +89,7 @@ populateOptions = ->
# Self-handling options build their own DOM, and provide callbacks for saveOptions and restoreToDefaults.
for field of selfHandlingFields
selfHandlingCallbacks[field] = selfHandlingFields[field]($(field),enableSaveButton)
+ onDataLoaded()
restoreToDefaults = ->
return unless confirm "Are you sure you want to return Vimium's settings to their defaults?"
diff --git a/pages/options.html b/pages/options.html
index c9fc5a63..b0ae8fd5 100644
--- a/pages/options.html
+++ b/pages/options.html
@@ -183,11 +183,6 @@
border-radius: 2px;
color: #444;
}
- .exclusionRemoveButton {
- /* cursor: pointer; */
- /* border: none; */
- /* background: none; */
- }
input.pattern, input.passKeys {
font-family: Consolas, "Liberation Mono", Courier, monospace;
font-size: 14px;
diff --git a/pages/popup.coffee b/pages/popup.coffee
index ff943f32..2f3cee2a 100644
--- a/pages/popup.coffee
+++ b/pages/popup.coffee
@@ -7,13 +7,12 @@ onLoad = ->
document.getElementById("optionsLink").setAttribute "href", chrome.runtime.getURL("pages/options.html")
chrome.tabs.getSelected null, (tab) ->
isEnabled = chrome.extension.getBackgroundPage().isEnabledForUrl(url: tab.url)
+ # Check if we have an existing exclusing rule for this page.
if isEnabled.rule
- # There is an existing exclusion rule for this page.
originalRule = isEnabled.rule
originalPattern = originalRule.pattern
originalPassKeys = originalRule.passKeys
else
- # There is not an existing exclusion rule.
# The common use case is to disable Vimium at the domain level.
# This regexp will match "http://www.example.com/" from "http://www.example.com/path/to/page.html".
domain = (tab.url.match(/[^\/]*\/\/[^\/]*\//) or tab.url) + "*"