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

add timeout before copying password

This commit is contained in:
s2
2017-11-21 19:33:09 +01:00
parent 81d5bbb055
commit b0932baeea

View File

@@ -35,11 +35,15 @@ function saveOptions(options) {
} }
function copypasstoclippboard() { function copypasstoclippboard() {
setTimeout(function() {
var copyText = document.getElementById('pw'); var copyText = document.getElementById('pw');
copyText.select(); copyText.select();
document.execCommand('copy'); document.execCommand('copy');
}, 100);
} }
document.addEventListener('DOMContentLoaded', function() {
document.getElementById('new').addEventListener('click', (ev) => { document.getElementById('new').addEventListener('click', (ev) => {
ev.preventDefault(); ev.preventDefault();
var params = getParams(); var params = getParams();
@@ -68,3 +72,6 @@ loadOptions().then((options) => {
copypasstoclippboard(); copypasstoclippboard();
} }
}); });
});