mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-04-26 23:59:58 -07:00
web: fix error in lockdown safari + charts: update instead of setData when possible
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user