/*
    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("form").forEach(form => {
        if (!(form instanceof HTMLFormElement)) return
        form.addEventListener("submit", () => {
            const submit = form.querySelector("input[type=submit]")
            if (!(submit instanceof HTMLInputElement)) return
            submit.disabled = true
            submit.value = submit.dataset.loadingText ?? "..."
        })
    })
})
