Greasy Fork 还支持 简体中文。

知乎问答页面重新排版

try to take over the world!

目前為 2016-07-25 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         知乎问答页面重新排版
// @namespace    https://www.zhihu.com/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        https://www.zhihu.com/question*
// @match        https://www.zhihu.com
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    function getByClass(sClass){
        var aResult=[];
        var aEle=document.getElementsByTagName('*');
        /*正则模式*/
        var re=new RegExp("\\b" + sClass + "\\b","g");
        for(var i=0;i<aEle.length;i++){
            /*字符串search方法判断是否存在匹配*/
            if(aEle[i].className.search(re) != -1){
                aResult.push(aEle[i]);
            }
        }
        return aResult;
    }
    var re = getByClass('zu-main-sidebar');
    re[0].remove();
    var inner = getByClass('zu-main-content-inner');
    inner[0].style.marginLeft = '150px';
    inner[0].style.marginRight = '150px';
    var backtotop = getByClass('zh-backtotop');
    backtotop[0].style.marginLeft = '350px';
})();