duly / web/boot.js · raw
// Runs before the page paints: marks that JavaScript is on, so hints written for// readers without it (in the server-rendered pages) can be hidden, and applies the// reader's saved light or dark choice so the page never flashes the other theme.document.documentElement.classList.add('js');try {  const t = localStorage.getItem('duly-theme');  if (t === 'light' || t === 'dark') document.documentElement.dataset.theme = t;} catch {  // Storage blocked (private window, site data off): follow the system setting.}// Motion only when the reader allows it and the browser can tell what is on screen.// If the app script never takes over, fall back to the static page after 4 s.try {  if ('IntersectionObserver' in window && !matchMedia('(prefers-reduced-motion: reduce)').matches) {    document.documentElement.classList.add('motion');    setTimeout(() => {      if (!window.__dulyMotion) document.documentElement.classList.remove('motion');    }, 4000);  }} catch {  document.documentElement.classList.remove('motion');}