知乎排版优化

知乎排版优化!

目前為 2016-09-13 提交的版本,檢視 最新版本

// ==UserScript==
// @name         知乎排版优化
// @namespace    https://www.zhihu.com/
// @version      0.5
// @description  知乎排版优化!
// @author       chenglinz <[email protected]>
// @match        https://www.zhihu.com/question*
// @match        https://www.zhihu.com
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    var path = location.pathname.slice(0);
    (function (){
        if (path == '/') {
            var selectInner = document.querySelector('.zm-side-section-inner').querySelector(".zm-side-nav-group");
            var rightInner = document.createElement("div");
            rightInner.className='zu-main-sidebar';
            rightInner.style.width = '110px';
            rightInner.style.marginLeft = '-130px';
            rightInner.appendChild(selectInner);
            var zuMain = document.querySelector('.zu-main');
            zuMain.appendChild(rightInner);
        }
    })();
    (function (){
        if (path.match(/\/question\/\d+$/g)) {
            var selectInner = document.querySelector('.zm-side-section-inner').getElementsByTagName("button");
            var rightInner = document.createElement("div");
            rightInner.className='zu-main-sidebar';
            rightInner.style.width = '0';
            rightInner.style.marginLeft = '-130px';
            rightInner.appendChild(selectInner[0]);
            var zuMain = document.getElementById('zh-single-question-page');
            zuMain.appendChild(rightInner);
        }
    })();
    // 只应用到主页和问题页
    if (path == '/' || path.match(/\/question\/\d+/g)) {
        var re = document.querySelector('.zu-main-sidebar');
        re.remove();
        var inner = document.querySelector('.zu-main-content-inner');
        inner.style.marginLeft = '150px';
        inner.style.marginRight = '150px';
        var backtotop = document.querySelector('.zh-backtotop');
        backtotop.style.marginLeft = '350px';
    }
})();

QingJ © 2025

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