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>
function th() {
var cl = document.documentElement.classList; var cl = document.documentElement.classList;
if ('theme' in localStorage || 'af_mode' in localStorage) { af_enabled = 'af_enabled' in localStorage && localStorage.af_enabled === '1' ? true : false;
if (localStorage.af_enabled === '1' && localStorage.af_mode === 'df') { af_mode = 'af_mode' in localStorage ? localStorage.af_mode : '';
theme = 'theme' in localStorage ? localStorage.theme : '';
if (theme === '' || theme === 'system') {
theme = window.matchMedia('(prefers-color-scheme: dark)') ? 'dark' : 'light';
}
if (af_enabled) {
switch (af_mode) {
case 'df':
cl.add('df'); cl.add('df');
} else { return;
if (localStorage.theme === 'dark' || window.matchMedia('(prefers-color-scheme: dark)').matches) { case 'hc':
cl.add('hc');
break;
}
}
if (theme === 'dark') {
cl.add('dark'); cl.add('dark');
} }
if (localStorage.af_enabled === '1' && localStorage.af_mode == 'hc') { }
cl.add('hc'); 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" />