updateweb

This commit is contained in:
Local Server
2025-12-24 00:13:23 -06:00
parent e4b3de4a46
commit 017c6376fc
88 changed files with 17866 additions and 1191 deletions

View File

@@ -7,6 +7,50 @@ window.adminAuth = {
isAuthenticated: false,
};
// Load and apply theme on all admin pages
function loadAdminTheme() {
const savedTheme = localStorage.getItem("adminTheme") || "light";
applyAdminTheme(savedTheme);
// Watch for system theme changes if in auto mode
if (savedTheme === "auto") {
window
.matchMedia("(prefers-color-scheme: dark)")
.addEventListener("change", (e) => {
if (localStorage.getItem("adminTheme") === "auto") {
applyAdminTheme("auto");
}
});
}
}
function applyAdminTheme(theme) {
const body = document.body;
if (theme === "dark") {
body.classList.add("dark-mode");
body.classList.remove("light-mode");
} else if (theme === "light") {
body.classList.add("light-mode");
body.classList.remove("dark-mode");
} else if (theme === "auto") {
// Check system preference
const prefersDark = window.matchMedia(
"(prefers-color-scheme: dark)"
).matches;
if (prefersDark) {
body.classList.add("dark-mode");
body.classList.remove("light-mode");
} else {
body.classList.add("light-mode");
body.classList.remove("dark-mode");
}
}
}
// Initialize theme immediately (before page loads)
loadAdminTheme();
// Check authentication and redirect if needed - attach to window
window.checkAuth = async function () {
try {
@@ -360,3 +404,22 @@ if (window.location.pathname !== "/admin/login.html") {
});
});
}
// Fix Bootstrap modal aria-hidden focus warning for all modals - Universal Solution
(function () {
// Use event delegation on document level to catch all modal hide events
document.addEventListener(
"hide.bs.modal",
function (event) {
// Get the modal that's closing
const modalElement = event.target;
// Blur any focused element inside the modal before it closes
const focusedElement = document.activeElement;
if (focusedElement && modalElement.contains(focusedElement)) {
focusedElement.blur();
}
},
true
); // Use capture phase to run before Bootstrap's handlers
})();