NodeLoc++

移除 NodeLoc 社区页面中的广告元素

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

You will need to install an extension such as Tampermonkey to install this script.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

Advertisement:

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

Advertisement:

// ==UserScript==
// @name         NodeLoc++
// @namespace    http://tampermonkey.net/
// @version      1.3
// @author       红色塑料袋
// @description  移除 NodeLoc 社区页面中的广告元素
// @match        *://www.nodeloc.com/*
// @match        *://www.nodeloc.cc/*
// @grant        GM_addStyle
// @run-at       document-idle
// @license      MIT
// ==/UserScript==

(function () {
    'use strict';

    // 隐藏侧边栏广告
    GM_addStyle(`
        .sidebar-ads-wrapper,
        .sidebar-ads-container,
        .sidebar-ad-item,
        .sidebar-ad-link,
        .sidebar-ad-image,
        .small-ads-section,
        .small-ads-grid,
        .medium-ads-section,
        .large-ads-section,
        iframe[src*="ad"] {
            display: none !important;
        }
    `);

    // 动态移除后续加载的广告元素
    const observer = new MutationObserver((mutations) => {
        document.querySelectorAll('.sidebar-ads-wrapper').forEach(el => el.remove());
        document.querySelectorAll('iframe[src*="ad"]').forEach(el => el.remove());
    });

    observer.observe(document.body, { childList: true, subtree: true });
})();