diff --git a/themes/swissfini/assets/js/accessibility.js b/themes/swissfini/assets/js/accessibility.js index ae72534..b3243dd 100644 --- a/themes/swissfini/assets/js/accessibility.js +++ b/themes/swissfini/assets/js/accessibility.js @@ -585,11 +585,22 @@ } } + function initFooterLink() { + const footerLink = document.getElementById('footer-accessibility-link'); + if (footerLink) { + footerLink.addEventListener('click', function(e) { + e.preventDefault(); + document.getElementById('accessibility-toggle')?.click(); + }); + } + } + function onDOMReady() { bindEvents(); initPanelToggle(); initHeaderScroll(); initMobileNav(); + initFooterLink(); updateControlStates(); // Show first-visit animation @@ -601,60 +612,6 @@ } } - // ============================================ - // Critical Styles (Prevent Flash) - // ============================================ - - (function applyCriticalStyles() { - try { - const stored = localStorage.getItem(STORAGE_KEY); - if (stored) { - const prefs = JSON.parse(stored); - - // Apply theme immediately - if (prefs.theme && prefs.theme !== 'light') { - if (prefs.theme === 'system') { - const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches; - if (prefersDark) { - html.setAttribute('data-theme', 'dark'); - } - } else { - html.setAttribute('data-theme', prefs.theme); - } - } - - // Apply font scale - if (prefs.fontSize && FONT_SIZES[prefs.fontSize]) { - html.setAttribute('data-font-size', prefs.fontSize); - } - - // Apply dyslexia font - if (prefs.dyslexiaFont) { - html.setAttribute('data-dyslexia', 'true'); - } - - // Apply other critical preferences - if (prefs.lineSpacing) { - html.setAttribute('data-line-spacing', prefs.lineSpacing); - } - - if (prefs.readingWidth) { - html.setAttribute('data-reading-width', prefs.readingWidth); - } - - if (prefs.enhancedFocus) { - html.setAttribute('data-enhanced-focus', 'true'); - } - - if (prefs.reducedMotion && prefs.reducedMotion !== 'system') { - html.setAttribute('data-reduced-motion', prefs.reducedMotion); - } - } - } catch (e) { - // Silent fail - } - })(); - - // Start + // Start - FOUC prevention handled by inline script in head.html init(); })(); diff --git a/themes/swissfini/layouts/_default/baseof.html b/themes/swissfini/layouts/_default/baseof.html index a427d87..def1856 100644 --- a/themes/swissfini/layouts/_default/baseof.html +++ b/themes/swissfini/layouts/_default/baseof.html @@ -12,16 +12,20 @@ {{- block "main" . }}{{- end }} - {{- partial "footer.html" . -}} + {{- partialCached "footer.html" . "footer" -}} - {{- partial "accessibility-panel.html" . -}} + {{- partialCached "accessibility-panel.html" . "a11y-panel" -}} {{/* Backdrop for panel */}} {{/* Load JavaScript */}} - {{ $js := resources.Get "js/accessibility.js" | minify | fingerprint }} - + {{ with resources.Get "js/accessibility.js" }} + {{ $opts := dict "minify" true }} + {{ with . | js.Build $opts | fingerprint }} + + {{ end }} + {{ end }} diff --git a/themes/swissfini/layouts/partials/footer.html b/themes/swissfini/layouts/partials/footer.html index cc7019b..0892d5b 100644 --- a/themes/swissfini/layouts/partials/footer.html +++ b/themes/swissfini/layouts/partials/footer.html @@ -45,11 +45,3 @@ - - diff --git a/themes/swissfini/layouts/partials/head.html b/themes/swissfini/layouts/partials/head.html index 2f27796..bec8893 100644 --- a/themes/swissfini/layouts/partials/head.html +++ b/themes/swissfini/layouts/partials/head.html @@ -54,7 +54,7 @@ {{ $main := resources.Get "css/main.css" }} {{ $allCSS := slice $variables $reset $typography $dark $highContrast $header $footer $article $accessibilityPanel $focus $print $main | resources.Concat "css/bundle.css" | minify | fingerprint }} - + {{/* Favicon */}}