// ==UserScript==
// @name 搜书小组(404吧)-刘备小说版块 帖子过滤器
// @namespace https://greasyfork.org/zh-CN/users/1441970-%E5%8D%97%E7%AB%B9
// @version 1.1
// @description 通过编辑脚本代码管理黑/白名单
// @author 南竹
// @match https://404ku.com/forum-*-*
// @match https://404ku.com/forum-*-*.html
// @match https://404ku.com/forum.php?mod=forumdisplay&fid=*
// @match https://404zu.org/forum-*-*
// @match https://404zu.org/forum-*-*.html
// @match https://404zu.org/forum.php?mod=forumdisplay&fid=*
// @match https://404zu.net/forum-*-*
// @match https://404zu.net/forum-*-*.html
// @match https://404zu.net/forum.php?mod=forumdisplay&fid=*
// @license MIT
// @grant none
// ==/UserScript==
(function() {
'use strict';
// ======================
// 用户配置区(直接修改以下数组)
// ======================
// 黑名单:包含这些词的帖子将被隐藏
const BLACKLIST = [
'NTR', '绿文', '绿帽', '加绿',
'改绿', '绿改', '纯绿', '深绿','玩我妻女', '绿改', '纯绿', '深绿',
'绿母', '绿妈', '绿黑', '媚黑', '扶她', '扶他','公用','绿奴',
'黑人', '黑鬼', '倪哥', '绿爱之高贵美艳', '为了指挥官夺冠,成为其他对手', '逆子难防', '母一去兮不复还', '母蚀:我无能为力', '议员长妈妈被',
'美人篇', '浴房篇', '轮奸', '间谍过家家:处女','救母?弑母', '我的武林大侠母亲和冷艳篇', '洋人小鬼', '肥猪', '夜色皇后'
];
// 白名单:包含这些词的帖子即使命中黑名单也不会被隐藏
const WHITELIST = [
'无绿', '非绿文',
];
// ======================
// 核心过滤逻辑(无需修改)
// ======================
function shouldRemove(title) {
const lowerTitle = title.toLowerCase();
const hasBlack = BLACKLIST.some(kw => lowerTitle.includes(kw.toLowerCase()));
const hasWhite = WHITELIST.some(kw => lowerTitle.includes(kw.toLowerCase()));
return hasBlack && !hasWhite;
}
function filterTopics(selector) {
document.querySelectorAll(selector).forEach(a => {
const title = a.getAttribute('tip') || a.innerText;
if(shouldRemove(title)) {
a.parentElement.parentElement.remove();
}
});
}
// ======================
// 原有执行逻辑(无需修改)
// ======================
const SELECTORS = [
'a[href^="thread-"]',
'a[href^="forum.php?mod=redirect&tid="]',
'a[href^="forum.php?mod=viewthread&tid="]',
'a.s.xst'
];
// 初始执行
SELECTORS.forEach(selector => filterTopics(selector));
// 动态加载监听
new MutationObserver(() => SELECTORS.forEach(selector => filterTopics(selector)))
.observe(document.body, { childList: true, subtree: true });
})();