修改UI
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
(function () {
|
||||
var section = document.querySelector(".detail-episodes");
|
||||
var section = document.querySelector("[data-dh-episodes]");
|
||||
if (!section) return;
|
||||
|
||||
var ranges = section.querySelectorAll(".detail-episode-range");
|
||||
var episodes = section.querySelectorAll(".detail-episode-list .detail-episode");
|
||||
var ranges = section.querySelectorAll(".dh-range");
|
||||
var episodes = section.querySelectorAll(".dh-ep");
|
||||
if (!episodes.length) return;
|
||||
if (!ranges.length) return;
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
function activate(btn) {
|
||||
ranges.forEach(function (item) {
|
||||
item.classList.toggle("detail-episode-range--active", item === btn);
|
||||
item.classList.toggle("is-active", item === btn);
|
||||
});
|
||||
applyRange(Number(btn.dataset.rangeStart), Number(btn.dataset.rangeEnd));
|
||||
}
|
||||
@@ -28,10 +28,29 @@
|
||||
});
|
||||
});
|
||||
|
||||
var active = section.querySelector(".detail-episode-range--active") || ranges[0];
|
||||
var active = section.querySelector(".dh-range.is-active") || ranges[0];
|
||||
activate(active);
|
||||
})();
|
||||
|
||||
// 简介超出行数时显示「展开 / 收起」
|
||||
(function () {
|
||||
var intro = document.querySelector("[data-dh-intro]");
|
||||
var toggle = document.querySelector("[data-dh-intro-toggle]");
|
||||
if (!intro || !toggle) return;
|
||||
|
||||
function sync() {
|
||||
if (intro.classList.contains("is-expanded")) return;
|
||||
toggle.hidden = intro.scrollHeight <= intro.clientHeight + 1;
|
||||
}
|
||||
|
||||
toggle.addEventListener("click", function () {
|
||||
var expanded = intro.classList.toggle("is-expanded");
|
||||
toggle.textContent = expanded ? "收起" : "展开";
|
||||
});
|
||||
window.addEventListener("resize", sync);
|
||||
sync();
|
||||
})();
|
||||
|
||||
(function () {
|
||||
var shareBtns = document.querySelectorAll("[data-detail-share]");
|
||||
if (!shareBtns.length) return;
|
||||
|
||||
@@ -108,7 +108,7 @@
|
||||
el = el.parentElement;
|
||||
}
|
||||
if (!el || !el.closest) return;
|
||||
var tag = el.closest(".poster-card-tag[data-tag-href], .ranking-card-tag[data-tag-href], .detail-tag[data-tag-href]");
|
||||
var tag = el.closest(".poster-card-tag[data-tag-href], .ranking-card-tag[data-tag-href]");
|
||||
if (!tag) return;
|
||||
var href = tag.getAttribute("data-tag-href");
|
||||
if (!href) return;
|
||||
|
||||
Reference in New Issue
Block a user