// ui.js — small, CSP-friendly delegated handlers keyed off data-* attributes, so // templates need no inline on*= handlers (which our strict CSP forbids). Loaded on // every page. Supported hooks: // [data-confirm="msg"] — gate a form submit (on the
) or a click // (on a button/link) behind window.confirm. // [data-copy="text"] — copy a literal string to the clipboard. // [data-copy-target="#sel"] — copy that element's value (input/textarea) or // textContent. // [data-copy-prev] — copy the previous element sibling's textContent. // [data-autosubmit] — submit the control's form when it changes. // [data-consent-target="#sel"] — a checkbox that enables/disables the target as // it is (un)checked. // [data-gated] — a link/button whose activation is blocked while // aria-disabled="true". // [data-check-all] / — a button that checks (all) or unchecks (none) // [data-check-none] every enabled checkbox within its scope. The // scope is the closest [data-check-scope] // ancestor, or the whole document if none. // [data-risky] (checkbox) — confirm before enabling; unchecks on cancel. // Delegated so it works in htmx-swapped content // (a modal fragment can't run inline script). // // It also localizes timestamps: any