Greasy Fork is available in English.

知乎排版优化

知乎排版优化!

< Feedback on 知乎排版优化

Question/comment

§
Posted: 27.06.2017
Edited: 23.08.2017

取消顶部导航栏的固定状态, 随页面滚动

function addGlobalStyle(css) {
        var head, style;
        head = document.getElementsByTagName('head')[0];
        if (!head) { return; }
        style = document.createElement('style');
        style.type = 'text/css';
        style.innerHTML = css;
        head.appendChild(style);
    }

    function removeSticky(){
        //sticky
        var sh = document.querySelector('.Sticky--holder');
        if(sh){
            sh.remove();
        }
        //header
        var ah = document.querySelector('.AppHeader');
        if(ah){
            ah.style.position = 'relative';
        }
        addGlobalStyle('.Sticky.is-fixed { position: relative !important; }');
        addGlobalStyle('.Sticky--holder { display: inline !important; }');
        //使用 rZhihu userscript 的用户可以取消下行注释, 使 C 键可以正常使用
        addGlobalStyle('.CommentEditor--normal { visibility: hidden !important; }');
    }
    (function (){
        if (path == '/') {
            var re = document.querySelector('.TopstorySideBar');
            re.remove();
            var inner = document.querySelector('.Topstory-mainColumn');
            inner.style.marginLeft = '150px';
            inner.style.marginRight = '150px';
            removeSticky();
        }
    })();
    (function (){
        if (path.match(/\/question\/\d+/g)) {
            var re = document.querySelector('.Question-sideColumn');
            re.remove();
            var inner = document.querySelector('.Question-mainColumn');
            inner.style.marginLeft = '155px';
            removeSticky();
        }
    })();
§
Posted: 27.06.2017
Edited: 27.06.2017
one pieceAuthor
§
Posted: 24.08.2017
rzhihu https://greasyfork.org/zh-CN/scripts/30036-rzhihu

已整合,因为导航栏上有消息通知,所以默认不开启,按H键后开启

Post reply

Sign in to post a reply.