- // ==UserScript==
- // @name Pixiv AdBlock
- // @name:en Pixiv AdBlock
- // @name:vi Pixiv Chặn Quảng Cáo
- // @name:zh-CN Pixiv 广告屏蔽
- // @name:zh-TW Pixiv 廣告封鎖
- // @name:ja Pixiv 広告ブロック
- // @namespace http://tampermonkey.net/
- // @version 0.4
- // @description Block ads on Pixiv
- // @description:en Block ads on Pixiv
- // @description:vi Chặn quảng cáo trên Pixiv
- // @description:zh-CN 屏蔽 Pixiv 上的广告
- // @description:zh-TW 封鎖 Pixiv 上的廣告
- // @description:ja Pixivの広告をブロックします
- // @match https://www.pixiv.net/*
- // @icon https://www.google.com/s2/favicons?sz=64&domain=pixiv.net
- // @license GPL-3.0-only
- // @author RenjiYuusei
- // @grant none
- // @require https://cdn.jsdelivr.net/npm/jquery@3.7.1/dist/jquery.min.js
- // ==/UserScript==
- ! function(t) {
- const o = [".ads", ".ad-container", ".billboard", ".ads-top-info", '[class*="ad-"]', '[class*="ads-"]', '[id*="ad-"]', '[id*="ads-"]', ".premium-lead-t", ".premium-lead-new-t", ".promotional-popup", ".ad-footer", ".ad-header", ".ad-sidebar", ".billboard-ad", ".js-premium-lead-header", ".js-premium-lead-footer", ".spotlight-ads", ".ad-interstitial", 'iframe[src*="ads"]', "div[data-ad-slot]", ".adsbygoogle", "#footer-ads", "#headerAd", ".ads-article-bottom", ".ads-article-top", ".ads-sidebar", ".advertisement", ".pixiv-ad", ".premium-promotion", "[data-gtm-recommend-ad]", '[data-gtm-value*="ad_"]'];
-
- function e() {
- t(o.join(", ")).remove(), t('img[src*="close_icon"][style*="position: absolute"]').each((function() {
- t(this).closest("div").remove()
- }))
- }! function() {
- const e = t("<style>").text(`\n ${o.join(", ")},\n img[src*="close_icon"][style*="position: absolute"] {\n display: none !important;\n visibility: hidden !important;\n opacity: 0 !important;\n pointer-events: none !important;\n width: 0 !important;\n height: 0 !important;\n position: absolute !important;\n top: -9999px !important;\n left: -9999px !important;\n }\n `);
- t("head").append(e)
- }(), e();
- new MutationObserver((function(t) {
- let o = !1;
- t.forEach((function(t) {
- if (t.addedNodes.length) return o = !0, !1
- })), o && e()
- })).observe(document.body, {
- childList: !0,
- subtree: !0
- }), setInterval(e, 1e3), t(window).on("load", e), t(document).on("DOMContentLoaded", e), t(window).on("scroll", e)
- }(jQuery);