Choose a font in Settings, beside the theme (#359)

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>
This commit is contained in:
2026-10-25 01:10:28 +00:00
parent c6ca4d1a91
commit 6f38c0ad9b
7 changed files with 56 additions and 2 deletions

View File

@@ -1,6 +1,7 @@
// Runs in <head>, before the first frame (#203): this browser's theme, from its cookie, and
// 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{}})();