Greasy Fork is available in English.

Zhihu Page Modification

Enter something useful

Du musst eine Erweiterung wie Tampermonkey, Greasemonkey oder Violentmonkey installieren, um dieses Skript zu installieren.

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

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

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

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

Sie müssten eine Skript Manager Erweiterung installieren damit sie dieses Skript installieren können

(Ich habe schon ein Skript Manager, Lass mich es installieren!)

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.

(I already have a user style manager, let me install it!)

// ==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';
    }
};