Improve frontend performance and caching behavior

This commit is contained in:
Codex
2026-03-08 00:06:50 +00:00
parent de10c47a8c
commit adb164c8e1
5 changed files with 69 additions and 71 deletions

View File

@@ -1,5 +1,5 @@
<!doctype html>
<html lang="en" data-theme="dark" data-palette="classic" data-fonts="loading">
<html lang="en" data-theme="dark" data-palette="classic">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
@@ -62,9 +62,6 @@
<script>
(function () {
const doc = document.documentElement;
if (!doc.dataset.fonts) {
doc.dataset.fonts = 'loading';
}
try {
const savedTheme = localStorage.getItem('theme');
const savedPalette = localStorage.getItem('palette');
@@ -78,25 +75,6 @@
} catch (error) {
// Ignore errors if storage or matchMedia is unavailable
}
const markFontsReady = () => {
if (doc.dataset.fonts !== 'ready') {
doc.dataset.fonts = 'ready';
}
};
const fallback = setTimeout(markFontsReady, 3000);
const resolveFonts = () => {
clearTimeout(fallback);
markFontsReady();
};
if (
document.fonts &&
document.fonts.ready &&
typeof document.fonts.ready.then === 'function'
) {
document.fonts.ready.then(resolveFonts, resolveFonts);
} else {
resolveFonts();
}
})();
</script>
%sveltekit.head%