您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
过滤中羽在线7×24羽坛资讯中,评论数<20的新闻
// ==UserScript== // @name 【中羽在线】新闻过滤 // @namespace https://github.com/realSilasYang // @version 2025-7-27 // @description 过滤中羽在线7×24羽坛资讯中,评论数<20的新闻 // @author 阳熙来 // @match https://www.badmintoncn.com/* // @icon https://is1-ssl.mzstatic.com/image/thumb/Purple211/v4/e0/30/96/e03096b4-6098-9b40-c3b8-4a974af132d8/AppIcon-0-0-1x_U007emarketing-0-5-0-0-sRGB-85-220.png/246x0w.webp // @license GNU GPLv3 // @grant none // ==/UserScript== (function () { 'use strict'; // 过滤一条 news_list function filterSingle(box) { const pjImg = box.querySelector('img.news_pj'); if (!pjImg) return; const nextNode = pjImg.nextSibling; if (!nextNode || !nextNode.nodeValue) return; const commentNum = parseInt(nextNode.nodeValue.trim(), 10); if (isNaN(commentNum) || commentNum < 20) { box.style.display = 'none'; } } // 批量过滤 function filterAll(root = document) { root.querySelectorAll('.news_list').forEach(filterSingle); } // 先处理当前已有 filterAll(); // 监听后续新增 const observer = new MutationObserver(mutations => { mutations.forEach(m => { m.addedNodes.forEach(node => { if (node.nodeType !== 1) return; // 只处理元素节点 if (node.classList && node.classList.contains('news_list')) { filterSingle(node); // 直接就是一条 } else { filterAll(node); // 可能是容器,递归过滤 } }); }); }); // 监听整个 body 的子孙节点 observer.observe(document.body, { childList: true, subtree: true }); })();