Files
breadcrumb-the-shire/web/js/app-boot.js
fs d9f07dcd63 fix: web/ quick wins — CSS cleanup, ARIA tabs, and file header comments
CSS:
- Remove duplicate li::before block in app-search.css
- Fix typo: search-reuslt → search-result in app-search.css
- Remove commented-out CSS rules in app-flash.css
- Add descriptive header comment to all 27 CSS component files

JS:
- Complete WAI-ARIA Tabs pattern: generate IDs, add aria-controls on
  tab buttons and aria-labelledby on tab panels (app-tabs.js)
- Add JSDoc header comments to ~33 JS files (core + components)
- Add explanatory block comment to app-boot.js (why classic IIFE)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 22:21:37 +01:00

49 lines
1.5 KiB
JavaScript

/**
* Render-blocking boot script — runs synchronously before first paint.
*
* Intentionally a classic IIFE (not an ES module) so the browser executes it
* immediately while parsing <head>. This prevents layout flicker by applying
* persisted UI state (sidebar collapsed, contrast mode) before any content
* is rendered. Uses `var` for broadest compatibility in the sync path.
*/
(function () {
var root = document.documentElement;
root.classList.remove('no-js');
root.classList.add('js');
root.classList.add('aside-pending');
var assetBase = root.dataset.assetBase || '';
if (assetBase) {
window.APP_ASSET_BASE = assetBase;
}
try {
if (window.localStorage.getItem('app-sidebar-collapsed') === '1') {
root.classList.add('sidebar-collapsed');
}
if (window.localStorage.getItem('app-sidebar-hidden') === '1') {
root.classList.add('sidebar-hidden');
}
var contrastValue = window.localStorage.getItem('app-contrast');
if (contrastValue === 'high') {
root.dataset.contrast = 'high';
} else {
root.dataset.contrast = 'normal';
}
} catch (e) {
// ignore storage errors
}
if (typeof window.requestFsLightboxRefresh !== 'function') {
window.requestFsLightboxRefresh = function () {
if (typeof window.refreshFsLightbox === 'function') {
window.refreshFsLightbox();
window.__fsLightboxRefreshPending = false;
return true;
}
window.__fsLightboxRefreshPending = true;
return false;
};
}
})();