diff options
Diffstat (limited to 'ui/client-scripts/src/dangerbutton.ts')
| -rw-r--r-- | ui/client-scripts/src/dangerbutton.ts | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/ui/client-scripts/src/dangerbutton.ts b/ui/client-scripts/src/dangerbutton.ts new file mode 100644 index 0000000..b33b3dc --- /dev/null +++ b/ui/client-scripts/src/dangerbutton.ts @@ -0,0 +1,14 @@ +/* + This file is part of jellything (https://codeberg.org/metamuffin/jellything) + which is licensed under the GNU Affero General Public License (version 3); see /COPYING. + Copyright (C) 2026 metamuffin <metamuffin.org> +*/ +globalThis.addEventListener("DOMContentLoaded", () => { + document.querySelectorAll("input.danger").forEach(el => { + el.addEventListener("click", ev => { + if (!confirm(`Really ${(el as HTMLInputElement).value}?`)) { + ev.preventDefault() + } + }) + }) +}) |