百度去广告+美化

解决百度全家桶的众多广告~

目前為 2021-06-30 提交的版本,檢視 最新版本

// ==UserScript==
// @name         百度去广告+美化
// @namespace    https://www.huankong.top/
// @version      1.35
// @description  解决百度全家桶的众多广告~
// @author       幻空
// @match        https://www.baidu.com/*
// @match        https://fanyi.baidu.com/*
// @icon         https://www.huankong.top/favicon.ico
// @grant        none
// ==/UserScript==

(function() {
    //初始化变量
    let vm = 0;
    //浏览器窗口大小变化时
    window.onresize = function(){
        size();
        fresh();
    };
    function size(){
        vm = $(window).width()/100;
        console.log(vm);
    }
    //监听页面内容是否刷新
    $("#wrapper_wrapper").bind('DOMNodeInserted', function(e) {
        fresh();
    });
    function fresh(){
        //百度搜索
        $("#content_right").remove();
        $(".new_head_nums_cont_outer").remove();
        $("#u").remove();
        $("#u1").remove();
        $("#result_logo").remove();
        if(vm <=10){
            $("#form").css({margin:"15px 0px 15px 3%"});
            $("#s_tab").css({paddingLeft:"4%"});
            $("#content_left").css({marginLeft:"-11%"});
        }else if(vm <= 12.5){
            $("#form").css({margin:"15px 0px 15px 30%"});
            $("#s_tab").css({paddingLeft:"31%"});
            $("#content_left").css({marginLeft:"24%"});
        }else if(vm <= 13){
            $("#form").css({margin:"15px 0px 15px 30%"});
            $("#s_tab").css({paddingLeft:"31%"});
            $("#content_left").css({marginLeft:"24%"});
        }else if(vm <= 14){
            $("#form").css({margin:"15px 0px 15px 30%"});
            $("#s_tab").css({paddingLeft:"31%"});
            $("#content_left").css({marginLeft:"26%"});
        }else if(vm <= 15){
            $("#form").css({margin:"15px 0px 15px 30%"});
            $("#s_tab").css({paddingLeft:"31%"});
            $("#content_left").css({marginLeft:"28%"});
        }else if(vm <= 16){
            $("#form").css({margin:"15px 0px 15px 30%"});
            $("#s_tab").css({paddingLeft:"31%"});
            $("#content_left").css({marginLeft:"30%"});
        }else if(vm <= 17){
            $("#form").css({margin:"15px 0px 15px 30%"});
            $("#s_tab").css({paddingLeft:"31%"});
            $("#content_left").css({marginLeft:"32%"});
        }else if(vm <= 18){
            $("#form").css({margin:"15px 0px 15px 30%"});
            $("#s_tab").css({paddingLeft:"31%"});
            $("#content_left").css({marginLeft:"34%"});
        }else if(vm <= 19){
            $("#form").css({margin:"15px 0px 15px 30%"});
            $("#s_tab").css({paddingLeft:"31%"});
            $("#content_left").css({marginLeft:"39%"});
        }else if(vm <= 19.5){
            $("#form").css({margin:"15px 0px 15px 30%"});
            $("#s_tab").css({paddingLeft:"24%"});
            $("#content_left").css({marginLeft:"20%"});
        }else{
            let num = localStorage.getItem("baidu_killer");
            if(num<=0){
                localStorage.setItem("baidu_killer",1);
                alert("臭宝你的屏幕很怪耶,我没办法适配,建议送我一台我来适配一下(只会弹出一次放心)");
            }else{
                if(num === null){
                    localStorage.setItem("baidu_killer",0);
                }else{
                    console.log("已经弹出过啦~");
                }
            }
            $("#form").css({margin:"15px 0px 15px 30%"});
            $("#s_tab").css({paddingLeft:"31%"});
            $("#content_left").css({marginLeft:"40%"});

        }
        let count = $(".m");
        let add = 0;
        $(function(){
            for(let i = 0;i<=count.length;i++){
            if(count.eq(i).text()==="广告"){
                count.eq(i).parent().parent().remove();
                add++;
            }
        }
        console.log("傻逼百度有"+add+"个广告");
        })
        //百度翻译
        $(".header").css({display:"none"});
        $(".manual-trans-btn").css({display:"none"});
        $(".translate-setting").css({display:"none"});
        $(".domain-trans-wrapper").remove();
        $(".footer").remove();
        $(".trans-other-right").remove();
        $("#left-result-container").bind('DOMNodeInserted', function() {
            $("#app-read").remove();
        });
        $(".translateio").css({position:"relative",top:"15px"});
        $(".trans-operation").css({marginLeft:16.207455429497568*vm+"px"});
        $(".container").css({width:"100%"});
    }
    //在百度首页时
    if(window.location.href === "https://www.baidu.com/"){
        $("#s_top_wrap").remove();
        $(".s-top-nav").remove();
        $("#s-top-left").remove();
        $("#u").remove();
        $("#u1").remove();
        $("#s_side_wrapper").remove();
        $("#bottom_layer").remove();
        $("#s-hotsearch-wrapper").remove();
        $("#s_lg_img").css({top:"30%"});
        $("#lg").css({max_height:"",height:"100%"})
        $("#kw").keypress(function (event) {
            if (event.keyCode === 13) {
                fresh();
            }
        })
    }else{
        //页面加载完成
        size();
        fresh();
    }
})();

QingJ © 2025

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