They sat between Match and Time as three bare buttons, above the two settings they set. Now they follow Delay, after the numbers they are a shortcut for, with a "Preset time limits" heading and "Quickly pick a setting." — the same heading-and-description shape every other row in the sheet already has. The row stacks at every width rather than only under the .row--wide breakpoint: three buttons wide enough to read "3m / 15s" can't share a line with a label on any phone. The buttons themselves are untouched, and are still found by class rather than position, so the highlight logic came along unchanged — checked that opening the sheet lights the preset matching the current numbers, stepping the delay off it clears every highlight, and stepping back relights it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
34 lines
981 B
JavaScript
34 lines
981 B
JavaScript
/* Cache-first: once installed the clock never touches the network again. */
|
|
const CACHE = "bgclock-v13";
|
|
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")))
|
|
);
|
|
});
|