// ==UserScript== // @name 妖火:我不屑与你这样的妖油为伍 // @namespace http://tampermonkey.net/ // @version 2.0 // @description 屏蔽妖火网特定用户的帖子和回复 // @author yaohuogg // @match *://yaohuo.me/bbs* // @match *://www.yaohuo.me/bbs* // @grant none // @license MIT // @downloadURL https://update.greasyfork.icu/scripts/506420/%E5%A6%96%E7%81%AB%EF%BC%9A%E6%88%91%E4%B8%8D%E5%B1%91%E4%B8%8E%E4%BD%A0%E8%BF%99%E6%A0%B7%E7%9A%84%E5%A6%96%E6%B2%B9%E4%B8%BA%E4%BC%8D.user.js // @updateURL https://update.greasyfork.icu/scripts/506420/%E5%A6%96%E7%81%AB%EF%BC%9A%E6%88%91%E4%B8%8D%E5%B1%91%E4%B8%8E%E4%BD%A0%E8%BF%99%E6%A0%B7%E7%9A%84%E5%A6%96%E6%B2%B9%E4%B8%BA%E4%BC%8D.meta.js // ==/UserScript== (function() { 'use strict'; // 设置需要屏蔽的用户ID和用户名 const blockedUserIds = ['999', '999']; //纯数字,识别回复靠用户ID更精准,这是唯一值 const blockedUsernames = ['用户名1', '用户名2']; //用户名用来遍历主题,因为主题界面没有用户ID,所有只能这样 function hideReplies() { document.querySelectorAll('.reline.list-reply').forEach(reply => { const userIdElement = reply.querySelector('.renickid'); const usernameElement = reply.querySelector('.renick a'); if (userIdElement && blockedUserIds.includes(userIdElement.textContent.trim())) { reply.style.display = 'none'; return; } if (usernameElement && blockedUsernames.some(name => usernameElement.textContent.trim().includes(name))) { reply.style.display = 'none'; return; } }); } function hideTopics() { document.querySelectorAll('.listdata.line1, .listdata.line2').forEach(topic => { const usernameElement = topic.querySelector('.louzhunicheng'); if (usernameElement && blockedUsernames.some(name => usernameElement.textContent.trim().includes(name))) { topic.style.display = 'none'; } }); } hideReplies(); hideTopics(); const observer = new MutationObserver(() => { hideReplies(); hideTopics(); }); observer.observe(document.body, { childList: true, subtree: true }); })();