如何在chiphell屏蔽特定用户的发帖

CousinVinny-avatar

CousinVinny

2025-07-13T10:15:38+00:00

隔壁没有好用的屏蔽脚本,刷论坛时经常被一些神人污染眼睛,所以做了些研究。

需要注意:

1. 需要先安装ublock origin去广告插件
2. 只实现了屏蔽特定用户帖子的功能

下面是手把手的操作步骤

第一步,找到需要屏蔽的用户
[img]https://img.nga.178.com/attachments/mon_202507/14/9aQkms-hrpjKpT3cSxy-6q.webp[/img]

第二步,进入账号主页,找到uid
[img]https://img.nga.178.com/attachments/mon_202507/14/9aQkms-d2wsKhT3cSnw-dv.webp[/img]

这里uid就是2,或者直接复制
space-uid-2.html

第三步,编写屏蔽规则
下面这一串就是屏蔽刚才那位uid 2的用户的规则
www.chiphell.com##tbody[id^="normalthread_"]:has(td.by cite > a[href="space-uid-2.html"])
如果需要屏蔽其他用户,修改最后面的uid

第四步,打开ublock origin的控制面板
[img]https://img.nga.178.com/attachments/mon_202507/14/9aQkms-kulmKhT3cSj0-fk.webp[/img]

第五步,找到“静态规则”这一栏,把上面的规则贴到下面的输入框,然后点击“应用更改”按钮

[img]https://img.nga.178.com/attachments/mon_202507/14/9aQkms-jkmtKwT3cSnu-fs.webp[/img]

做完之后刷新一下网页,帖子就彻底看不到了。

最后,adblock或者其他去广告插件应该也能用上面的规则,但是需要你自行测试。
屏蔽发帖对我来说已经足够了,所以偷懒没写屏蔽回帖、关键字屏蔽之类的规则,如果其他坛友写好了,欢迎在下面分享。
Rubby-avatar

Rubby

建议直接屏蔽chiphell。
axll-avatar

axll

搞个神人大盘点吧
Majik-avatar

Majik

问题来了 把中专轮屏蔽了我上chh看谁去[s:ac:哭笑]不就是上去看他笑话的吗
Zulhu-avatar

Zulhu

牛逼,支持技术贴
SalasaR-avatar

SalasaR

有些屏蔽的人帖子里回复会显示 “还有一些帖子被系统自动隐藏,点此展开” 这个也能屏蔽吗
Meow =W=-avatar

Meow =W=

不注册不登录不收藏不就行了?
比如我这收藏夹里就没那论坛。
再干脆点,物理隔断拔掉网线。
写啥程序嘛......
眼不见心不烦。[s:a2:偷吃]
Girlboss-avatar

Girlboss

[s:ac:哭笑] 开放注册过一段时间, 瞄了一眼, 好家伙全是假惺惺的开箱广告贴, 然后一群舔臭脚的, 5分钟就溜了
Daddy'Os-avatar

Daddy'Os

自从我chh号若干年前不知道为啥被ban了后
我就只能阿q一点的把chh ban了
[s:ac:哭笑]
假的
偶尔去看看富哥还是很不错的
CousinVinny-avatar

CousinVinny

Reply to [pid=831857145,44606577,1]Reply[/pid] Post by [uid=592549]zhanqi9999[/uid] (2025-07-14 18:53)

我只写了一条规则,它的的作用是从帖子列表屏蔽帖子。

你要做的也能实现,但是得继续写规则
CousinVinny-avatar

CousinVinny

Reply to [pid=831856002,44606577,1]Reply[/pid] Post by [uid=63759054]设计师莉莉贝[/uid] (2025-07-14 18:42)

你的口味也太怪了[s:ac:哭笑]
TheFiredUpSloth-avatar

TheFiredUpSloth

论坛助手可以直接拉黑
ㄍㄋㄋㄐㄅ-avatar

ㄍㄋㄋㄐㄅ

怎么啦,你不喜欢中专轮吗
CousinVinny-avatar

CousinVinny

[quote][pid=831867043,44606577,1]Reply[/pid] Post by [uid=15625823]w8avcd[/uid] (2025-07-14 20:19):

怎么啦,你不喜欢中专轮吗[/quote]nApoleon 这个账户红红的,方便测试屏蔽效果,无任何不良引导[s:a2:诶嘿]
CousinVinny-avatar

CousinVinny

