1
0
mirror of https://github.com/S2-/pwgen.git synced 2025-08-02 17:00:03 +02:00

5 Commits

Author SHA1 Message Date
s2
5959bc4cbe v1.1.9 2017-11-22 09:27:29 +01:00
s2
93c4955d1d copy pass to clipboard notification 2017-11-22 09:25:44 +01:00
s2
3a64948533 i like this one better 2017-11-21 21:04:09 +01:00
s2
a0d5b54b5d new screenshot 2017-11-21 20:59:53 +01:00
s2
396236254a readme 2017-11-21 20:54:48 +01:00
7 changed files with 48 additions and 9 deletions

12
README.md Normal file
View File

@@ -0,0 +1,12 @@
# pwgen reloaded
## What it does
A firefox addon that generates a password and copies it to the clipboard
![pwgen reloaded in action](img/screenshot.png)
## install
On amo!
[https://addons.mozilla.org/firefox/addon/pwgen-reloaded/](https://addons.mozilla.org/firefox/addon/pwgen-reloaded/)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 KiB

After

Width:  |  Height:  |  Size: 29 KiB

View File

@@ -1,5 +0,0 @@
# pwgen
## What it does ##
Simply generate a password and copy it to the clipboard

View File

@@ -2,7 +2,7 @@
"description": "Just a toolbar button that generates a password and copies it to your clipboard.",
"manifest_version": 2,
"name": "pwgen reloaded",
"version": "1.1.8",
"version": "1.1.9",
"homepage_url": "https://github.com/S2-/pwgen",
"icons": {
"48": "icons/lock-48.png"

View File

@@ -21,6 +21,18 @@ input[type="number"] {
font-size: inherit;
padding: 5px 10px;
}
input[type="checkbox"] {
margin-bottom: -7px;
}
#copied {
/*height: 100%;*/
width: 100%;
background-color: #FFF8DC;
position: absolute;
margin: -25px;
margin-top: -5px;
padding: 5px;
text-align: center;
}

View File

@@ -10,6 +10,8 @@
</head>
<body>
<div id="copied" style="display: none;">password copied to clipboard</div>
<form>
<div>

View File

@@ -34,14 +34,29 @@ function saveOptions(options) {
return browser.storage.local.set(options);
}
function copypasstoclippboard() {
function copypasstoclippboard(cb) {
setTimeout(function() {
var copyText = document.getElementById('pw');
copyText.select();
document.execCommand('copy');
if (typeof(cb) === 'function') {
cb();
}
}, 200);
}
function fade(element) {
var op = 1; // initial opacity
var timer = setInterval(function () {
if (op <= 0.1) {
clearInterval(timer);
element.style.display = 'none';
}
element.style.opacity = op;
op -= op * 0.1;
}, 50);
}
document.addEventListener('DOMContentLoaded', function() {
document.getElementById('new').addEventListener('click', (ev) => {
@@ -69,9 +84,12 @@ document.addEventListener('DOMContentLoaded', function() {
document.getElementById('pw').value = randPassword(getParams().length, getParams().special);
if (options.directcopy) {
copypasstoclippboard();
copypasstoclippboard(() => {
let copied = document.getElementById('copied');
copied.style.display = 'block';
fade(copied)
});
}
});
});