aboutsummaryrefslogtreecommitdiff
path: root/ui/client-scripts/src/dangerbutton.ts
blob: b33b3dc9a0d6d55457165f91b80984e4b6b36d8b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
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()
            }
        })
    })
})