diff options
| author | Stephen Blott | 2014-12-30 12:19:29 +0000 |
|---|---|---|
| committer | Stephen Blott | 2014-12-30 12:19:29 +0000 |
| commit | 3620fec662ab89bd4f7827e66deec49ff4d11b8e (patch) | |
| tree | 4722bc92a9931e91e8a4109e5ce16a971c3d2dac /background_scripts/main.coffee | |
| parent | ba743054dcd26b225db407db261e480ab485e2d0 (diff) | |
| parent | 0b610a6d707bd4cd1eb421605d15d276721ef493 (diff) | |
| download | vimium-3620fec662ab89bd4f7827e66deec49ff4d11b8e.tar.bz2 | |
Merge branch 'smblott-github-passkeys---union-of-rules'
Diffstat (limited to 'background_scripts/main.coffee')
| -rw-r--r-- | background_scripts/main.coffee | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee index 647923c0..cebb38ca 100644 --- a/background_scripts/main.coffee +++ b/background_scripts/main.coffee @@ -75,26 +75,10 @@ getCurrentTabUrl = (request, sender) -> sender.tab.url root.isEnabledForUrl = isEnabledForUrl = (request) -> rule = Exclusions.getRule(request.url) { - rule: rule isEnabledForUrl: not rule or rule.passKeys passKeys: rule?.passKeys or "" } -# Called by the popup UI. -# If the URL pattern matches an existing rule, then the existing rule is updated. Otherwise, a new rule is created. -root.addExclusionRule = (pattern,passKeys) -> - if pattern = pattern.trim() - Exclusions.updateOrAdd({ pattern: pattern, passKeys: passKeys }) - chrome.tabs.query({ windowId: chrome.windows.WINDOW_ID_CURRENT, active: true }, - (tabs) -> updateActiveState(tabs[0].id)) - -# Called by the popup UI. Remove all existing exclusion rules with this pattern. -root.removeExclusionRule = (pattern) -> - if pattern = pattern.trim() - Exclusions.remove(pattern) - chrome.tabs.query({ windowId: chrome.windows.WINDOW_ID_CURRENT, active: true }, - (tabs) -> updateActiveState(tabs[0].id)) - saveHelpDialogSettings = (request) -> Settings.set("helpDialog_showAdvancedCommands", request.showAdvancedCommands) @@ -353,7 +337,8 @@ setBrowserActionIcon = (tabId,path) -> # Updates the browserAction icon to indicate whether Vimium is enabled or disabled on the current page. # Also propagates new enabled/disabled/passkeys state to active window, if necessary. # This lets you disable Vimium on a page without needing to reload. -updateActiveState = (tabId) -> +# Exported via root because it's called from the page popup. +root.updateActiveState = updateActiveState = (tabId) -> enabledIcon = "icons/browser_action_enabled.png" disabledIcon = "icons/browser_action_disabled.png" partialIcon = "icons/browser_action_partial.png" |
