Skip to content

Commit

Permalink
Add Password dialog will now autofill website hostname
Browse files Browse the repository at this point in the history
  • Loading branch information
Ziga committed Jun 1, 2021
1 parent d62979d commit 84868b1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions js/passwords.js
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,14 @@ function changeDialog(style, text){
document.getElementById("website").value = data[1];
document.getElementById("username").value = data[2];
document.getElementById("password").value = data[3];
}else{
try{
chrome.tabs.query({active: true, lastFocusedWindow: true}, tabs => {
if(tabs[0].url !== null && typeof(tabs[0].url) !== 'undefined'){
document.getElementById("website").value = new URL(tabs[0].url).hostname.replace("www.", "");
}
});
}catch{}
}

document.getElementById('btn-password-generator').onclick = () => changeDialog(5, "-1" + " " + document.getElementById("website").value + " " + document.getElementById("username").value + " " + document.getElementById("password").value);
Expand Down

0 comments on commit 84868b1

Please sign in to comment.