zhangjiahao93 / 百度深色模式

// ==UserScript==
// @name         百度深色模式
// @namespace    https://openuserjs.org/users/zhangjiahao93
// @version      1.0
// @description  百度搜索深色样式补丁
// @author       zhangjiahao
// @match        https://www.baidu.com/*
// @grant        none
// @homepageURL  https://github.com/zhangjiahao93/baidu-darktheme
// @copyright 2021, zhangjiahao93 (https://openuserjs.org/users/zhangjiahao93)
// @license MIT
// ==/UserScript==

(function() {
    'use strict';
    // Your code here...
    const addCss = function(path) {
        if(!path || path.length === 0) {
            throw new Error('参数"path"错误');
        }
        var head = document.getElementsByTagName('head')[0];
        var link = document.createElement('link');
        link.href = path;
        link.rel = 'stylesheet';
        link.type = 'text/css';
        head.appendChild(link);
    }
    var head = document.getElementsByTagName('head')[0];
    var style = document.createElement('style');
    style.rel = 'stylesheet';
    style.type = 'text/css';
    style.innerHTML='body{background-color:#444!important}#s_top_wrap .s-center-box{background-color:#555}#bottom_layer{background-color:#555}.c-color-t{color:#969696}#head_wrapper.s-ps-islite .fm{display:flex}#head_wrapper .s_ipt_wr{border:0}#head_wrapper #form #kw{border:2px solid #c4c7ce}#head_wrapper .s_btn{background-color:#969696}.new-pmd.c-container{color:#cbb}a{color:#969696}#rs{background-color:#444}#content_right a:link{color:#969696}.wrapper_new{background-color:#444}.wrapper_new #u a{color:#969696}.wrapper_new #form .bdsug-new ul{border:0}.wrapper_new #form .bdsug-new ul li{color:#fff}.wrapper_new #form .bdsug-new ul li b{color:#cbb}#head .head_wrapper{background:#444}#head .bdsug{background:#3d3d3d;color:#fff}#su{background:#969696}#kw{color:#969696}.wrapper_new .s_ipt_wr{border:2px solid #969696}.wrapper_new #s_tab{background-color:#444;color:#969696}.wrapper_new #s_tab .cur-tab{color:#fff}.wrapper_new #s_tab a{color:#969696}.wrapper_new #s_tab a:hover{color:#fff}.new-pmd .c-abstract{color:#cbb}.new-pmd .c-color-t{color:#fff}.wrapper_new .sam_newgrid ~ #page strong{background-color:#666;color:#969696}.wrapper_new .sam_newgrid ~ #page a{background-color:#555;color:#969696}#page .page-inner{background-color:#3d3d3d}.wrapper_new .sam_newgrid #page a{background-color:#969696;color:#cbb}.wrapper_new .sam_newgrid #page strong{background-color:#969696}.wrapper_new #foot{background-color:#3d3d3d}.wrapper_new #foot #help{background-color:#3d3d3d}'
    head.appendChild(style)
})();