logo NodeSeekbeta

【油猴脚本】【Adguard规则】移除NodeSeek推广

不建议移除推广

本帖只是给和我一样看到广告想吐的用户指一条活路
已保留NS自己的推广

方案一:油猴脚本 推荐抄酒神的作业

// ==UserScript==
// @name         RemoveNodeSeekPromotions
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  移除右侧推广
// @author       malibu
// @match        https://www.nodeseek.com/*
// @grant        none
// @run-at       document-start
// ==/UserScript==

(function() {
    'use strict';


    const removePromotionsByLinkPath = () => {
        const selector = '#nsk-right-panel-container a.promotation-item';
        const adLinks = document.querySelectorAll(selector);

        if (adLinks.length === 0) {
            return;
        }

        adLinks.forEach(link => {
            if (link.style.display === 'none') {
                return; 
            }

            const href = link.getAttribute('href');

            if (!href || href.startsWith('javascript:')) {
                return; 
            }

            try {
                const linkUrl = new URL(href, location.origin);

                const linkPart = (linkUrl.origin + linkUrl.pathname).toLowerCase();

                const shouldKeep = linkPart.includes('nodeseek') || linkPart.includes('nodequality');

                if (!shouldKeep) {
                    link.style.setProperty('display', 'none', 'important');
                }
            } catch (e) {
            }
        });
    };

    const observer = new MutationObserver(removePromotionsByLinkPath);

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

})();

方案二:Adguard 推荐抄酒神的作业
在Adguard用户自定义规则中添加以下自定义规则

nodeseek.com###nsk-right-panel-container > div > a.promotation-item:matches-attr("href"=/^(?!^[^?#]*[nN][oO][dD][eE][sS][eE][eE][kK])(?!^[^?#]*[nN][oO][dD][eE][qQ][uU][aA][lL][iI][tT][yY]).*$/)
12
  • 我晕,你这搞得也太复杂了,还用得着上observer.observe这种性能杀器吗

    论坛扩展里面加入下面的代码就行了

    a.promotation-item:not([href*="nodeseek.com"]):not([href*="github.com"]):not([href*="nodequality.com"]) {
        display: none;
    }
    
  • xhj003

  • bd

  • 6 xhj003 xhj003 xhj003

  • 是个狠人

  • bd

  • 绝对不能错过可以给酒神哥上鸡腿的机会 xhj008

  • 可以

  • @酒神 #6 发布于2025/6/8 04:51:34
    我晕,你这搞得也太复杂了,还用得着上observer.observe这种性能杀器吗

    论坛扩展里面加入下面的代码就行了

    a.promotation-item:not([href*="nodeseek.com"]):not([href*="github.com"]):not([href*="nodequality.com"]) {
        display: none;
    }
    

    woc,我离正确答案就差一步之遥

    .promotation-item {
        display: none;
    }
    

    试了这个没效果,以为自定义CSS不会应用于侧边栏,就没细看了 ac01
    感谢酒神指点!鸡腿奉上! xhj028

  • 厉害啊

12

你好啊,陌生人!

我的朋友,看起来你是新来的,如果想参与到讨论中,点击下面的按钮!

📈用户数目📈

目前论坛共有59971位seeker

🎉欢迎新用户🎉