Playback page: show 'E{n} — episode title' line under the video
The name was only in the grid tooltip (hover-only, invisible on touch). Add a persistent now-playing line between the player and controls: 'E1 — Ryomen Sukuna'. setNowEp() runs on every play() and refreshes when the async Jikan name lands late. Bumped asset version to v=3.
This commit is contained in:
1 parent
8840a883c0
commit
07554e4aa8
3 files changed
+19
-3
No files matched your search
+15
-1
@@ -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}`);
|
||||
|
||||
Reference in new issue
Block a user