Greasy Fork is available in English.

屏蔽百度热搜、资讯、搜索页右侧相关网站、热榜

屏蔽百度热搜、百度首页资讯、百度首页热榜、百度搜索页右侧相关网站.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name         屏蔽百度热搜、资讯、搜索页右侧相关网站、热榜
// @namespace    http://tampermonkey.net/
// @version      0.7
// @description  屏蔽百度热搜、百度首页资讯、百度首页热榜、百度搜索页右侧相关网站.
// @author       ysypnbh
// @match        *://www.baidu.com/*
// @grant        none
// ==/UserScript==
(function () {
    'use strict';
    // 未登录,关闭百度首页热榜
    if (document.getElementById("s-hotsearch-wrapper")) {
        document.getElementById("s-hotsearch-wrapper").className += ' hide'
    }
    if (document.getElementById("head_wrapper")) {
        document.getElementById("head_wrapper").className += ' s-ps-islite'
    }
    // 已登录,关闭百度首页资讯
    if (document.getElementsByClassName("s-manhattan-index")) {
        document.getElementsByClassName("s-manhattan-index").className += ' is-lite'
    }
    if (document.getElementById("s_menu_gurd")) {
        document.getElementById("s_menu_gurd").style.display = 'none'
    }
    if (document.getElementById("s_wrap")) {
        document.getElementById("s_wrap").style.display = 'none'
    }
    // 已登录,关闭百度placeholder
    setTimeout(() => {
        // 已登录,关闭百度placeholder
        if (document.getElementById('kw')) {
            let kw_elem = document.getElementById("kw");
            if (kw_elem.hasAttribute("placeholder")) {
                document.getElementById('kw').setAttribute('placeholder', '');
            }
        }
        if (document.getElementById('chat-textarea')) {
            let chat_textarea_elem = document.getElementById("chat-textarea");
            if (chat_textarea_elem.hasAttribute("placeholder")) {
                document.getElementById('chat-textarea').setAttribute('placeholder', '');
            }
        }
    }, 1000);


    function closeContentRight() {
        if (location.hostname == "www.baidu.com") {
            var myVar = setInterval(function () {
                // 屏蔽百度搜closeContentRight索页右侧相关网站、百度热榜等
                if (document.getElementById('content_right')) {
                    document.getElementById('content_right').style.display = "none";
                }
                if (document.getElementById('rrecom-container')) {
                    document.getElementById('rrecom-container').style.display = "none";
                }
                if (document.getElementsByClassName("opr-recommends-merge-content")[0]) {
                    document.getElementsByClassName("opr-recommends-merge-content")[0].style.display = "none";
                }
                // popup-advert 关闭华为广告 制作屏蔽该广告日期25-11-18
                if (document.getElementsByClassName("popup-advert")[0]) {
                    document.getElementsByClassName("popup-advert")[0].style.display = 'none'
                }
                // 清除placeholder缓存
                if (localStorage.getItem('placeholderData')) {
                    localStorage.removeItem('placeholderData');
                }
            }, 150);
        }
    }
    closeContentRight()
    // Your code here...
})();