aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Blott2014-08-24 08:20:15 +0100
committerStephen Blott2014-08-24 08:27:13 +0100
commit12b889d9cbfaa2a47834fbf69c4f7788cbc8c361 (patch)
tree033e491a9e4dc6099aba34428d695c7c35ae22ae
parent7a0943b549986a060282e8047f14a58fbdb5acc3 (diff)
downloadvimium-12b889d9cbfaa2a47834fbf69c4f7788cbc8c361.tar.bz2
New icons for partially enabled, for passkeys.
-rw-r--r--background_scripts/main.coffee12
-rw-r--r--icons/browser_action_partial.pngbin0 -> 35698 bytes
-rw-r--r--icons/icon48partial.pngbin0 -> 3815 bytes
3 files changed, 9 insertions, 3 deletions
diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee
index b99d5307..68d1236b 100644
--- a/background_scripts/main.coffee
+++ b/background_scripts/main.coffee
@@ -91,7 +91,8 @@ root.isEnabledForUrl = isEnabledForUrl = (request) ->
# Enabled (the default).
{ isEnabledForUrl: true, passKeys: undefined, matchingUrl: undefined }
-# Called by the popup UI. Strips leading/trailing whitespace and ignores new empty strings.
+# Called by the popup UI. Strips leading/trailing whitespace and ignores new empty strings. If an existing
+# exclusion rule has been changed, then the existing rule is updated. Otherwise, the new rule is added.
root.addExcludedUrl = (url) ->
return unless url = url.trim()
@@ -387,15 +388,20 @@ updateOpenTabs = (tab) ->
updateActiveState = (tabId) ->
enabledIcon = "icons/browser_action_enabled.png"
disabledIcon = "icons/browser_action_disabled.png"
+ partialIcon = "icons/browser_action_partial.png"
chrome.tabs.get(tabId, (tab) ->
# Default to disabled state in case we can't connect to Vimium, primarily for the "New Tab" page.
chrome.browserAction.setIcon({ path: disabledIcon })
chrome.tabs.sendMessage(tabId, { name: "getActiveState" }, (response) ->
isCurrentlyEnabled = (response? && response.enabled)
- shouldBeEnabled = isEnabledForUrl({url: tab.url}).isEnabledForUrl
+ enabledConfig = isEnabledForUrl({url: tab.url})
+ shouldBeEnabled = enabledConfig.isEnabledForUrl
+ shouldHavePassKeys = enabledConfig.passKeys
if (isCurrentlyEnabled)
- if (shouldBeEnabled)
+ if (shouldBeEnabled and shouldHavePassKeys)
+ chrome.browserAction.setIcon({ path: partialIcon })
+ else if (shouldBeEnabled)
chrome.browserAction.setIcon({ path: enabledIcon })
else
chrome.browserAction.setIcon({ path: disabledIcon })
diff --git a/icons/browser_action_partial.png b/icons/browser_action_partial.png
new file mode 100644
index 00000000..5e0457af
--- /dev/null
+++ b/icons/browser_action_partial.png
Binary files differ
diff --git a/icons/icon48partial.png b/icons/icon48partial.png
new file mode 100644
index 00000000..088099b1
--- /dev/null
+++ b/icons/icon48partial.png
Binary files differ