// ==UserScript== // @name 百度去广告+页面美化【屏蔽百度搜索结果中的广告等】 // @namespace http://tampermonkey.net/ // @version 2.1 // @icon https://www.baidu.com/favicon.ico // @description 百度去广告+页面美化+屏蔽百度搜索结果中的广告等 // @author wushx // @match *://*.baidu.com/* // @grant none // @require https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.min.js // @license MIT // @downloadURL none // ==/UserScript== let dom = {}; dom.query = jQuery.noConflict(true); dom.query(document).ready(function ($) { const cycletime = 400; if (location.href.indexOf('www.baidu.com') > 0) { // 右侧栏全部关闭(大部分是广告) $("#content_right").remove(); // top-ad也关闭 $("#top-ad").remove(); $(".ec-pl-container").remove(); $("#content_left > div").each(function () { if ($(this).attr('id') === undefined && $('> style', this).attr('id') !== undefined) { $(this).remove(); } }) //直达逛B站 var goBHtml='逛B站去' $('#u').append(goBHtml); setInterval(function () { // 右侧栏全部关闭(大部分是广告) $("#content_right").remove(); // 搜索结果中有的条目广告 $("#content_left > div").each(function () { if ($(this).attr('id') === undefined && $('> div', this).attr('data-placeid') !== undefined) { $(this).remove(); } }) // 有延时跳出的广告 $("a").each(function () { if ($(this)[0].innerHTML === '广告') {$(this).parents(".result").remove(); } }) $(".san-card").each(function () { if ($(this).attr("tpl") === 'feed-ad') { $(this).remove() } }) $('.ec_ad_results').hide(); //搜索内容居中 $("#s_tab").css("padding-left","276px"); $("#container").css("margin-left","276px"); $('.toindex').remove();//首页去除 $('.pf').remove();//设置去除 $('.help').remove();//帮助去除 }, cycletime); } });