Greasy Fork

Greasy Fork is available in English.

综合去除或隐藏网页元素

去除网页元素

当前为 2024-06-20 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         综合去除或隐藏网页元素
// @version      1.2
// @description  去除网页元素
// @author       Geek
// @match        https://*.ghxi.com/*
// @match        https://*.bilibili.com/*
// @match        https://*.123pan.com/*
// @match        https://*.bing.com/*
// @match        https://yiyan.baidu.com/
// @run-at       docunment-start
// @namespace http://greasyfork.icu/users/1318945
// ==/UserScript==

(function () {

    // 只需要在此处定义需要隐藏元素
    var clearElementArr = [
        {"ghxi.com":[".item-sticky",".wwads-cn",".wwads-vertical",".wpcom_ad_wrap","."]},
        {"bilibili.com":
        [".loc-entry",".left-loc-entry","跨年晚会",
         ".download-entry",".download-client-trigger",".desktop-download-tip","客户端下载",
         ".bili-dyn-version-control",
         ".adblock-tips",
         ".vip-wrap",
         ".slide-ad-exp",
         ".vip-entry-containter",
        ".inside-wrp",]},
        {"123pan.com":
        [".VipBanner",
         ".mfy-main-layout__head",
         ".activity-box",
         ".uppy-Dashboard-slowSpeed-banner",
         ".sider-member-btn",
        ".new-menu-item-image",".special-menu-item-container-migration--label",".notice-box"]},
        {"https://yiyan.baidu.com":
        [".CWqnDmBt",".B1u21v2t",".Pek2kYSK",".PB57KCF0",".NQlBLxO4",".gLMZvZ80",".RxwtDmpH",

        ]}

        ]

 // 这是架子代码,不用改动
    console.log("准备隐藏以下元素 >>> " + clearElementArr);
    let style = document.createElement("style");
    window.location.href.includes("zhihu.com/question/") ? style.innerText += `html {overflow: auto}` : '';
    window.pageC = function (clearElements) {
        if (typeof (clearElements) === "object") {
            clearElementArr.forEach(o => {
                let key = Object.keys(o);
                if (window.location.href.includes(key)) {
                    o[key].forEach(el => {
                        style.innerText += `${el} {display: none !important;} `;
                    })
                }
            })
        } else {
            console.error("param error,require array!");
        }
        style.innerText != '' ? document.head.appendChild(style) : '';
    };
    pageC(clearElementArr);
   // console.log("清理完成!");
})();