From 8708c9b08621df2b70fc2dfc76ef47f279d2372b Mon Sep 17 00:00:00 2001 From: Eric Meehan Date: Wed, 21 Oct 2026 14:21:28 -0400 Subject: [PATCH] favicon --- server.py | 1 + static/app.js | 9 +++++++++ static/favicon-black.svg | 6 ++++++ static/favicon-blue.svg | 6 ++++++ static/favicon-green.svg | 6 ++++++ static/favicon-red.svg | 6 ++++++ static/favicon-white.svg | 6 ++++++ static/favicon-yellow.svg | 6 ++++++ static/index.html | 2 +- 9 files changed, 47 insertions(+), 1 deletion(-) create mode 100755 static/favicon-black.svg create mode 100755 static/favicon-blue.svg create mode 100755 static/favicon-green.svg create mode 100755 static/favicon-red.svg create mode 100755 static/favicon-white.svg create mode 100755 static/favicon-yellow.svg diff --git a/server.py b/server.py index 59ec27a..0e0d538 100644 --- a/server.py +++ b/server.py @@ -62,6 +62,7 @@ for _z in ZONES: ZONES[-1]["remaining_to_ms"] = 0 STATIC_FILES = { + **{f"/favicon-{zone['name']}.svg": (f"favicon-{zone['name']}.svg", "image/svg+xml") for zone in ZONES}, "/": ("index.html", "text/html; charset=utf-8"), "/index.html": ("index.html", "text/html; charset=utf-8"), "/app.js": ("app.js", "text/javascript; charset=utf-8"), diff --git a/static/app.js b/static/app.js index bd830ee..2395305 100644 --- a/static/app.js +++ b/static/app.js @@ -336,6 +336,14 @@ function formatDuration(ms) { return `${Math.round(ms / 1000)}s`; } +let faviconZone = "green"; + +function updateFavicon(zoneName) { + if (zoneName === faviconZone) return; + $("zone-favicon").href = `/favicon-${zoneName}.svg`; + faviconZone = zoneName; +} + function setZoneClass(el, zoneName) { el.className = el.className.replace(/\bzone-\w+/g, "").trim(); el.classList.add(`zone-${zoneName}`); @@ -432,6 +440,7 @@ function tick() { cd.textContent = formatMs(remaining); setZoneClass(cd, zone.name); setZoneClass($("the-button"), zone.name); + updateFavicon(zone.name); $("zone-label").textContent = game.ended ? "season finished" : `${zone.name} zone \u00b7 ${zone.points} pt${zone.points === 1 ? "" : "s"}`; const pct = Math.min(100, Math.max(0, ((game.duration_ms - remaining) / game.duration_ms) * 100)); $("zone-marker").style.left = `${pct}%`; diff --git a/static/favicon-black.svg b/static/favicon-black.svg new file mode 100755 index 0000000..66c6654 --- /dev/null +++ b/static/favicon-black.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/static/favicon-blue.svg b/static/favicon-blue.svg new file mode 100755 index 0000000..ae3becf --- /dev/null +++ b/static/favicon-blue.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/static/favicon-green.svg b/static/favicon-green.svg new file mode 100755 index 0000000..41dbd42 --- /dev/null +++ b/static/favicon-green.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/static/favicon-red.svg b/static/favicon-red.svg new file mode 100755 index 0000000..46cdb2c --- /dev/null +++ b/static/favicon-red.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/static/favicon-white.svg b/static/favicon-white.svg new file mode 100755 index 0000000..5405551 --- /dev/null +++ b/static/favicon-white.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/static/favicon-yellow.svg b/static/favicon-yellow.svg new file mode 100755 index 0000000..737f456 --- /dev/null +++ b/static/favicon-yellow.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/static/index.html b/static/index.html index 0a8b1c9..ede4d89 100644 --- a/static/index.html +++ b/static/index.html @@ -12,7 +12,7 @@ - +