Baidu Beautify

(建议将插件设置中的运行时期选:document-start)顶部工具栏毛玻璃效果、底部分页栏悬浮、搜索结果添加边框、去除侧边栏(设置中可打开)、搜索结果多列(设置中可关闭)

目前為 2020-11-06 提交的版本,檢視 最新版本

// ==UserScript==
// @name         Baidu Beautify
// @name:zh-CN   百度搜索美化
// @namespace    baidu_beautify
// @version      1.3
// @description  (建议将插件设置中的运行时期选:document-start)顶部工具栏毛玻璃效果、底部分页栏悬浮、搜索结果添加边框、去除侧边栏(设置中可打开)、搜索结果多列(设置中可关闭)
// @description:zh-CN  (建议将插件设置中的运行时期选:document-start)顶部工具栏毛玻璃效果、底部分页栏悬浮、搜索结果添加边框、去除侧边栏(设置中可打开)、搜索结果多列(设置中可关闭)
// @author       You
// @match        https://www.baidu.com/s*
// @grant        GM_addStyle
// @grant    GM_getValue
// @grant    GM_setValue
// ==/UserScript==

GM_addStyle(
    // 顶栏样式
    '#s_tab{border-bottom: #e0e0e0 1px solid;background-color: rgba(248,248,248,0.4) !important}' +
    '.s_tab_inner{background-color: rgba(248,248,248,0.4) !important}' +
    '#head {backdrop-filter: blur(10px);background-color: rgba(248,248,248,0.4)}' +
    '#form > span.bg.s_ipt_wr.quickdelete-wrap {background-color: white}' +
    //
    '#container.sam_newgrid {width:100%;margin-left:0;margin-bottom:45px}' +
    '.head_nums_cont_inner{margin-left:140px !important;}' +
    '#content_left{width:auto !important;margin-left:140px !important;flex-wrap:wrap ;float: none !important}' +
    // 隐藏相关搜索&其他人在搜
    '#rs, [tpl=recommend_list]{display: none}' +
    // 搜索结果样式
    '#content_left>div{margin-right:44px !important;margin-bottom:20px !important;width:560px !important;border-radius:12px !important;padding:16px !important;-webkit-box-shadow: 0 2px 5px 0 rgba(0,0,0,.1) !important;}' +
    '#content_left>table{margin-right:44px !important;margin-bottom:20px !important;border-radius:12px !important;-webkit-box-shadow: 0 2px 5px 0 rgba(0,0,0,.1) !important;}' +
    '#content_left>table>tbody>tr>td{padding:16px !important}' +
    '#content_left>table>tbody>tr>td>div{width:560px !important;-webkit-box-shadow:unset !important;border: none !important;padding: 0 !important}' +
    '.c-border{-webkit-box-shadow:unset !important;margin-bottom: 0 !important;border: none !important}' +
    // 分页栏样式
    '#page{position:fixed;bottom:0;width:100%;border-top: #e0e0e0 1px solid;}'
);

(function() {
    'use strict';
    var singleCol = GM_getValue('singleColumn', 'N')
    var sideBar = GM_getValue('sideBar', 'N')
    var settingItem1 = document.createElement("a");
    settingItem1.href='';
    var settingItem2 = document.createElement("a");
    settingItem2.href='';
    var splitLine = document.createElement('span');
    splitLine.style.margin = '8px 16px';
    splitLine.style.background = '#d7d9e0';
    splitLine.style.height = '1px';
    splitLine.style.display = 'block';

    if(singleCol == 'Y'){
        settingItem1.innerHTML = '多列排列';
        GM_addStyle('#content_left{display: grid; !important}');
        if(sideBar == 'Y'){
            settingItem2.innerHTML = '隐藏侧栏';
            GM_addStyle('#content_right{display:block;padding-right:100px !important;float: right !important}');
        }else{
            settingItem2.innerHTML = '展示侧栏';
            GM_addStyle('#content_right{display:none}');
        }
    }else{
        settingItem1.innerHTML = '单列排列';
        settingItem2.innerHTML = '展示侧栏';
        GM_addStyle('#content_left{display: flex; !important}' +
                    '#content_right{display:none}');
    }

    window.onload = function(){
        let pf = document.getElementsByClassName('pf')[0];
        pf.onmouseover = function(){
            let settings = document.getElementsByClassName('bdpfmenu')[0];
            settings.appendChild(splitLine);
            settings.appendChild(settingItem1);
            if(singleCol == 'Y'){
                settings.appendChild(settingItem2);
            }
            settingItem1.onclick = function(){
                if(singleCol == 'Y'){
                    singleCol = 'N';
                    GM_setValue('singleColumn', 'N')
                }else{
                    singleCol = 'Y';
                    GM_setValue('singleColumn', 'Y')
                }
            }
            settingItem2.onclick = function(){
                if(sideBar == 'Y'){
                    sideBar = 'N';
                    GM_setValue('sideBar', 'N')
                }else{
                    sideBar = 'Y';
                    GM_setValue('sideBar', 'Y')
                }
            }
            pf.onmouseover = null;
        }
    }
    // Your code here...
})();

QingJ © 2025

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