【去广告 屏蔽广告 广告拦截 百度广告 百度联盟广告 谷歌广告】@LYS-广告拜拜助手(适配手机)

1、净化百度搜索结果中推广广告;2、净化百度联盟推广广告;3、净化不知名的谷歌广告;……

当前为 2022-04-30 提交的版本,查看 最新版本

// ==UserScript==
// @name         【去广告 屏蔽广告 广告拦截 百度广告 百度联盟广告 谷歌广告】@LYS-广告拜拜助手(适配手机)
// @namespace    http://tampermonkey.net/
// @version      1.4
// @description  1、净化百度搜索结果中推广广告;2、净化百度联盟推广广告;3、净化不知名的谷歌广告;……
// @author       LYS
// @match        */*
// @icon         none
// @grant        none
// @license      MIT
// ==/UserScript==
(function () {
    'use strict';

    if (window.location.href.includes("pos.baidu.com/") || window.location.href.includes("googleads.g.doubleclick.net") || window.location.href.includes("pagead2.googlesyndication.com") || window.location.href.includes("tpc.googlesyndication.com")) {
        document.getElementsByTagName('head').innerHTML = "";
        document.getElementsByTagName('title').innerHTML = "";
        document.getElementsByTagName('body')[0].innerHTML = "";
    }

    if (window.location.href.includes("www.baidu.com/")) {
        setInterval(function () {
            $('#content_left div:contains("广告")').slideUp()
        }, 500)
    }

    if (window.location.href.includes("m.baidu.com/")) {
        setInterval(function () {
            $('.ec_ad_results').hide()
        }, 500)
    }

    if (typeof jQuery != "undefined") {
        console.log("ok")
    } else {
        var script = document.createElement("script");
        script.type = "text/javascript";
        script.src = "https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js";
        document.getElementsByTagName('head')[0].appendChild(script);
    }


    var killads = function () {
        $('*').each(function (index, DOMe) {
            var src = $(DOMe).attr("src")
            if (typeof src != "undefined") {
                if (src.includes("pos.baidu.com/") || src.includes("googleads.g.doubleclick.net") || src.includes("pagead2.googlesyndication.com") || src.includes("tpc.googlesyndication.com")) {
                    $(DOMe).hide()
                }
            }
        })
    }

    window.lys = setInterval(function () {
        if (typeof jQuery != "undefined") {
            killads();
            clearInterval(lys)
            return
        }
    }, 500)

})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址