Created
June 26, 2020 11:13
-
-
Save yoursdearboy/ce5fe70dc6a3109e6dcbae3e534e324b to your computer and use it in GitHub Desktop.
Automate Firefox Lockwise export
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Firefox Lockwise password copy buttons. | |
1. Copy code below to the console. | |
2. Select each login in the left menu, click Copy password button. | |
3. Click Copy all passwords button. | |
4. ??? | |
5. PROFIT | |
*/ | |
const TIMEOUT = 300; | |
var passwords = []; | |
const loginItem = document.querySelector('login-item').shadowRoot; | |
function copyPassword() { | |
loginItem.querySelector('.reveal-password-checkbox').click(); | |
setTimeout(() => { | |
var url = loginItem.querySelector('.origin-input').attributes.href.value; | |
var username = loginItem.querySelector('[name="username"]').value; | |
var password = loginItem.querySelector('[name="password"]').value; | |
passwords.push({ url, username, password }); | |
}, TIMEOUT); | |
} | |
const copyPasswordButton = document.createElement('button'); | |
copyPasswordButton.innerText = "Copy password"; | |
copyPasswordButton.onclick = copyPassword; | |
const copyAllPasswordsButton = document.createElement('button'); | |
copyAllPasswordsButton.innerText = "Copy all passwords"; | |
copyAllPasswordsButton.onclick = () => window.prompt("Copy to clipboard: Ctrl+C, Enter", JSON.stringify(passwords)); | |
const loginList = document.querySelector('login-list'); | |
loginList.parentNode.insertBefore(copyAllPasswordsButton, loginList.nextSibling); | |
loginList.parentNode.insertBefore(copyPasswordButton, copyAllPasswordsButton); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment