这段时间加密货币在 v 站可真是有够烦人的,我就是来划水的,受不了了,干翻算了,vibe code 了一段 tampermonkey script ,宁愿误伤 1000 也要干爆敌军 100 ,各位随便用
// ==UserScript==// @name V2EX 关键词屏蔽(强制隐藏或移除)// @namespace http://tampermonkey.net/// @version 0.4// @description 强制屏蔽标题中包含 “币”、或 “sol” 的帖子 —— 可选移除或 !important 隐藏。带日志辅助调试。忽略大小写。 。// @author YourName// @match https://www.v2ex.com/*// @grant none// ==/UserScript==(function() { 'use strict'; const keywords = ['币', 'sol']; const re = new RegExp(keywords.map(k => k.replace(/[-\/\\^$*+?.()|[\]{}]/g,'\\$&')).join('|'), 'i'); function filterPosts() { document.querySelectorAll('div').forEach((tr, idx) => { const link = tr.querySelector('.item_title a.topic-link'); if (!link) { console.log(`[过滤][${idx}] 无标题链接`); return; } const text = link.textContent.trim(); const matched = re.test(text); console.log(`[过滤][${idx}] "${text}" => 匹配: ${matched}`); if (matched) { // —— 方案 A: 直接从 DOM 中移除 ——// tr.remove();// console.log(`[过滤][${idx}] 已移除`); // —— 方案 B: 强制添加 !important 隐藏 —— tr.style.setProperty('display', 'none', 'important'); console.log(`[过滤][${idx}] 已隐藏(!important )`); } }); } // 首次过滤 filterPosts(); // 监听异步加载 new MutationObserver(muts => { muts.forEach(m => { if (m.addedNodes.length) { filterPosts(); } }); }).observe(document.body, { childList: true, subtree: true });})();