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

4 Commits

Author SHA1 Message Date
s2
a53d60474d v1.1.11 2017-11-22 12:25:14 +01:00
s2
4d7fefccfc use css for transition 2017-11-22 12:06:55 +01:00
s2
0d6278cd82 v1.1.10 2017-11-22 10:35:18 +01:00
s2
fee9b6b20a show notification when button pressed too 2017-11-22 10:27:58 +01:00
4 changed files with 28 additions and 17 deletions

View File

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

View File

@@ -26,7 +26,7 @@ input[type="checkbox"] {
margin-bottom: -7px; margin-bottom: -7px;
} }
#copied { .copied {
/*height: 100%;*/ /*height: 100%;*/
width: 100%; width: 100%;
background-color: #FFF8DC; background-color: #FFF8DC;
@@ -36,3 +36,15 @@ input[type="checkbox"] {
padding: 5px; padding: 5px;
text-align: center; text-align: center;
} }
.fadein {
visibility: visible;
opacity: 1;
transition: opacity 1s linear;
}
.fadeout {
visibility: hidden;
opacity: 0;
transition: visibility 0s 1s, opacity 1s linear;
}

View File

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

View File

@@ -42,19 +42,22 @@ function copypasstoclippboard(cb) {
if (typeof(cb) === 'function') { if (typeof(cb) === 'function') {
cb(); cb();
} }
fade(document.getElementsByClassName('copied')[0]);
}, 200); }, 200);
} }
function fade(element) { function fade(element) {
var op = 1; // initial opacity var clone = element.cloneNode(true);
var timer = setInterval(function () { clone.style.display = 'block';
if (op <= 0.1) { element.parentNode.insertBefore(clone, element.nextSibling);
clearInterval(timer);
element.style.display = 'none'; setTimeout(() => {
} clone.className += ' fadeout';
element.style.opacity = op; }, 500);
op -= op * 0.1;
}, 50); setTimeout(() => {
clone.remove();
}, 1100);
} }
document.addEventListener('DOMContentLoaded', function() { document.addEventListener('DOMContentLoaded', function() {
@@ -84,11 +87,7 @@ document.addEventListener('DOMContentLoaded', function() {
document.getElementById('pw').value = randPassword(getParams().length, getParams().special); document.getElementById('pw').value = randPassword(getParams().length, getParams().special);
if (options.directcopy) { if (options.directcopy) {
copypasstoclippboard(() => { copypasstoclippboard();
let copied = document.getElementById('copied');
copied.style.display = 'block';
fade(copied)
});
} }
}); });