Greasy Fork is available in English.
去除网页元素
当前为
// ==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("清理完成!");
})();