reze: Add Node.js password generator with memorable and random modes
Public password generator with no auth and no npm dependencies. - Server-side generation using crypto.randomInt; two levels: diceware-style memorable passphrases (42abacus-91abdomen) and fully random characters. - Configurable word list (EFF Large / EFF Short), digits per word, separators, capitalization, length, character class toggles, custom symbols and ambiguous-character exclusion. - Light/dark theme matching druid520/site, entropy estimate and strength bar, clipboard copy, options persisted in localStorage. - Dockerfile for Dokploy plus a Woodpecker deploy hook on trunk.
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
(function () {
|
||||
var root = document.documentElement;
|
||||
var media = window.matchMedia('(prefers-color-scheme: dark)');
|
||||
|
||||
try {
|
||||
var saved = localStorage.getItem('theme');
|
||||
if (saved === 'light' || saved === 'dark') root.dataset.theme = saved;
|
||||
} catch (e) {}
|
||||
|
||||
function current() {
|
||||
return root.dataset.theme || (media.matches ? 'dark' : 'light');
|
||||
}
|
||||
|
||||
function label(btn) {
|
||||
var next = current() === 'dark' ? 'light' : 'dark';
|
||||
btn.textContent = next === 'dark' ? 'Dark mode' : 'Light mode';
|
||||
btn.setAttribute('aria-label', 'Switch to ' + next + ' mode');
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
var btn = document.getElementById('theme-toggle');
|
||||
if (!btn) return;
|
||||
label(btn);
|
||||
btn.hidden = false;
|
||||
btn.addEventListener('click', function () {
|
||||
root.dataset.theme = current() === 'dark' ? 'light' : 'dark';
|
||||
try { localStorage.setItem('theme', root.dataset.theme); } catch (e) {}
|
||||
label(btn);
|
||||
});
|
||||
media.addEventListener('change', function () { label(btn); });
|
||||
});
|
||||
})();
|
||||
Reference in New Issue
Block a user