Added a button to copy result. Plus note for password.

This commit is contained in:
2026-01-19 16:47:13 +01:00
parent 5b88979921
commit af7fa0b87e
5 changed files with 80 additions and 3 deletions

View File

@@ -5,6 +5,7 @@ const salt = document.getElementById('salt');
const hashBtn = document.getElementById('hashBtn');
const result = document.getElementById('result');
const clearBtn = document.getElementById('clearBtn');
const resultBtn = document.getElementById('resultBtn');
const MIN_PASS_LEN = 16;
const MIN_SALT_LEN = 8;
@@ -54,3 +55,15 @@ clearBtn.addEventListener('click', () => {
result.value = '';
});
resultBtn.addEventListener('click', async () => {
if (!result.value) {
alert('Nothing to copy.');
}
try {
await navigator.clipboard.writeText(result.value);
alert('Copied to clipboard.');
} catch (err) {
alert('Failed to copy: ' + err);
}
});