Skip to content

Commit

Permalink
Fixed icon never changing back to red
Browse files Browse the repository at this point in the history
  • Loading branch information
SleekPanther committed Feb 17, 2018
1 parent e5e472c commit d3cbc79
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions background.js
Original file line number Diff line number Diff line change
@@ -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()
Expand All @@ -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)=>{
Expand All @@ -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"})
}

0 comments on commit d3cbc79

Please sign in to comment.