web: fix error in lockdown safari + charts: update instead of setData when possible

This commit is contained in:
nym21
2025-06-16 18:20:56 +02:00
parent 098f6de047
commit 985e961876
9 changed files with 262 additions and 216 deletions

View File

@@ -1,4 +1,4 @@
<!doctype html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
@@ -1375,7 +1375,7 @@
// @ts-check
const preferredColorSchemeMatchMedia = window.matchMedia(
"(prefers-color-scheme: dark)",
"(prefers-color-scheme: dark)"
);
const themeColor = window.document.createElement("meta");
@@ -1385,7 +1385,7 @@
/** @param {boolean} dark */
function updateThemeColor(dark) {
const theme = getComputedStyle(
window.document.documentElement,
window.document.documentElement
).getPropertyValue(dark ? "--black" : "--white");
themeColor.content = theme;
}
@@ -1395,7 +1395,7 @@
"change",
({ matches }) => {
updateThemeColor(matches);
},
}
);
if ("standalone" in window.navigator && !!window.navigator.standalone) {
@@ -1404,7 +1404,9 @@
if ("serviceWorker" in navigator) {
window.addEventListener("load", () => {
navigator.serviceWorker.register("/service-worker.js");
navigator.serviceWorker.register("/service-worker.js", {
scope: "/",
});
});
}
</script>
@@ -1852,13 +1854,15 @@
</div>
<script>
// Prevent width jumping
const savedWidth = localStorage.getItem("bar-width");
if (savedWidth) {
const main = window.document.getElementById("main");
if (!main) throw "Should exist";
main.style.width = `${savedWidth}px`;
}
try {
// Prevent width jumping
const savedWidth = localStorage.getItem("bar-width");
if (savedWidth) {
const main = window.document.getElementById("main");
if (!main) throw "Should exist";
main.style.width = `${savedWidth}px`;
}
} catch (_) {}
</script>
</body>
</html>