【脚本】GM简化(特别版)
应群友的要求,新增了屏蔽:评分,收藏等内容,即主楼内容之后就直接二楼
不想这样也可以用GM简化1.3
https://img.gamemale.com/forum/202412/24/170302ig4zy4ew94cll4we.jpg
@Name @Match
// ==UserScript==
// @name GM简化
// @version 1.4?
// @authoe MKM
// @match https://www.gamemale.com/*
// @exclude https://www.gamemale.com/space*
// @grant GM_addStyle
// ==/UserScript==
(function() {
'use strict';
GM_addStyle(`
#hd .wp .comiis_nav,
.md_ctrl,
p.xg1,
nav.toc,
.scbar_hot_td,
.pls .avatar_p .vm,
fieldset,
.hm-t-container,
.hm-t-main,
.hm-t-body,
.dnch_eo_f,
.sign,
.signature,
.bui .m img,
div,
li.pm2,
li.pm2 a.xi2,
ul,
div.focus#sitefocus,
div.focus#focus,
div.bm.h.cl,
div.bm.h.cl,
div#focus_con,
div.focus#ip_notice,
div#ip_notice,
/* 赞助模块 */
div.bd-dialog,
div#tr1,
div.bd-reward-stl,
button#bdRewardBtn,
/* 评分模块 */
h3.psth:has(span.icon_ring),
dl.rate,
table.ratl,
.dxksst_floor,
div.dxksst_floor_main,
#dxksst_floor_5767708,
/* 楼层回复模块 */
#dxksst_reply_module_5767708,
#dxksst_floor_smiley_5767708,
/* 新增:帖子操作按钮行 */
div#p_btn,
div.mtw.mbm.hm.cl,
a#k_favorite,
a#ak_rate,
a#k_collect,
a#recommend_add,
a#recommend_subtract {
display: none !important;
visibility: hidden !important;
height: 0 !important;
width: 0 !important;
margin: 0 !important;
padding: 0 !important;
border: 0 !important;
position: absolute !important;
clip: rect(0,0,0,0) !important;
}
/* 新增:隐藏整个操作按钮容器 */
tr:has(> td.plc.plm > div#p_btn),
td.plc.plm:has(> div#p_btn) {
display: none !important;
}
#postlist .plhin {
background: none !important;
}
.pls .avatar img,
#fastpostform .pls .avatar img,
.personinformaion .person-imgs img,
#main .t.t2 table .tr1 table .tac img,
#um .avt img,
#tath img,
.rate table img,
.rate dd li img,
.cm .vm img,
.card_mn .avt img {
border-radius: 50% !important;
background-size: cover !important;
background-position: center !important;
background-repeat: no-repeat !important;
}
.pls .avatar img {
width: 80px !important;
height: 80px !important;
border: none !important;
padding: 0 !important;
margin: 0 !important;
}
.pls .avatar {
margin: 10px auto !important;
width: 80px !important;
height: 80px !important;
border-radius: 50% !important;
border: 2px solid white !important;
overflow: hidden !important;
position: relative !important;
}
.pls .avatar:before {
content: "" !important;
display: block !important;
padding-top: 100% !important;
}
.pls .avatar img {
position: absolute !important;
top: 0 !important;
left: 0 !important;
right: 0 !important;
bottom: 0 !important;
}
body {
background: none !important;
}
`);
const blockedUrls = [
'unwanted-ad.js',
'banner.jpg',
'tracking.gif'
];
const handleSecurityNotice = (node) => {
const securityNotice = node.querySelector ?
node.querySelector('h2:contains("安全提醒"), *:has(> h2:contains("安全提醒"))') :
null;
if (securityNotice && securityNotice.closest) {
const container = securityNotice.closest('.focus, .plugin, , ') || securityNotice.parentElement;
if (container) {
const closeButton = container.querySelector('a, a');
if (closeButton) {
closeButton.click();
} else {
container.style.display = 'none';
}
try {
document.cookie = 'lip=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/';
} catch (e) {}
}
}
};
const handleSponsorModule = (node) => {
const sponsorSelectors = [
'div.bd-reward-stl',
'button#bdRewardBtn',
'div.bd-dialog',
'div#tr1'
];
sponsorSelectors.forEach(selector => {
const elements = node.querySelectorAll ? node.querySelectorAll(selector) : [];
elements.forEach(el => {
el.style.display = 'none';
el.style.visibility = 'hidden';
});
});
if (node.id && (node.id === 'bdRewardBtn' || node.id === 'tr1' ||
node.classList.contains('bd-dialog') || node.classList.contains('bd-reward-stl'))) {
node.style.display = 'none';
}
};
const handleRatingModule = (node) => {
const ratingSelectors = [
'h3.psth:has(span.icon_ring)',
'dl.rate',
'table.ratl',
'.dxksst_floor',
'div.dxksst_floor_main'
];
ratingSelectors.forEach(selector => {
const elements = node.querySelectorAll ? node.querySelectorAll(selector) : [];
elements.forEach(el => {
const text = el.textContent || '';
if (text.includes('评分') || el.classList.contains('rate') ||
el.classList.contains('dxksst_floor')) {
el.style.display = 'none';
}
});
});
const ratingText = node.textContent || '';
if ((node.nodeName === 'H3' && ratingText.includes('评分')) ||
node.classList.contains('rate') ||
node.classList.contains('ratl') ||
node.classList.contains('dxksst_floor')) {
node.style.display = 'none';
}
};
const handlePostButtons = (node) => {
const postButtonSelectors = [
'div#p_btn',
'div.mtw.mbm.hm.cl',
'a#k_favorite',
'a#ak_rate',
'a#k_collect',
'a#recommend_add',
'a#recommend_subtract'
];
postButtonSelectors.forEach(selector => {
const elements = node.querySelectorAll ? node.querySelectorAll(selector) : [];
elements.forEach(el => {
el.style.display = 'none';
el.style.visibility = 'hidden';
});
});
if (node.id === 'p_btn' ||
(node.classList &&
(node.classList.contains('mtw') &&
node.classList.contains('mbm') &&
node.classList.contains('hm') &&
node.classList.contains('cl'))) ||
['k_favorite', 'ak_rate', 'k_collect', 'recommend_add', 'recommend_subtract'].includes(node.id)) {
node.style.display = 'none';
}
const text = node.textContent || '';
if (text.includes('收藏') || text.includes('评分') ||
text.includes('淘帖') || text.includes('顶') || text.includes('踩')) {
node.style.display = 'none';
}
};
const handleNode = (node) => {
if (node.tagName === 'IMG' || node.tagName === 'SCRIPT') {
blockedUrls.forEach(url => {
if (node.src.includes(url)) {
if (node.tagName === 'IMG') node.src = '';
node.remove();
}
});
}
autoCloseAnnouncement(node);
handleSecurityNotice(node);
handleSponsorModule(node);
handleRatingModule(node);
handlePostButtons(node);
};
const autoCloseAnnouncement = (node) => {
const focusSelectors = [
'div.focus#sitefocus',
'div.focus#focus'
];
let focusElement = null;
focusSelectors.forEach(selector => {
if (!focusElement && node.querySelector) {
focusElement = node.querySelector(selector);
}
});
if (!focusElement && node.nodeType === 1 && node.classList.contains('focus') &&
(node.id === 'sitefocus' || node.id === 'focus')) {
focusElement = node;
}
if (focusElement) {
const closeButton = focusElement.querySelector('a');
if (closeButton) {
setTimeout(() => {
closeButton.click();
}, 100);
} else {
focusElement.style.display = 'none';
}
}
};
const observer = new MutationObserver(mutations => {
mutations.forEach(mutation => {
mutation.addedNodes.forEach(node => {
if (node.nodeType === 1) handleNode(node);
});
});
});
observer.observe(document, {
childList: true,
subtree: true
});
const processExistingContent = () => {
blockedUrls.forEach(url => {
document.querySelectorAll(`img, script`).forEach(el => el.remove());
});
autoCloseAnnouncement(document);
handleSecurityNotice(document);
handleSponsorModule(document);
handleRatingModule(document);
handlePostButtons(document);
document.querySelectorAll('.bd-dialog, #tr1, .bd-reward-stl, #bdRewardBtn, dl.rate, table.ratl, .dxksst_floor, #p_btn, .mtw.mbm.hm.cl, #k_favorite, #ak_rate, #k_collect, #recommend_add, #recommend_subtract').forEach(el => {
el.style.display = 'none';
});
document.querySelectorAll('a').forEach(el => {
const text = el.textContent || '';
if (text.includes('收藏') || text.includes('评分') ||
text.includes('淘帖') || text.includes('顶') || text.includes('踩')) {
el.style.display = 'none';
}
});
};
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', processExistingContent);
} else {
processExistingContent();
}
setInterval(() => {
handleSecurityNotice(document);
handleSponsorModule(document);
handleRatingModule(document);
handlePostButtons(document);
}, 2000);
})();
居然有这样的需求,也是每个人的要求不一样了,我倒对这个不在意 这样岂不是点不了追随了?所以永远不点追随了(狗头) 还有这种脚本啊,不过页面确实简约不少 连这个都可以屏蔽也是相当厉害的插件惹;P 虽然个人觉得应该是用不上~还是感谢楼主分享啦{:4_91:} 本帖最后由 Hadley0T 于 2026-1-28 22:57 编辑
是的,一切都是我做的,因为有时候看贴不用那么多有的没的 這個有點極端了哈,我還是用普通的就好。 简约之后挺好的惹,感觉适合我这种老年人用户{:6_169:} 需要瘋狂站街的時候可能很有用啦,
但疲勞度應該是不會減少.XD 感觉很适合手机的访问呢,可以省一些流量 有些小功能用不上了唉,但确实乍一看简约了好多 是很简介,毕竟论坛有些东西确实花
比如大佬的勋章,看的我眼红 简约了一些,挺好的。虽然可能用不到 看起来用了以后更方便站街惹,很快就能翻完主题内容和前排评论 好方便的功能啊,界面简洁很多了呢 确实简约了很多啊,虽然站街站久了用这个能屏蔽一些,但已经习惯了呢,不过还是谢谢楼主的插件了 0-0 大佬真的倾听大家的呼声了 站街专用系列jpg 屏蔽评分功能,很实用脚本,使得看起来更加简洁。 极简版论坛看上去很清爽呢,满足部分人的特殊需求了,三百多行代码看着就是大工程 全部屏蔽真是特别简洁了,可以节省很多精力