shumin-baidu

自用,css代码抄改自https://gf.qytechs.cn/zh-CN/scripts/406336,版权归原作者所有

当前为 2022-07-17 提交的版本,查看 最新版本

// ==UserScript==
// @name         shumin-baidu
// @description  自用,css代码抄改自https://gf.qytechs.cn/zh-CN/scripts/406336,版权归原作者所有
// @icon         http://baidu.com/favicon.ico
// @namespace    https://gf.qytechs.cn/zh-CN/
// @version      2.1
// @author       qianjunlang
// @include      *://www.baidu.com/s?*
// @include      *://ipv6.baidu.com/s?*
// @include      *://www.baidu.com/baidu?*
// @include      *://ipv6.baidu.com/baidu?*
// @require      https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js
// @grant        GM_setValue
// @grant        GM_getValue
// @grant        GM_registerMenuCommand
// @license      MIT
// @run-at       document-body
// ==/UserScript==

function check_emp(x) {
  return x.length > 0;
}
function get_s_wd(){
    var wd = "NONE"
    var qry = window.location.search.substring(1);
    var vals = qry.split('&');
    for(var i in vals){
        var pair = vals[i].split('=');
        if(pair[0] == "wd") wd = pair[1];
    }

    wd = wd.replace(/%20/g,'+');
    wd = wd.split('+').filter(check_emp).join('+');

    return wd;
}

//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*main*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
(function() {
    /* global $ */
    'use strict';

    var style_tag = document.createElement('style');
    var white_style = `
#s_main, .s-top-nav, .s-hotsearch-wrapper, #content_right {
	display: none;
}
#container #content_left {
	width: 1000px !important;
}
@media screen and (min-width: 1921px) {
	#container.sam_newgrid {
		padding-left: 0 !important;
		width: 1000px !important;
	}
	.wrapper_new #s_tab.s_tab .s_tab_inner {
		padding-left: 0 !important;
		margin-left: -36px;
	}
	.wrapper_new #head .s_form:not(div#s_fm.s_form), .s-isindex-wrap {
		margin-left: -60px !important;
	}
	.wrapper_new #s_tab, #page > div, #ent_sug {
		width: 1000px !important;
	}
	.foot-container_2X1Nt div {
		width: 1000px !important;
	}
}
.new-pmd.c-container, #container #content_left .result-op, #container #content_left .result {
	width: 980px !important;
}
.new-pmd .c-span12 {
	width: 970px !important;
}
.new-pmd .c-span9 {
	width: 820px !important;
}
#container .c-container h3.t > a:first-child, #container .c-container h3.t > a:first-child em, #container .c-container .c-title > a:first-child, #container .c-container .c-title > a:first-child em {
	text-decoration: none !important;
	line-height: 1.3 !important
}
.nums, .new_search_tool_conter {
	width: 1000px !important;
}
#container.sam_newgrid {
	margin-left: unset !important;
	margin: 0 auto !important;
}
#container #content_left .result-op, #container #content_left .result {
	border-radius: 10px !important;
	box-shadow: 0 0 6px #eeeeff;
	border-left: 1px solid #eeeeee;
	padding: 10px 10px 15px 20px !important;
	transition: margin-bottom 0.6s, padding-bottom 0.6s, box-shadow 0.6s;
}
#container #content_left .result-op:hover, #container #content_left .result:hover {
	box-shadow: 1px 1px 10px #cccccc;
	border-radius: 0;
}
.new-pmd .c-border {
	box-shadow: unset !important
}
.wrapper_new #s_tab, #page > div, #ent_sug {
	padding-left: 0 !important;
	width: 1080px;
	margin: 0 auto !important;
}
#ent_sug {
	margin-top: 140px !important;
}
#help {
	display: block;
	width: 1080px;
	margin: 0 auto;
	float: unset !important;
	padding-left: unset !important;
}
#head .head_wrapper {
	width: 1080px;
	margin: 0 auto !important;
}
.wrapper_new #head .s_form:not(div#s_fm.s_form), .s-isindex-wrap {
	margin-left: 0;
}
.wrapper_new #head .s_form {
	padding-left: 0 !important;
}
.slowmsg1 {
	left: 400px !important;
	top: 120px !important;
	box-shadow: none !important;
	border: none !important;
	background: none !important;
}
div[class^="re-box_"] {
	box-shadow: none !important;
}
    `;
    style_tag.innerHTML = white_style;
    
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

    fresh_page();
    function fresh_page(){
        $("#content_right").remove();
        document.head.appendChild(style_tag);

        $("#u a.toindex").text("=> Google");
        $("#u a.toindex").attr('href','https://www.google.com/search?q='+ get_s_wd());
    }

    document.addEventListener ("DOMContentLoaded", kill_baidu_ad);
    function kill_baidu_ad () {
        unsafeWindow.$(document).ajaxSuccess(function(e, xhr, opt) { // Microsoft Edge 和 Safari 不支持 $(document).ajaxSuccess()

            fresh_page();

            $('#content_left>div').has('span:contains("广告")').remove();
            setTimeout(function () { $('.c-container').has('.f13>span:contains("广告")').remove(); }, 2100); // 去除顽固性的延迟加载广告,一般延迟2秒左右。例如搜索“淘宝”,当页面加载完毕之后在搜索结果最前或最后会再插入一个广告。
        });
    }
})();

QingJ © 2025

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