about summary refs log tree commit diff
path: root/users/grfn/bbbg/resources/public
diff options
context:
space:
mode:
authorGriffin Smith <grfn@gws.fyi>2022-01-06T16·19-0500
committergrfn <grfn@gws.fyi>2022-01-20T14·32+0000
commitc364b1273b880d71f7c975bde74aff34a078c241 (patch)
treeff4d99896e93bb3c02bfb9c61fe2d0ad26a29649 /users/grfn/bbbg/resources/public
parent86496ca4cd162f50dd1f1401dbfaac2fb817b387 (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.js10
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();
+      }
+    });
   });
 };