Skip to content

Commit

Permalink
Version 1.0.0 Shortcut & click icon reveal
Browse files Browse the repository at this point in the history
  • Loading branch information
SleekPanther committed Feb 17, 2018
1 parent 53404f7 commit 5256d55
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 0 deletions.
19 changes: 19 additions & 0 deletions background.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//Reveal password when icon clicked
chrome.browserAction.onClicked.addListener(function(tab) {
revealPassword()
})

chrome.commands.onCommand.addListener(function(command) {
if(command === 'revealPassword'){
revealPassword()
}
})

function revealPassword(){
chrome.tabs.query({active: true, currentWindow: true}, (tabs)=>{
chrome.tabs.sendMessage(
tabs[0].id,
{msg: 'revealPassword'}
)
})
}
12 changes: 12 additions & 0 deletions content-script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
chrome.runtime.onMessage.addListener((request, sender, sendResponse)=> {
if(request.msg === 'revealPassword'){
reveal()
}
})

function reveal(){
passwordFields = document.querySelectorAll('input[type="password"]')
for(let i=0; i<passwordFields.length; i++){
passwordFields[i].setAttribute("type", "text")
}
}
34 changes: 34 additions & 0 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"manifest_version": 2,

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

"browser_action": {
// "default_icon": "assets/icons/icon.png",
"default_title": "Alt+R (Reveal Password)"
},
"permissions": [
"activeTab"
],
"background": {
"scripts": [
"background.js"
]
},
"content_scripts": [{
"matches": ["<all_urls>"],
"js": ["content-script.js"]
}
],
"commands": {
"revealPassword": {
"suggested_key": {
"default": "Alt+R"
},
"description": "Reveal password in password fields"
}
}
}

0 comments on commit 5256d55

Please sign in to comment.