This commit is contained in:
2026-07-21 11:48:50 -05:00
commit 5c2ac5f7e1
24 changed files with 4839 additions and 0 deletions

25
public/js/admin.js Normal file
View File

@@ -0,0 +1,25 @@
document.querySelectorAll("form").forEach((form) => {
form.addEventListener("submit", (event) => {
const danger = event.submitter?.classList.contains("danger");
if (danger && !confirm("Please confirm this permanent action.")) {
event.preventDefault();
return;
}
const button = event.submitter;
if (button && button.tagName === "BUTTON") {
button.dataset.originalText = button.textContent;
button.textContent = "Saving...";
}
});
});
document.querySelectorAll("input[type='file']").forEach((input) => {
input.addEventListener("change", () => {
const existing = input.parentElement.querySelector(".file-hint");
existing?.remove();
const hint = document.createElement("small");
hint.className = "file-hint";
hint.textContent = `${input.files.length} selected`;
input.parentElement.appendChild(hint);
});
});

19
public/js/site.js Normal file
View 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;
}
});
});