From 811be9102f93bba4bc701d52841c38970820f696 Mon Sep 17 00:00:00 2001 From: FelisCatus Date: Sat, 27 Dec 2014 19:20:36 +0800 Subject: [PATCH] Change profile icon drawing scheme. Fix #109. See also #107. --- .../background.coffee | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/omega-target-chromium-extension/background.coffee b/omega-target-chromium-extension/background.coffee index 7cc9b21..4b86d65 100644 --- a/omega-target-chromium-extension/background.coffee +++ b/omega-target-chromium-extension/background.coffee @@ -76,6 +76,7 @@ actionForUrl = (url) -> if result[0] == 'DIRECT' details += chrome.i18n.getMessage('browserAction_directResult') details += '\n' + direct = true else details += "#{result[0]}\n" else if typeof result[1] == 'string' @@ -106,13 +107,12 @@ actionForUrl = (url) -> profileColor = current.color icon = null - if profile.name == current.name and options.isCurrentProfileStatic() - if direct - resultColor = options.profile('direct').color - profileColor = profile.color - else - resultColor = profileColor = profile.color - icon = drawIcon(profile.color) + if direct + resultColor = options.profile('direct').color + profileColor = profile.color + else if profile.name == current.name and options.isCurrentProfileStatic() + resultColor = profileColor = profile.color + icon = drawIcon(profile.color) else resultColor = profile.color profileColor = current.color @@ -236,8 +236,13 @@ options.currentProfileChanged = (reason) -> title = message + '\n' + title options.setBadge() + if not current.name or not OmegaPac.Profiles.isInclusive(current) + icon = drawIcon(current.color) + else + icon = drawIcon(options.profile('direct').color, current.color) + tabs.resetAll( - icon: drawIcon(current.color) + icon: icon title: title )