您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Hide li elements without "sep" class and add toggle button
当前为
// ==UserScript== // @name Toggle Button for Non-sep Items // @namespace https://jirehlov.com // @version 0.2 // @description Hide li elements without "sep" class and add toggle button // @author Jirehlov // @match https://bgm.tv/subject/* // @match https://bangumi.tv/subject/* // @match https://chii.in/subject/* // @grant none // @license MIT // ==/UserScript== (function () { "use strict"; const ulElement = document.querySelector("div.subject_section ul.browserCoverMedium"); if (!ulElement) return; const liElements = ulElement.querySelectorAll("li"); let lastSepElement = null; let relatedItems = []; liElements.forEach(li => { if (li.classList.contains("sep")) { if (relatedItems.length > 0) { addToggleButton(lastSepElement, relatedItems); relatedItems = []; } lastSepElement = li; } else { if (lastSepElement) { relatedItems.push(li); li.style.display = "none"; } } }); if (relatedItems.length > 0) { addToggleButton(lastSepElement, relatedItems); } function addToggleButton(sepElement, relatedItems) { const subSpan = sepElement.querySelector("span.sub"); if (!subSpan) return; const toggleButton = document.createElement("span"); toggleButton.textContent = "[展开]"; toggleButton.style.cursor = "pointer"; toggleButton.style.color = "#2EA6FF"; toggleButton.style.marginLeft = "5px"; toggleButton.addEventListener("click", function () { const isHidden = relatedItems[0].style.display === "none"; relatedItems.forEach(item => { item.style.display = isHidden ? "list-item" : "none"; }); toggleButton.textContent = isHidden ? "[折叠]" : "[展开]"; }); subSpan.appendChild(toggleButton); } }());
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址