diff --git a/static/app.js b/static/app.js index 41cfe73..cbc25f9 100644 --- a/static/app.js +++ b/static/app.js @@ -300,6 +300,12 @@ async function showAnime(slug_id, opts = {}) { player.append(videoEl()); main.append(player); + // "now playing" line: E-number + MAL episode title (name arrives async + // from Jikan, so setNowEp() refreshes it whenever the name lands) + const nowEp = el("div", "now-ep"); + nowEp.id = "now-ep"; + main.append(nowEp); + const controls = el("div", "controls"); const langBtn = el("button", null, langLabel()); langBtn.onclick = () => { @@ -668,7 +674,7 @@ function attachEpNames() { p.then(list => { let changed = false; list.forEach((t, i) => { if (t && t.title && epsList[i]) { epsList[i].name = t.title; changed = true; } }); - if (changed) renderEps(); + if (changed) { renderEps(); if (currentEp) setNowEp(currentEp.ep_id, currentEp.ep_no); } }); } @@ -798,8 +804,16 @@ function nextCountdown(nxt) { draw(); } +function setNowEp(ep_id, ep_no) { + const n = document.getElementById("now-ep"); + if (!n) return; + const e = epsList.find(x => String(x.id) === String(ep_id)); + n.textContent = "E" + ep_no + (e && e.name ? " — " + e.name : ""); +} + async function play(ep_id, ep_no) { playerBroken = false; + setNowEp(ep_id, ep_no); localStorage.setItem("aniweb_lang_" + detail.slug_id, lang); try { const s = await api(`/api/episode/${ep_id}/stream?lang=${lang}`); diff --git a/static/index.html b/static/index.html index 16a0952..c532876 100644 --- a/static/index.html +++ b/static/index.html @@ -6,7 +6,7 @@