diff options
| author | Stephen Blott | 2014-12-30 10:58:46 +0000 |
|---|---|---|
| committer | Stephen Blott | 2014-12-30 11:56:28 +0000 |
| commit | b5c0b8da794407bc72f9f43da40422ed23e3899e (patch) | |
| tree | ae9eebca8b4a6ae8665a568d0a2d4c37303efbd0 /background_scripts | |
| parent | f7f0f8ec7500a4b2f6d39b7ca1e68cf59795d5d4 (diff) | |
| download | vimium-b5c0b8da794407bc72f9f43da40422ed23e3899e.tar.bz2 | |
Exclusions; use querySelector to find sub-elements.
As @philc pointed out in #1366, this is less brittle.
Diffstat (limited to 'background_scripts')
| -rw-r--r-- | background_scripts/exclusions.coffee | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/background_scripts/exclusions.coffee b/background_scripts/exclusions.coffee index 62647bd8..55ced3ef 100644 --- a/background_scripts/exclusions.coffee +++ b/background_scripts/exclusions.coffee @@ -23,15 +23,17 @@ root.Exclusions = Exclusions = rules: Settings.get("exclusionRules") - # Merge the matching rules for URL, or null. If rules are provided, match against those. + # Merge the matching rules for URL, or null. In the normal case, we use the configured @rules; hence, this + # is the default. However, when called from the page popup, we are testing what effect candidate new rules + # would have on the current tab. In this case, the candidate rules are provided by the caller. getRule: (url, rules=@rules) -> 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 matches return rule unless rule.passKeys - if matches.length + if 0 < 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 "" + passKeys: Utils.distinctCharacters (rule.passKeys for rule in matches).join "" else null |
