Add AniList alternative titles to watchlist
This commit is contained in:
@@ -501,6 +501,52 @@ WATCHLIST_HTML = r"""<!doctype html>
|
||||
line-height: 1.35;
|
||||
white-space: pre-line;
|
||||
}
|
||||
.alt-titles {
|
||||
display: grid;
|
||||
gap: 8px;
|
||||
}
|
||||
.alt-titles-toggle {
|
||||
width: 100%;
|
||||
min-height: 34px;
|
||||
padding: 0 10px;
|
||||
font-size: 12px;
|
||||
font-weight: 700;
|
||||
justify-content: center;
|
||||
}
|
||||
.alt-titles-panel {
|
||||
display: none;
|
||||
gap: 8px;
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 14px;
|
||||
background: rgba(255, 255, 255, 0.04);
|
||||
padding: 10px;
|
||||
}
|
||||
.alt-titles-panel.open {
|
||||
display: grid;
|
||||
}
|
||||
.alt-titles-list {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 6px;
|
||||
}
|
||||
.alt-title-pill {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
padding: 6px 9px;
|
||||
border-radius: 999px;
|
||||
border: 1px solid var(--line);
|
||||
background: rgba(157, 123, 255, 0.08);
|
||||
font-size: 11px;
|
||||
line-height: 1.3;
|
||||
color: var(--text);
|
||||
}
|
||||
.alt-title-pill strong {
|
||||
color: var(--muted);
|
||||
font-size: 10px;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.06em;
|
||||
}
|
||||
.category-editor {
|
||||
display: grid;
|
||||
gap: 6px;
|
||||
@@ -1008,6 +1054,13 @@ WATCHLIST_HTML = r"""<!doctype html>
|
||||
<span class="count-pill${item.dub_complete ? " complete" : ""}">Dub <strong>${formatModeProgress(item.dub_count, item.expected_count)}</strong></span>
|
||||
</div>
|
||||
<div class="status-row"></div>
|
||||
<div class="alt-titles">
|
||||
<button class="ghost alt-titles-toggle" type="button" aria-expanded="false">Alternative titles</button>
|
||||
<div class="alt-titles-panel">
|
||||
<div class="alt-titles-list"></div>
|
||||
<div class="muted alt-titles-empty"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="category-editor">
|
||||
<label>Category
|
||||
<select class="category-select">${categoryOptions(item.category)}</select>
|
||||
@@ -1049,6 +1102,30 @@ WATCHLIST_HTML = r"""<!doctype html>
|
||||
if (item.dub_complete) {
|
||||
appendStatusTag(statusRow, "Dub ready", "complete");
|
||||
}
|
||||
const altTitlesToggle = card.querySelector(".alt-titles-toggle");
|
||||
const altTitlesPanel = card.querySelector(".alt-titles-panel");
|
||||
const altTitlesList = card.querySelector(".alt-titles-list");
|
||||
const altTitlesEmpty = card.querySelector(".alt-titles-empty");
|
||||
const alternativeTitles = Array.isArray(item.alternative_titles) ? item.alternative_titles : [];
|
||||
if (alternativeTitles.length) {
|
||||
for (const title of alternativeTitles) {
|
||||
const pill = document.createElement("span");
|
||||
pill.className = "alt-title-pill";
|
||||
const label = document.createElement("strong");
|
||||
label.textContent = title.label;
|
||||
const value = document.createElement("span");
|
||||
value.textContent = title.value;
|
||||
pill.append(label, value);
|
||||
altTitlesList.appendChild(pill);
|
||||
}
|
||||
altTitlesEmpty.textContent = "Fetched from AniList.";
|
||||
} else {
|
||||
altTitlesEmpty.textContent = "AniList alternative titles were not available for this show.";
|
||||
}
|
||||
altTitlesToggle.addEventListener("click", () => {
|
||||
const open = altTitlesPanel.classList.toggle("open");
|
||||
altTitlesToggle.setAttribute("aria-expanded", open ? "true" : "false");
|
||||
});
|
||||
card.querySelector(".card-date").textContent = item.status_message
|
||||
? `Last checked: ${checked}\n${item.status_message}`
|
||||
: `Last checked: ${checked}`;
|
||||
|
||||
Reference in New Issue
Block a user