fix: backfill posters for ALL history entries; skip <img> when no poster
- backfill script deduped by slug_id, so a second entry for the same anime kept no poster -> rendered as a broken <img src=""> - re-backfilled from the already-fetched poster per slug - showHome now only emits an <img> when the entry has a poster
This commit is contained in:
1 parent
2b7eb4cdd1
commit
0a86e70a54
1 file changed
+8
-3
+8
-3
@@ -76,8 +76,10 @@ function showHome() {
|
|||||||
const sec = el("section", "hero-sec");
|
const sec = el("section", "hero-sec");
|
||||||
const card = el("a", "hero");
|
const card = el("a", "hero");
|
||||||
card.href = histHref(hero);
|
card.href = histHref(hero);
|
||||||
const img = el("img"); img.src = hero.poster || ""; img.alt = "";
|
if (hero.poster) {
|
||||||
|
const img = el("img"); img.src = hero.poster; img.alt = "";
|
||||||
card.append(img);
|
card.append(img);
|
||||||
|
}
|
||||||
const right = el("div", "right");
|
const right = el("div", "right");
|
||||||
const body = el("div", "hero-body");
|
const body = el("div", "hero-body");
|
||||||
body.append(el("div", "hero-kicker", "continue watching"),
|
body.append(el("div", "hero-kicker", "continue watching"),
|
||||||
@@ -97,7 +99,10 @@ function showHome() {
|
|||||||
for (const x of history.slice(1, 6)) {
|
for (const x of history.slice(1, 6)) {
|
||||||
const c = el("a", "card");
|
const c = el("a", "card");
|
||||||
c.href = histHref(x);
|
c.href = histHref(x);
|
||||||
const i = el("img"); i.src = x.poster || ""; i.alt = "";
|
if (x.poster) {
|
||||||
|
const i = el("img"); i.src = x.poster; i.alt = "";
|
||||||
|
c.append(i);
|
||||||
|
}
|
||||||
const info = el("div", "mini-info");
|
const info = el("div", "mini-info");
|
||||||
info.append(el("div", "card-name", x.title));
|
info.append(el("div", "card-name", x.title));
|
||||||
const meta = el("div", "mini-meta");
|
const meta = el("div", "mini-meta");
|
||||||
@@ -105,7 +110,7 @@ function showHome() {
|
|||||||
info.append(meta);
|
info.append(meta);
|
||||||
const pb = bar(x, "small");
|
const pb = bar(x, "small");
|
||||||
if (pb) info.append(pb);
|
if (pb) info.append(pb);
|
||||||
c.append(i, info);
|
c.append(info);
|
||||||
grid.append(c);
|
grid.append(c);
|
||||||
}
|
}
|
||||||
main.append(grid);
|
main.append(grid);
|
||||||
|
|||||||
Reference in new issue
Block a user