Initial commit: Location Management Flask app
This commit is contained in:
22
app/static/js/app.js
Normal file
22
app/static/js/app.js
Normal file
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* app.js – Global Socket.IO connection & UI helpers
|
||||
*/
|
||||
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
// ── Bootstrap alert auto-dismiss after 4 s ──────────────────────────────
|
||||
document.querySelectorAll(".alert").forEach(function (el) {
|
||||
setTimeout(function () {
|
||||
const bsAlert = bootstrap.Alert.getOrCreateInstance(el);
|
||||
if (bsAlert) bsAlert.close();
|
||||
}, 4000);
|
||||
});
|
||||
|
||||
// ── Confirm-before-submit for data-confirm forms ─────────────────────────
|
||||
document.querySelectorAll("form[data-confirm]").forEach(function (form) {
|
||||
form.addEventListener("submit", function (e) {
|
||||
if (!confirm(form.getAttribute("data-confirm"))) {
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user