// ==UserScript==
// @name 百度去广告+页面壁纸+美化【屏蔽百度搜索结果中的广告等】
// @namespace http://tampermonkey.net/
// @version 3.0
// @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 = {};
let i=0;
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站去'
var nolyWatchBKHtml='只看博客'
var beautifulHtml='关闭美化'
$('#u').append(goBHtml);
$('#u').append(beautifulHtml);
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();//帮助去除
if(i==0){
$body.css("background-image","url('https://sukiui.com/i/2022/09/18/ftuox7.png')");
$body.css("background-size","cover");
$body.css("background-attachment","fixed");
$('.result').css("background","rgb(130 255 98 / 65%)");
$('.result-op').css("background","rgb(130 255 98 / 65%)");
i++;
}
$('#nolyWatchBK').click(function(){
// alert($(".result").children("div").children("div").children("h3").children("a").html());
// if($(".result").children("div").children("div").children("h3").children("a").html().indexOf("博客") < 0) {
// alert($(".result").children("div").children("div").children("h3").children("a").html())
// $(".result").remove();
// }
$(".result").each(function(ii,vv){
//ii 指第几个元素的序列号。
//vv 指遍历得到的元素。
console.log(vv)
});
});
$('#beautiful').click(function(){
$body.css("background-image","url('')");
$body.css("background-size","");
$body.css("background-attachment","");
$('.result').css("background","");
$('.result-op').css("background","");
});
}, cycletime);
}
function dd(){
alert("ss")
if($(".result").children("div").children("div").children("h3").children("a").html().indexOf("博客") < 0) {
alert("ss")
}
}
});