From d3cbc7978263acc9f7cb06cac697b788c7b7d57a Mon Sep 17 00:00:00 2001 From: SleekPanther Date: Sat, 17 Feb 2018 14:49:32 -0500 Subject: [PATCH] Fixed icon never changing back to red --- background.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/background.js b/background.js index 26171ce..9904f3c 100644 --- a/background.js +++ b/background.js @@ -1,5 +1,3 @@ -let revealed = false //keeps track of whether the password is currently shown or hidden - //Reveal password when icon clicked chrome.browserAction.onClicked.addListener(function(tab) { revealPassword() @@ -11,6 +9,10 @@ chrome.commands.onCommand.addListener(function(command) { } }) +chrome.tabs.onActivated.addListener(()=>{ + chrome.browserAction.setIcon({path: "assets/icons/icon16.png"}) +}) + function revealPassword(){ revealed = true chrome.tabs.query({active: true, currentWindow: true}, (tabs)=>{ @@ -19,7 +21,5 @@ function revealPassword(){ {msg: 'revealPassword'} ) }) - if(revealed){ - chrome.browserAction.setIcon({path: "assets/icons/icon-revealed.png"}) - } + chrome.browserAction.setIcon({path: "assets/icons/icon-revealed.png"}) } \ No newline at end of file