Zhihu Page Modification

Enter something useful

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

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

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

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.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name     Zhihu Page Modification
// @namespace https://www.zhihu.com/
// @version  2
// @description Enter something useful
// @grant    none
// @match    https://www.zhihu.com/*
// ==/UserScript==

window.onload = function() {
    // 选取并删除第二个块
    var block2 = document.querySelector('#root > div > main > div > div.Topstory-container > div.css-1qyytj7');
    if (block2 != null) {
        block2.parentNode.removeChild(block2);
    }

    // 选取并使第一个块居中
    var block1 = document.querySelector('#root > div > main > div > div.Topstory-container > div.Topstory-mainColumn');
    if (block1 != null) {
        block1.style.margin = '0 auto';
    }

    // 选取并删除指定元素
    var elementToDelete = document.querySelector('#root > div > main > div > div.Search-container > div.css-knqde');
    if (elementToDelete) {
        elementToDelete.parentNode.removeChild(elementToDelete);
    }

    // 选取并使特定元素在水平方向上居中
    var elementToCenter = document.querySelector('.SearchMain');
    if (elementToCenter) {
        elementToCenter.style.marginLeft = 'auto';
        elementToCenter.style.marginRight = 'auto';
        elementToCenter.style.display = 'block';
    }
};