Created bookmarklet with http://ted.mielczarek.org/code/mozilla/bookmarklet.html
Created
February 9, 2017 07:47
-
-
Save fregante/24ac48e7d6dfe86a885393080a26471b to your computer and use it in GitHub Desktop.
Copy saved password bookmarklet
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
// Get non-empty, visible password fields | |
var fields = [...document.querySelectorAll('[type=password]')].filter(f => f.value && f.offsetParent); | |
var cpy = field => { | |
field.type = ''; | |
field.select(); | |
document.execCommand('copy'); | |
field.type = 'password'; | |
} | |
if (fields.length === 1) { | |
cpy(fields[0]); | |
} else { | |
document.body.addEventListener('click', e => { | |
cpy(e.target); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment