aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--background_scripts/exclusions.coffee2
-rw-r--r--lib/utils.coffee6
-rw-r--r--pages/options.coffee4
3 files changed, 9 insertions, 3 deletions
diff --git a/background_scripts/exclusions.coffee b/background_scripts/exclusions.coffee
index 12d86f41..f2dd14c8 100644
--- a/background_scripts/exclusions.coffee
+++ b/background_scripts/exclusions.coffee
@@ -31,7 +31,7 @@ root.Exclusions = Exclusions =
return rule unless rule.passKeys
if matching.length
pattern: (rule.pattern for rule in matching).join " | " # Not used; for debugging only.
- passKeys: (rule.passKeys for rule in matching).join ""
+ passKeys: Utils.uniqueCharacters (rule.passKeys for rule in matching).join ""
else
null
diff --git a/lib/utils.coffee b/lib/utils.coffee
index b7f8731a..81b0fb49 100644
--- a/lib/utils.coffee
+++ b/lib/utils.coffee
@@ -110,6 +110,12 @@ Utils =
# detects both literals and dynamically created strings
isString: (obj) -> typeof obj == 'string' or obj instanceof String
+ # Transform "zjkjkabz" into "abjkz".
+ uniqueCharacters: (str) ->
+ unique = ""
+ for char in str.split("").sort()
+ unique += char unless 0 <= unique.indexOf char
+ unique
# Compares two version strings (e.g. "1.1" and "1.5") and returns
# -1 if versionA is < versionB, 0 if they're equal, and 1 if versionA is > versionB.
diff --git a/pages/options.coffee b/pages/options.coffee
index 80c9ae44..62d42270 100644
--- a/pages/options.coffee
+++ b/pages/options.coffee
@@ -161,8 +161,8 @@ class ExclusionRulesOption extends Option
readValueFromElement: ->
rules =
for element in @element.getElementsByClassName "exclusionRuleTemplateInstance"
- pattern = element.children[0].firstChild.value.trim().split(/\s+/).join ""
- passKeys = element.children[1].firstChild.value.trim().split(/\s+/).join ""
+ pattern = element.children[0].firstChild.value.split(/\s+/).join ""
+ passKeys = element.children[1].firstChild.value.split(/\s+/).join ""
{ pattern: pattern, passKeys: passKeys }
rules.filter (rule) -> rule.pattern