diff options
author | Griffin Smith <grfn@gws.fyi> | 2022-01-06T16·19-0500 |
---|---|---|
committer | grfn <grfn@gws.fyi> | 2022-01-20T14·32+0000 |
commit | c364b1273b880d71f7c975bde74aff34a078c241 (patch) | |
tree | ff4d99896e93bb3c02bfb9c61fe2d0ad26a29649 /users/grfn/bbbg/resources/public | |
parent | 86496ca4cd162f50dd1f1401dbfaac2fb817b387 (diff) |
feat(grfn/bbbg): Add delete event button r/3643
Change-Id: I763e7a6b367ea5b474ab3aa13c7ff21e99db34af Reviewed-on: https://cl.tvl.fyi/c/depot/+/5023 Reviewed-by: grfn <grfn@gws.fyi> Autosubmit: grfn <grfn@gws.fyi> Tested-by: BuildkiteCI
Diffstat (limited to 'users/grfn/bbbg/resources/public')
-rw-r--r-- | users/grfn/bbbg/resources/public/main.js | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/users/grfn/bbbg/resources/public/main.js b/users/grfn/bbbg/resources/public/main.js index 2308ca595724..87c0b64d0a37 100644 --- a/users/grfn/bbbg/resources/public/main.js +++ b/users/grfn/bbbg/resources/public/main.js @@ -58,10 +58,16 @@ window.onload = () => { } document.querySelectorAll("form").forEach((form) => { - form.onsubmit = (e) => { + form.addEventListener("submit", (e) => { if (e.target.attributes.disabled) { e.preventDefault(); } - }; + + const confirmMessage = e.target.dataset.confirm; + if (confirmMessage != null && !confirm(confirmMessage)) { + e.stopImmediatePropagation(); + e.preventDefault(); + } + }); }); }; |