Kept as the theme is, in a cookie each browser its own, and put on the page by boot.js before the first frame. Theme's own, the default, adds no rule, so Modern's Inter, Classic's Lucida Grande and Glass's system face are as they were. The others are on the device already or served by ipx (Inter), so choosing one downloads nothing. Their rules are last in app.css, where they tie with each theme's own body font and win. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
8 lines
683 B
JavaScript
8 lines
683 B
JavaScript
// Runs in <head>, before the first frame (#203): this browser's theme and font (#359), from their cookies, and
|
|
// whether the last visit here was an admin's, so the link to Admin is there from the start. The
|
|
// server wrote both into the page while it served it; the page is a static file now.
|
|
(()=>{const r=document.documentElement,c=/(?:^|; )ipx_theme=([a-z]{1,20})\.(light|dark|auto)(?:;|$)/.exec(document.cookie);
|
|
if(c){r.dataset.theme=c[1];r.dataset.choice=c[2];if(c[2]!=='auto')r.dataset.mode=c[2];}
|
|
const f=/(?:^|; )ipx_font=([a-z]{1,10})(?:;|$)/.exec(document.cookie);if(f)r.dataset.font=f[1];
|
|
try{if(localStorage.getItem('ipx.admin')==='1')r.dataset.admin='';}catch{}})();
|