1/* Castlemap theme switch â dark is the site's identity and the default; 2 "light" is a per-visitor opt-in remembered in localStorage. Loaded in 3 <head> WITHOUT defer (the CSP is script-src 'self', so no inline scripts) 4 so a stored choice applies before first paint. Clicks are DELEGATED, so 5 .themetoggle buttons the map SPA mounts later work too; every flip 6 dispatches "castlemap:theme" for the map canvas to repaint itself. */ 7(function () { 8 function tint(light) { 9 var m = document.querySelector('meta[name="theme-color"]'); 10 if (m) m.setAttribute('content', light ? '#f4efe2' : '#0a0f14'); 11 } 12 var light = false; 13 try { light = localStorage.getItem('castlemap.theme') === 'light'; } catch (e) {} 14 if (light) { document.documentElement.classList.replace('dark', 'light'); tint(true); } 15 document.addEventListener('click', function (e) { 16 var t = e.target; 17 var b = t && t.closest ? t.closest('.themetoggle') : null; 18 if (!b) return; 19 var h = document.documentElement, l = h.classList.toggle('light'); 20 h.classList.toggle('dark', !l); 21 tint(l); 22 try { localStorage.setItem('castlemap.theme', l ? 'light' : 'dark'); } catch (e2) {} 23 try { document.dispatchEvent(new CustomEvent('castlemap:theme', { detail: { light: l } })); } catch (e2) {} 24 }); 25})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.