知乎优化

Sets custom widths and hides specified elements on Zhihu

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         知乎优化
// @namespace    http://tampermonkey.net/
// @version      0.6
// @description  Sets custom widths and hides specified elements on Zhihu
// @author       You
// @match        https://www.zhihu.com/*
// @match        http://www.zhihu.com/*
// @match        https://zhihu.com/*
// @match        http://zhihu.com/*
// @grant        none
// @license MIT
// @run-at       document-start
// ==/UserScript==
(function() {
    'use strict';
    
    // 创建样式表
    const style = document.createElement('style');
    style.textContent = `
        .Topstory-mainColumn, .Question-mainColumn {
            width: 100% !important;
        }
        
        .css-11p8nt5, .css-1kjxdzv {
            max-width: 0px !important;
            min-width: 950px !important;
        }
        
        .Question-sideColumn {
            display: none !important;
        }
        
        .css-1qyytj7 > div,
        .css-29q9fa,
        li.Tabs-item--noMeta.AppHeader-Tab.Tabs-item:nth-of-type(3),
        li.Tabs-item--noMeta.AppHeader-Tab.Tabs-item:nth-of-type(4),
        .css-18vqx7l > .fEPKGkUK5jyc4fUuT0QP.Button--plain.FEfUrdfMIKpQDJDqkjte.css-79elbk.Button {
            display: none !important;
        }
    `;
    
    // 在页面开始加载时就插入样式
    document.documentElement.appendChild(style);
})();