Greasy Fork

Greasy Fork is available in English.

百度搜索广告屏蔽,屏蔽百度热搜

让你好好去学习

当前为 2021-06-25 提交的版本,查看 最新版本

// ==UserScript==
// @name         百度搜索广告屏蔽,屏蔽百度热搜
// @namespace    http://tampermonkey.net/
// @require      http://libs.baidu.com/jquery/2.0.0/jquery.min.js
// @version      0.1
// @description  让你好好去学习
// @author       Yirs
// @match        *://*.baidu.com/*
// @match        http://*.imomoe.la/*
// @match        *://*.ibswtan.com/*
// @grant        GM_addStyle
// @grant        GM_download
// @grant        GM_xmlhttpRequest
// @grant        GM_getResourceText
// @grant             unsafeWindow
// @grant             GM_setClipboard
// @grant             GM_setValue
// @grant             GM_getValue
// @grant             GM_deleteValue
// @grant             GM_openInTab
// @grant             GM_registerMenuCommand
// @grant             GM_unregisterMenuCommand
// @grant             GM.getValue
// @grant             GM.setValue
// @grant             GM_info
// @grant             GM_notification
// @grant             GM_getResourceText
// @grant             GM_openInTab
// @grant             GM_download
// ==/UserScript==

var zkdurldomain =location.href;

(function() {
    'use strict';

    //只能使用定时的方式,因为脚本是加载页面后就调用一次,停掉了就不会再执行了
    if(zkdurldomain.indexOf("www.baidu.com") > 0 ) {
        var id = setInterval(frame, 1000);
        var flgh=0;
        function frame() {
            //删除右边所有的消息
            $("#content_right").remove();
            //存在广告则删除,因为首页广告一般是5个这样
            if ($("[id=3001]").length > 0){
                $("#3001").remove();
                $("#3002").remove();
                $("#3003").remove();
                $("#3004").remove();
                $("#3005").remove();
                $("#3006").remove();
                $("#5001").remove();
                $("#6001").remove();
                $("#7001").remove();
                $("#8001").remove();
                $("#9001").remove();
            }else if($("[id=5001]").length > 0||$("[id=6001]").length > 0||$("[id=7001]").length > 0||$("[id=8001]").length > 0||$("[id=9001]").length > 0){
                $("#5001").remove();
                $("#6001").remove();
                $("#7001").remove();
                $("#8001").remove();
                $("#9001").remove();
            }
           //删除上面的广告之后会出现新的广告
            if ($("[id=1]").length >= 1){
            $("[id=1]").each(function(){
               var ad=$(this).children("div .se_st_footer").children("a").text()
                if(ad.indexOf("广告") >= 0){
                   $(this).remove();
                }

            //  if($(this).$(".se_st_footer a")){
                //$(this).remove();
              // }

                //出现在上方
             // if($(this).attr("srcid")==1599){
              // $(this).remove();
               //}
 
                //出现在下方
             // if(!$("#1").is(".result-op")){
             //   $(this).remove();
             //  }


            });
            }

            //部分品牌广告标识
            if($("[data-placeid]").length>=1){
               $("[data-placeid]").each(function(){
               $(this).remove();

            });
             }

            //删除右边的百度热搜,让你好好查资料
             //$("[tpl='right_toplist1']").remove();





        }
    }


})();