Initial
This commit is contained in:
19
public/js/site.js
Normal file
19
public/js/site.js
Normal file
@@ -0,0 +1,19 @@
|
||||
document.addEventListener("click", (event) => {
|
||||
const toggle = event.target.closest("[data-menu-toggle]");
|
||||
if (!toggle) return;
|
||||
const menu = document.getElementById(toggle.getAttribute("aria-controls"));
|
||||
const open = toggle.getAttribute("aria-expanded") === "true";
|
||||
toggle.setAttribute("aria-expanded", String(!open));
|
||||
menu?.classList.toggle("open", !open);
|
||||
});
|
||||
|
||||
document.querySelectorAll("form").forEach((form) => {
|
||||
form.addEventListener("submit", () => {
|
||||
const button = form.querySelector("button[type='submit'], button:not([type])");
|
||||
if (button && !button.dataset.keepEnabled) {
|
||||
button.dataset.originalText = button.textContent;
|
||||
button.textContent = "Sending...";
|
||||
button.disabled = true;
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user