about summary refs log tree commit diff
path: root/users/grfn/bbbg/resources
diff options
context:
space:
mode:
Diffstat (limited to 'users/grfn/bbbg/resources')
-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();
+      }
+    });
   });
 };