aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Blott2014-09-02 16:46:17 +0100
committerStephen Blott2014-09-02 16:46:17 +0100
commit2f27d4590ba30f5a443aedff12d9611a83a4f771 (patch)
treebcbe3889c8f8041253e4fbd2cf0fd49352ba9086
parent76150e7b982b5cc6b68ad0dcf36c70382fdea30d (diff)
downloadvimium-2f27d4590ba30f5a443aedff12d9611a83a4f771.tar.bz2
Structured exclusion rules: Simplify isEnabledForUrl.
-rw-r--r--background_scripts/main.coffee8
1 files changed, 5 insertions, 3 deletions
diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee
index 47b215e5..4e6f406e 100644
--- a/background_scripts/main.coffee
+++ b/background_scripts/main.coffee
@@ -74,9 +74,11 @@ getCurrentTabUrl = (request, sender) -> sender.tab.url
#
root.isEnabledForUrl = isEnabledForUrl = (request) ->
rule = Exclusions.getRule(request.url)
- newIsEnabled = !rule or rule.passKeys
- newPassKeys = if newIsEnabled and rule then rule.passKeys else ""
- { rule: rule, isEnabledForUrl: newIsEnabled, passKeys: newPassKeys }
+ {
+ rule: rule
+ isEnabledForUrl: not rule or rule.passKeys
+ passKeys: rule?.passKeys or ""
+ }
# 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.