Deployed 2db1ea4 with MkDocs version: 1.6.1

This commit is contained in:
github-actions[bot]
2025-02-01 15:23:58 +00:00
commit 91d18cb74b
59 changed files with 12824 additions and 0 deletions

35
javascripts/extra.js Normal file
View File

@@ -0,0 +1,35 @@
document.addEventListener("DOMContentLoaded", function() {
// Sync with Material's native storage key
const STORAGE_KEY = "md-color-scheme";
// Get initial theme state
const savedTheme = localStorage.getItem(STORAGE_KEY) || "default";
document.body.setAttribute("data-md-color-scheme", savedTheme);
// Watch for theme changes
const mutationObserver = new MutationObserver(mutations => {
mutations.forEach(mutation => {
if (mutation.attributeName === "data-md-color-scheme") {
const currentTheme = document.body.getAttribute("data-md-color-scheme");
localStorage.setItem(STORAGE_KEY, currentTheme);
}
});
});
// Start observing body attributes
mutationObserver.observe(document.body, {
attributes: true,
attributeFilter: ["data-md-color-scheme"]
});
// Debounced click handler
let isToggling = false;
document.querySelector(".md-header__button[data-md-color-scheme]").addEventListener("click", () => {
if (!isToggling) {
isToggling = true;
setTimeout(() => {
isToggling = false;
}, 300);
}
});
});