Files
bgclock/public_html/sw.js
T
hansdezwartandClaude Opus 5 7a820b44f8 Share a real baseline between the score labels and their numbers
The panel readout lined its labels up with their numbers only by luck.
.head is a grid with align-items left at its default, so both cells
stretch and each one's text sits at the top of its own box. The two
baselines coincided because the label run and the digit run happened to
measure the same, not because anything asked for it.

Force the value cell onto a face with different metrics and the old CSS
drifts 1-4px either way — Amiri -4px, Avenir and Alegreya -2px,
AnjaliOldLipi +2px, that last one putting the label baseline below the
number, which is the reported symptom. With align-items:baseline every
one of those is 0.0000px.

Rendering is untouched where the metrics already agree: before and after
differ by 0 pixels across the whole frame, same text bands, same 7px of
whitespace above the Moves line.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-11 16:17:05 +02:00

34 lines
980 B
JavaScript

/* Cache-first: once installed the clock never touches the network again. */
const CACHE = "bgclock-v9";
const FILES = [
"./",
"./index.html",
"./manifest.webmanifest",
"./icon-192.png",
"./icon-512.png",
"./icon-maskable-512.png"
];
self.addEventListener("install", (e) => {
e.waitUntil(caches.open(CACHE).then((c) => c.addAll(FILES)).then(() => self.skipWaiting()));
});
self.addEventListener("activate", (e) => {
e.waitUntil(
caches.keys()
.then((keys) => Promise.all(keys.filter((k) => k !== CACHE).map((k) => caches.delete(k))))
.then(() => self.clients.claim())
);
});
self.addEventListener("fetch", (e) => {
if (e.request.method !== "GET") return;
e.respondWith(
caches.match(e.request).then((hit) => hit || fetch(e.request).then((res) => {
const copy = res.clone();
caches.open(CACHE).then((c) => c.put(e.request, copy)).catch(() => {});
return res;
}).catch(() => caches.match("./index.html")))
);
});