简化知乎页面

简化 | 美化知乎页面

目前為 2020-07-16 提交的版本,檢視 最新版本

// ==UserScript==
// @name         简化知乎页面
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  简化 | 美化知乎页面
// @author       Lynn Speng
// @match        *://www.zhihu.com/*
// @grant        none
// ==/UserScript==


setInterval(() => {
    let ads = document.getElementsByClassName("TopstoryItem--advertCard");
    if (ads.length > 0) {
        for (let i = 0; i < ads.length; ++i)
            ads[i].remove();
    }

    let pcAds = document.getElementsByClassName("Pc-card");
    if (pcAds.length > 0) {
        for (let i = 0; i < pcAds.length; ++i)
            pcAds[i].remove();
    }
    let videos = document.getElementsByClassName("ZVideoItem");
    if (videos.length > 0) {
        for (let i = 0; i < videos.length; ++i)
            videos[i].parentNode.parentNode.remove();
    }
}, 50);

let style = document.createElement("style");
style.innerHTML = 
    'body { background-color: #274c5e }\
        .Avatar {border-radius: 50%;}\
        .Card, .ClubSliderList, .Footer, .HotItem { margin: 20px; border-radius: 8px; }\
        .Question-sideColumn{display: none;}\
        .Question-mainColumn{width: 1000px;}\
        .QuestionInvitation{display: none;}\
        .css-1roounf{display: none;}\
        .css-neu31m{display: none;}\
        .css-1qefhqu{width:80px}'
document.head.appendChild(style);