fix(phase-1): resolve preloader freeze, lock dark mode, perfectly center hamburger & mark complete

This commit is contained in:
2026-05-21 14:02:09 +02:00
parent 5448d3e3c4
commit 548c7605bc
5 changed files with 22 additions and 41 deletions
+1 -32
View File
@@ -24,10 +24,7 @@
<button id="backToTop" aria-label="<?php echo $langCode === 'de' ? 'Nach oben' : 'Back to top'; ?>">↑</button>
<!-- Fixed dark/light toggle -->
<button class="theme-toggle" data-theme-toggle aria-label="Switch to dark mode">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"/></svg>
</button>
<script>
// ── Back to top ────────────────────────────────────────────────
@@ -46,35 +43,7 @@
check();
})();
// ── Dark / light mode toggle ───────────────────────────────────
(function(){
var r = document.documentElement;
var d = localStorage.getItem('fc-theme') || r.getAttribute('data-theme') || 'light';
r.setAttribute('data-theme', d);
var SUN = '<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="5"/><path d="M12 1v2M12 21v2M4.22 4.22l1.42 1.42M18.36 18.36l1.42 1.42M1 12h2M21 12h2M4.22 19.78l1.42-1.42M18.36 5.64l1.42-1.42"/></svg>';
var MOON = '<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"/></svg>';
function setIcon() {
var icon = d === 'dark' ? SUN : MOON;
var label = 'Switch to ' + (d === 'dark' ? 'light' : 'dark') + ' mode';
document.querySelectorAll('[data-theme-toggle]').forEach(function(t) {
t.innerHTML = icon;
t.setAttribute('aria-label', label);
});
}
document.addEventListener('click', function(e) {
if (e.target.closest('[data-theme-toggle]')) {
d = d === 'dark' ? 'light' : 'dark';
r.setAttribute('data-theme', d);
localStorage.setItem('fc-theme', d);
setIcon();
}
});
setIcon();
})();
</script>
</body>
</html>