[quote][pid=831866233,44606577,1]Reply[/pid] Post by [uid=65694910]Aoix[/uid] (2025-07-14 20:11):

论坛助手可以直接拉黑[/quote]苹果用户可以用这第三方客户端
Classy-avatar

Classy

顺便把nga那几个伪人也屏蔽了
fueq-avatar

fueq

确实中专轮带货没下限,什么话都敢说
! Jumbo the Shaman !-avatar

! Jumbo the Shaman !

// ==UserScript==
// @name 屏蔽傻逼
// @namespace [url]http://tampermonkey.net/[/url]
// @version 0.5
// @description 屏蔽C站和NGA论坛中的傻逼
// @author for404
// @match *://*.chiphell.com/*
// @match *://chiphell.com/*
// @match *://*.nga.cn/*
// @grant none
// ==/UserScript==

(function() {
'use strict';

// 目标用户列表(格式:["chiphell:用户名", "nga:uid:123456", "nga:username:张三"])
const targetUsers = [

//NGA建议使用uid的方式,避免改名后放出来。


"chiphell:destroypeter", // Chiphell用户
"chiphell:normanlu",
"nga:username:123456", // NGA用户(按用户名)
"nga:uid:12759809" // NGA按uid




// 按照以上格式往下排列新增需要屏蔽的用户
];

// 从URL中提取UID的辅助函数(兼容各种参数位置)
function getUidFromUrl(url) {
try {
// 处理相对路径(如nuke.php?func=ucp&uid=111187)
const fullUrl = new URL(url, window.location.origin);
return fullUrl.searchParams.get('uid');
} catch (e) {
console.error(`解析UID失败: ${url}`, e);
return null;
}
}

// 检查用户是否在屏蔽列表中
function shouldHideUser(site, username, uid) {
if (site === 'chiphell') {
return targetUsers.includes(`chiphell:${username}`);
} else if (site === 'nga') {
const uidMatch = targetUsers.includes(`nga:uid:${uid}`);
const nameMatch = targetUsers.includes(`nga:username:${username}`);
console.log(`[NGA] 检查用户: ${username} (UID: ${uid}) → UID匹配: ${uidMatch}, 用户名匹配: ${nameMatch}`);
return uidMatch || nameMatch;
}
return false;
}

// 屏蔽指定用户的发言
function hideTargetPosts() {
const currentHost = window.location.hostname;

if (currentHost.includes('chiphell.com')) {
// Chiphell逻辑保持不变
const userLinks = document.querySelectorAll(`a.xw1[href^="space-uid-"][target="_blank"]`);

userLinks.forEach(link => {
const username = link.textContent.trim();
if (shouldHideUser('chiphell', username)) {
let postContainer = link.closest('div[id^="post_"]');
if (!postContainer) {
postContainer = link.closest('table.plhin').closest('div[id^="post_"]');
}

if (postContainer) {
postContainer.style.display = 'none';
console.log(`[Chiphell] 已屏蔽 ${username} 的发言: ${postContainer.id}`);
}
}
});
} else if (currentHost.includes('nga.cn')) {
// 匹配所有用户链接(class为author,href包含uid参数)
const userLinks = document.querySelectorAll('a.author[href*="uid="]');
console.log(`[NGA] 找到 ${userLinks.length} 个用户链接`);

userLinks.forEach(link => {
const href = link.getAttribute('href');
const uid = getUidFromUrl(href);
if (!uid) return;

const username = link.textContent.trim();
if (shouldHideUser('nga', username, uid)) {
// 根据源码定位帖子容器(tr.postrow或包含postcontent的父容器)
let postContainer = link.closest('tr.postrow');
// 兼容其他可能的容器结构
if (!postContainer) {
postContainer = link.closest('div[class*="postcontent"]').closest('tr');
}

if (postContainer) {
postContainer.style.display = 'none';
console.log(`[NGA] 已屏蔽 ${username} (UID: ${uid}) 的发言`);
} else {
console.warn(`[NGA] 未找到 ${username} (UID: ${uid}) 的帖子容器`);
}
}
});
}
}

// 初始加载时执行
hideTargetPosts();

// 监听页面动态变化(如滚动加载新内容)
const observer = new MutationObserver((mutations) => {
mutations.forEach(mutation => {
if (mutation.addedNodes.length) {
hideTargetPosts();
}
});
});

observer.observe(document.body, {
childList: true,
subtree: true
});
})();


前天受不了自己写的代码,物理屏蔽,直接进来这个人任何信息你都不会看见。