|
|
动机
新年新气象,和谐区帖子预览功能上线,目前正在试运行。改变是好事,但也未必能满足每一个人的特定需求。比如,我能想到的原因至少有两条:一是看惯曾经的页面布局,觉得现在一个帖子在画幅中占太宽了,看不习惯;二是因为图片加载开销大,导致翻页太快时容易502。
总之还是把这篇帖子写出来了,希望能帮到这部分坛U。
方法一:使用广告屏蔽插件(推荐)
只需要在“设置 - 用户过滤器”添加如下两条自定义规则即可:
gamemale.com##.wmsj_listoimg(屏蔽预览图)
gamemale.com##.wmsj_sums(屏蔽帖文摘要)
之所以更推荐这种方法,是因为它比油猴脚本运行的能耗低且速度更快。
方法二:油猴脚本
@Name @Match @Icon
- // ==UserScript==
- // @name 屏蔽GM动漫区预览
- // @namespace http://tampermonkey.net/
- // @version 1.0
- // @description 屏蔽gamemale.com动漫区的预览图和帖文摘要
- // @author YourName
- // @match https://www.gamemale.com/*
- // @match http://www.gamemale.com/*
- // @match https://gamemale.com/*
- // @match http://gamemale.com/*
- // [url=home.php?mod=space&uid=682785]@icon[/url] https://www.google.com/s2/favicons?domain=gamemale.com
- // @grant none
- // @run-at document-start
- // ==/UserScript==
- (function() {
- 'use strict';
- // 创建CSS样式规则
- const style = document.createElement('style');
- style.textContent = `
- /* 屏蔽预览图 */
- .wmsj_listoimg {
- display: none !important;
- }
- /* 屏蔽帖文摘要 */
- .wmsj_sums {
- display: none !important;
- }
- `;
- // 将样式添加到页面
- document.head.appendChild(style);
- // 额外处理动态加载的内容(可选)
- const observer = new MutationObserver(function(mutations) {
- mutations.forEach(function(mutation) {
- if (mutation.addedNodes.length) {
- // 不需要额外操作,因为CSS已经全局生效
- }
- });
- });
- // 等待DOM加载完成后开始观察
- if (document.body) {
- observer.observe(document.body, {
- childList: true,
- subtree: true
- });
- } else {
- window.addEventListener('DOMContentLoaded', function() {
- observer.observe(document.body, {
- childList: true,
- subtree: true
- });
- });
- }
- })();
复制代码
来自群组: 星象占卜 |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?立即注册
x
评分
-
查看全部评分
|