Skip to content

Commit

Permalink
Change icon on page refresh
Browse files Browse the repository at this point in the history
  • Loading branch information
SleekPanther committed Feb 17, 2018
1 parent 0359485 commit 734a146
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
14 changes: 12 additions & 2 deletions background.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//Reveal password when icon clicked
//Reveal password when extension icon clicked
chrome.browserAction.onClicked.addListener(function(tab) {
revealPassword()
})
Expand All @@ -9,8 +9,14 @@ chrome.commands.onCommand.addListener(function(command) {
}
})

//on tab switch
chrome.tabs.onActivated.addListener(()=>{
chrome.browserAction.setIcon({path: "assets/icons/icon16.png"})
changeIconToDefault()
})

//on refresh page
chrome.tabs.onUpdated.addListener((tabId, changeInfo, tab)=>{
changeIconToDefault()
})

function revealPassword(){
Expand All @@ -22,4 +28,8 @@ function revealPassword(){
)
})
chrome.browserAction.setIcon({path: "assets/icons/icon-revealed.png"})
}

function changeIconToDefault(){
chrome.browserAction.setIcon({path: "assets/icons/icon16.png"})
}
4 changes: 2 additions & 2 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

"name": "Password Revealer with Keyboard Shortcut",
"description": "View saved passwords with the click of a button",
"version": "1.0.1",
"version_name": "1.0.1",
"version": "1.0.2",
"version_name": "1.0.2",

"browser_action": {
"default_icon": "assets/icons/icon16.png",
Expand Down

0 comments on commit 734a146

Please sign in to comment.