Keep only main content in zhihu
Fra og med
// ==UserScript==
// @name Eink-Zhihu
// @namespace https://greasyfork.org/users/169007
// @version 1.4.2
// @description Keep only main content in zhihu
// @author ZZYSonny
// @match https://www.zhihu.com/*
// @grant none
// @run-at document-end
// ==/UserScript==
(function () {
'use strict';
const head = document.getElementsByTagName('head')[0];
const exGlobalStyle = document.createElement('style');
const M = [
[
[
".VideoAnswerPlayer",
".CornerButtons",
".AppHeader",
".QuestionHeader",
".Question-sideColumn",
".GlobalSideBar",
".Reward",
".Catalog",
".Sticky",
".MCNLinkCard"
], c => `${c}{display: none;}`
], [
[
".Question-main",
".Question-mainColumn",
".Topstory-container",
".Topstory-mainColumn"
],c => `${c}{width:100%;padding:0;padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;margin:0;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;}`
], [
["figure"],
c => `${c}{width:60%;padding-left:20%;}`
]
];
exGlobalStyle.type = 'text/css';
exGlobalStyle.innerHTML = M.map(p => p[0].map(p[1]).join("\n")).join("\n");
head.appendChild(exGlobalStyle);
const removeTopID = setInterval(()=>{
const topstorys = document.getElementsByClassName("Topstory");
if(topstorys){
const topstory = topstorys[0];
clearInterval(removeTopID);
Array.from(topstory.children).forEach(e =>{
if(e.classList=="") e.remove();
});
}
})
})();