diff --git a/variety/variety-shows.html b/variety/variety-shows.html index 8ec049e..cfe0927 100644 --- a/variety/variety-shows.html +++ b/variety/variety-shows.html @@ -60,45 +60,6 @@ margin: 0 0 0 auto; } - body.variety-shows-page .variety-shows-year-nav { - display: flex; - flex-wrap: wrap; - justify-content: flex-start; - gap: 8px; - margin: 0 0 1.25rem; - padding: 0; - list-style: none; - } - - body.variety-shows-page .variety-shows-year-nav button { - border: 1px solid #e0e0e0; - background: #fafafa; - color: #333; - font-weight: 700; - font-size: 0.9rem; - padding: 8px 14px; - border-radius: 999px; - cursor: pointer; - font-family: inherit; - } - - body.variety-shows-page .variety-shows-year-nav button:hover, - body.variety-shows-page .variety-shows-year-nav button:focus-visible { - border-color: #ffcc00; - background: #fff9e0; - outline: none; - } - - body.variety-shows-page .variety-shows-year-nav button.is-active { - border-color: #ffcc00; - background: #ffcc00; - color: #2f2f2f; - } - - body.variety-shows-page .variety-shows-year-nav[hidden] { - display: none; - } - body.variety-shows-page .variety-shows-table-slot[hidden] { display: none; } @@ -150,7 +111,6 @@ color: #444; } - body.variety-shows-page .variety-table--inner tbody tr:last-child td, body.variety-shows-page .variety-table__year-list>.variety-table__show-row:last-child td { border-bottom: 1px solid #f0f0f0; } @@ -218,25 +178,11 @@ transform: rotate(180deg); } - body.variety-shows-page .variety-table__year-panel { - padding: 0; - background: #fff; - } - - body.variety-shows-page .variety-table__year-panel[hidden] { - display: none; - } - - body.variety-shows-page .variety-table--inner { - margin: 0; - } - body.variety-shows-page .variety-table__show-row[hidden] { display: none; } - body.variety-shows-page .variety-table tbody tr.variety-table__show-row:nth-child(even) td, - body.variety-shows-page .variety-table--inner tbody tr:nth-child(even) td { + body.variety-shows-page .variety-table__year-list>tr.variety-table__show-row:nth-child(even) td { background: #fcfcfc; } @@ -336,14 +282,6 @@
- -
@@ -360,17 +298,15 @@ - - - - - - - - - - - - - - - - - - - -
@@ -773,10 +676,6 @@ const tabBtns = document.querySelectorAll(".variety-shows-tabs .tab-btn"); const slots = document.querySelectorAll(".variety-shows-table-slot"); const input = document.getElementById("variety-shows-search"); - const yearNav = document.querySelector(".variety-shows-year-nav"); - const yearNavBtns = yearNav - ? yearNav.querySelectorAll("button[data-year]") - : []; const hashToTab = { "captain-brothers": "captain", "each-rampage": "solo", @@ -787,69 +686,61 @@ return hashToTab[id] || "all"; } - function setYearOpen(yearRow, open) { - const btn = yearRow.querySelector(".variety-table__year-toggle"); - const panel = yearRow.querySelector(".variety-table__year-panel"); - if (!btn || !panel) return; - btn.setAttribute("aria-expanded", open ? "true" : "false"); - panel.hidden = !open; - yearRow.classList.toggle("is-open", open); + function rowMatchesSearch(row, q) { + if (!q) return true; + const air = row.querySelector(".variety-table__air-date"); + const airData = air + ? `${air.dataset.airStart || ""} ${air.dataset.airEnd || ""}` + : ""; + const text = (row.textContent + " " + airData) + .replace(/\s+/g, " ") + .trim() + .toLowerCase(); + return text.includes(q); } - function visibleSlotWithYears() { - return Array.from(slots).find( - (slot) => !slot.hidden && slot.querySelector(".variety-table__year-row") - ); - } + function syncYearRows(slot) { + const q = (input && input.value.trim().toLowerCase()) || ""; + slot.querySelectorAll(".variety-table__year-row").forEach((yearRow) => { + const year = yearRow.dataset.year; + const btn = yearRow.querySelector(".variety-table__year-toggle"); + const detailRows = slot.querySelectorAll( + `.variety-table__show-row[data-year="${year}"]` + ); + let anyMatch = false; + const yearOpen = yearRow.classList.contains("is-open"); - function setActiveYearNav(year) { - yearNavBtns.forEach((btn) => { - btn.classList.toggle("is-active", btn.dataset.year === year); + detailRows.forEach((row) => { + const match = rowMatchesSearch(row, q); + if (match) anyMatch = true; + row.hidden = !yearOpen || (q && !match); + }); + + if (q && anyMatch) { + yearRow.classList.add("is-open"); + if (btn) btn.setAttribute("aria-expanded", "true"); + detailRows.forEach((row) => { + row.hidden = !rowMatchesSearch(row, q); + }); + } + + yearRow.hidden = Boolean(q) && !anyMatch; }); } - function openYear(year) { - const slot = visibleSlotWithYears(); - if (!slot) return; - const yearRow = slot.querySelector( - `.variety-table__year-row[data-year="${year}"]` - ); - if (!yearRow) return; - setYearOpen(yearRow, true); - setActiveYearNav(year); - yearRow.scrollIntoView({ behavior: "smooth", block: "nearest" }); - } - - function updateYearNavVisibility(tab) { - if (!yearNav) return; - yearNav.hidden = tab === "solo"; + function setYearOpen(yearRow, open) { + const btn = yearRow.querySelector(".variety-table__year-toggle"); + if (!btn) return; + btn.setAttribute("aria-expanded", open ? "true" : "false"); + yearRow.classList.toggle("is-open", open); + const slot = yearRow.closest(".variety-shows-table-slot"); + if (slot) syncYearRows(slot); } function filterVisibleRows() { - const q = (input && input.value.trim().toLowerCase()) || ""; slots.forEach((slot) => { if (slot.hidden) return; - slot.querySelectorAll(".variety-table__year-row").forEach((yearRow) => { - const detailRows = yearRow.querySelectorAll( - ".variety-table--inner tbody tr" - ); - let anyMatch = false; - detailRows.forEach((row) => { - const air = row.querySelector(".variety-table__air-date"); - const airData = air - ? `${air.dataset.airStart || ""} ${air.dataset.airEnd || ""}` - : ""; - const text = (row.textContent + " " + airData) - .replace(/\s+/g, " ") - .trim() - .toLowerCase(); - const match = !q || text.includes(q); - row.hidden = !match; - if (match) anyMatch = true; - }); - if (q && anyMatch) setYearOpen(yearRow, true); - yearRow.hidden = Boolean(q) && !anyMatch; - }); + syncYearRows(slot); }); } @@ -858,16 +749,9 @@ const yearRow = btn.closest(".variety-table__year-row"); const open = btn.getAttribute("aria-expanded") !== "true"; setYearOpen(yearRow, open); - if (open && yearRow.dataset.year) { - setActiveYearNav(yearRow.dataset.year); - } }); }); - yearNavBtns.forEach((btn) => { - btn.addEventListener("click", () => openYear(btn.dataset.year)); - }); - function showTab(tab) { tabBtns.forEach((btn) => { const on = btn.dataset.tab === tab; @@ -878,8 +762,6 @@ const keys = (slot.dataset.showTabs || "").split(/\s+/); slot.hidden = !keys.includes(tab); }); - updateYearNavVisibility(tab); - if (tab === "solo") setActiveYearNav(""); filterVisibleRows(); }