Fix FOUC. Again.

This commit is contained in:
Benjamin A. Shelton 2026-11-29 19:27:16 -07:00
commit 4d8f83a63c
Signed by: zancarius
GPG key ID: 8BD42DBD6C337E01

View file

@ -14,19 +14,32 @@ const base = import.meta.env.BASE_URL;
<html lang="en"> <html lang="en">
<head> <head>
<script is:inline> <script is:inline>
var cl = document.documentElement.classList; function th() {
if ('theme' in localStorage || 'af_mode' in localStorage) { var cl = document.documentElement.classList;
if (localStorage.af_enabled === '1' && localStorage.af_mode === 'df') { af_enabled = 'af_enabled' in localStorage && localStorage.af_enabled === '1' ? true : false;
cl.add('df'); af_mode = 'af_mode' in localStorage ? localStorage.af_mode : '';
} else { theme = 'theme' in localStorage ? localStorage.theme : '';
if (localStorage.theme === 'dark' || window.matchMedia('(prefers-color-scheme: dark)').matches) {
cl.add('dark'); if (theme === '' || theme === 'system') {
} theme = window.matchMedia('(prefers-color-scheme: dark)') ? 'dark' : 'light';
if (localStorage.af_enabled === '1' && localStorage.af_mode == 'hc') { }
cl.add('hc');
} if (af_enabled) {
} switch (af_mode) {
} case 'df':
cl.add('df');
return;
case 'hc':
cl.add('hc');
break;
}
}
if (theme === 'dark') {
cl.add('dark');
}
}
th();
</script> </script>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />