stream: make the station name a single configurable variable

Default it to "Nemu FM" and derive the tab title, logo, and dynamic
document title from one STATION_NAME constant for easy renaming.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
nemunaire 2026-07-03 12:12:48 +08:00
commit fa1be6df77

View file

@ -3,7 +3,7 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<title>radieo</title> <title id="pageTitle"></title>
<style> <style>
:root { color-scheme: dark; } :root { color-scheme: dark; }
* { box-sizing: border-box; } * { box-sizing: border-box; }
@ -80,7 +80,7 @@
</head> </head>
<body> <body>
<main class="card"> <main class="card">
<div class="logo"> radieo</div> <div class="logo" id="stationName"></div>
<div class="np-label"><span class="dot"></span>en cours</div> <div class="np-label"><span class="dot"></span>en cours</div>
<div class="title" id="title"></div> <div class="title" id="title"></div>
<div class="artist" id="artist"></div> <div class="artist" id="artist"></div>
@ -99,6 +99,11 @@
</section> </section>
</main> </main>
<script> <script>
// Nom de la station, modifiable ici (repris dans le logo et le titre de l'onglet).
const STATION_NAME = "Nemu FM";
document.getElementById("stationName").textContent = "◈ " + STATION_NAME;
document.getElementById("pageTitle").textContent = STATION_NAME;
const titleEl = document.getElementById("title"); const titleEl = document.getElementById("title");
const artistEl = document.getElementById("artist"); const artistEl = document.getElementById("artist");
const player = document.getElementById("player"); const player = document.getElementById("player");
@ -160,7 +165,7 @@
const a = (m.artist || "").trim(); const a = (m.artist || "").trim();
titleEl.textContent = t || "—"; titleEl.textContent = t || "—";
artistEl.textContent = a; artistEl.textContent = a;
document.title = t ? (a ? `${t} — ${a} · radieo` : `${t} · radieo`) : "radieo"; document.title = t ? (a ? `${t} — ${a} · ${STATION_NAME}` : `${t} · ${STATION_NAME}`) : STATION_NAME;
} catch (e) { /* keep last known values */ } } catch (e) { /* keep last known values */ }
} }