Document theme behavior and format editor styles

This commit is contained in:
2026-07-26 22:08:55 +02:00
parent c5cff94d5a
commit bf41df9ad6
16 changed files with 97 additions and 19 deletions
+4
View File
@@ -1,4 +1,5 @@
(() => {
// Cycle the persisted preference; CSS resolves "auto" from the system setting.
const root = document.documentElement;
const colorModes = ['auto', 'light', 'dark'];
const storedTheme = localStorage.getItem('c1024-theme');
@@ -24,6 +25,7 @@
});
}
// Hide the sticky header only while scrolling down past its own height; batch scroll work per frame.
const header = document.querySelector('.site-header');
let lastY = window.scrollY;
let ticking = false;
@@ -38,6 +40,7 @@
});
}, { passive: true });
// Keep the search panel accessible and close it when focus moves outside its controls.
const searchToggle = document.querySelector('[data-search-toggle]');
const searchPanel = document.querySelector('[data-search-panel]');
if (searchToggle && searchPanel) {
@@ -54,6 +57,7 @@
});
}
// The mobile trigger controls the header class consumed by the responsive navigation CSS.
const menuToggle = document.querySelector('[data-menu-toggle]');
if (menuToggle && header) menuToggle.addEventListener('click', () => {
const open = header.classList.toggle('menu-open');