Greasy Fork

Greasy Fork is available in English.

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

让你好好去学习

当前为 2021-07-27 提交的版本,查看 最新版本

// ==UserScript==
// @name         百度搜索广告屏蔽,屏蔽百度热搜
// @namespace    http://tampermonkey.net/
// @require      http://libs.baidu.com/jquery/2.0.0/jquery.min.js
// @version      0.2.1
// @description  让你好好去学习
// @author       Yirs
// @match        *://*.baidu.com/*
// @run-at       document-start
// @copyright    借鉴部分作者代码 Tsing@greasyfork
// ==/UserScript==

var zkdurldomain =location.href;

(function() {
    'use strict';
    if(zkdurldomain.indexOf("www.baidu.com") > 0 ) {
        document.addEventListener ("DOMContentLoaded", frame);
         function frame() {
             unsafeWindow.$(document).ajaxSuccess(function(e, request, section) {
           //右边栏广告
            $("#content_right").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($("[data-placeid]").length>=1){
               $("[data-placeid]").each(function(){
               $(this).remove();

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



})();