website: add sw

This commit is contained in:
k
2024-09-16 19:17:19 +02:00
parent 9dbffb0c93
commit 48e9a9c7dd
7 changed files with 1261 additions and 109 deletions
+7 -3
View File
@@ -1,4 +1,4 @@
<!doctype html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
@@ -1298,7 +1298,7 @@
localStorage.getItem(settingsThemeLocalStorageKey)
);
const preferredColorSchemeMatchMedia = window.matchMedia(
"(prefers-color-scheme: dark)",
"(prefers-color-scheme: dark)"
);
if (
theme === "dark" ||
@@ -1310,7 +1310,7 @@
}
const backgroundColor = getComputedStyle(
window.document.documentElement,
window.document.documentElement
).getPropertyValue("--background-color");
const meta = window.document.createElement("meta");
meta.name = "theme-color";
@@ -1320,6 +1320,10 @@
if ("standalone" in window.navigator && !!window.navigator.standalone) {
window.document.documentElement.dataset.display = "standalone";
}
if ("serviceWorker" in navigator) {
navigator.serviceWorker.register("/service-worker.js");
}
</script>
<!-- Icons -->