|
应群友的要求,新增了屏蔽:评分,收藏等内容,

- // ==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[style*="width:90%; margin:0 auto;"],
- li.pm2,
- li.pm2 a.xi2[onclick*="showWindow('sendpm', this.href);"],
- ul[id^="nimba_sidebottom_"],
- div.focus#sitefocus,
- div.focus#focus,
- div.bm.h.cl[onclick*="setcookie('nofocus_forum'"],
- div.bm.h.cl[onclick*="setcookie('nofocus_6'"],
- div#focus_con,
- div.focus#ip_notice,
- div#ip_notice,
- /* 赞助模块 */
- div.bd-dialog,
- div#tr1,
- div.bd-reward-stl,
- button#bdRewardBtn,
- /* 评分模块 */
- h3.psth[class*="xs1"]: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, [id*="notice"], [class*="notice"]') || securityNotice.parentElement;
- if (container) {
- const closeButton = container.querySelector('a[onclick*="setcookie"], a[href*="javascript:;"]');
- 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[onclick*="setcookie"][onclick*="nofocus"]');
- 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[src*="${url}"], script[src*="${url}"]`).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);
- })();
复制代码
|