diff options
| author | Stephen Blott | 2014-12-21 15:40:10 +0000 |
|---|---|---|
| committer | Stephen Blott | 2014-12-21 15:47:23 +0000 |
| commit | 3aeb8517d0dd5f9a530e99db662a4945132cf436 (patch) | |
| tree | aacdc57135847df70a12b640c425dbf12790ca6b | |
| parent | 53be2881db3a7d77ef9dbf92f87fba3b99873530 (diff) | |
| download | vimium-3aeb8517d0dd5f9a530e99db662a4945132cf436.tar.bz2 | |
Exclusion; minor updates after review.
| -rw-r--r-- | background_scripts/exclusions.coffee | 10 | ||||
| -rw-r--r-- | pages/options.coffee | 7 | ||||
| -rw-r--r-- | pages/options.html | 2 | ||||
| -rw-r--r-- | pages/popup.html | 2 |
4 files changed, 10 insertions, 11 deletions
diff --git a/background_scripts/exclusions.coffee b/background_scripts/exclusions.coffee index 467e5e70..62647bd8 100644 --- a/background_scripts/exclusions.coffee +++ b/background_scripts/exclusions.coffee @@ -25,13 +25,13 @@ root.Exclusions = Exclusions = # Merge the matching rules for URL, or null. If rules are provided, match against those. getRule: (url, rules=@rules) -> - matching = (rule for rule in rules when rule.pattern and url.match(RegexpCache.get(rule.pattern))) + matches = (rule for rule in rules when rule.pattern and 0 <= url.search(RegexpCache.get(rule.pattern))) # An absolute exclusion rule (with no passKeys) takes priority. - for rule in matching + for rule in matches return rule unless rule.passKeys - if matching.length - pattern: (rule.pattern for rule in matching).join " | " # Not used; for debugging only. - passKeys: Utils.uniqueCharacters (rule.passKeys for rule in matching).join "" + if matches.length + pattern: (rule.pattern for rule in matches).join " | " # Not used; for debugging only. + passKeys: Utils.uniqueCharacters (rule.passKeys for rule in matches).join "" else null diff --git a/pages/options.coffee b/pages/options.coffee index 249677be..def67fd7 100644 --- a/pages/options.coffee +++ b/pages/options.coffee @@ -120,7 +120,7 @@ class ExclusionRulesOption extends Option haveMatch = false for element in elements pattern = element.children[0].firstChild.value.trim() - if @url.match bgExclusions.RegexpCache.get pattern + if 0 <= @url.search bgExclusions.RegexpCache.get pattern haveMatch = true element.children[1].firstChild.focus() else @@ -131,14 +131,13 @@ class ExclusionRulesOption extends Option # On the popup page, provide visual feedback when a pattern does not match the current page. This assumes # that @url is not empty. activatePatternWatcher: (element) -> - computedStyle = window.getComputedStyle(element) - originalColor = computedStyle.getPropertyValue("color") patternElement = element.children[0].firstChild patternElement.addEventListener "keyup", => if @url.match bgExclusions.RegexpCache.get patternElement.value - patternElement.style.color = originalColor + patternElement.title = patternElement.style.color = "" else patternElement.style.color = "red" + patternElement.title = "Red text means that the pattern does not\nmatch the current URL." # Append a row for a new rule. appendRule: (rule) -> diff --git a/pages/options.html b/pages/options.html index 51a53634..9a0368a3 100644 --- a/pages/options.html +++ b/pages/options.html @@ -37,7 +37,7 @@ <td><input/ type="text" class="pattern" placeholder="URL pattern"></td> <td class="exclusionRulePassKeys"><input/ type="text" class="passKeys" placeholder="Exclude keys"></td> <td class="exclusionRemoveButton"> - <input/ type="button" tabindex = "-1" class="exclusionRemoveButtonButton" value="✖"></td> + <input/ type="button" class="exclusionRemoveButtonButton" value="✖"></td> </tr> </template> </div> diff --git a/pages/popup.html b/pages/popup.html index 53a75495..b89e2f07 100644 --- a/pages/popup.html +++ b/pages/popup.html @@ -67,7 +67,7 @@ <td><input/ type="text" class="pattern" placeholder="URL pattern"></td> <td class="exclusionRulePassKeys"><input/ type="text" class="passKeys" placeholder="Excluded keys"></td> <td class="exclusionRemoveButton"> - <input/ type="button" tabindex = "-1" class="exclusionRemoveButtonButton" value="✖"></td> + <input/ type="button" class="exclusionRemoveButtonButton" value="✖"></td> </tr> </template> </div> |
