Eink-Zhihu

Keep only main content in zhihu

  1. // ==UserScript==
  2. // @name Eink-Zhihu
  3. // @namespace https://greasyfork.org/users/169007
  4. // @version 1.4.6
  5. // @description Keep only main content in zhihu
  6. // @author ZZYSonny
  7. // @match https://www.zhihu.com/*
  8. // @grant none
  9. // @run-at document-start
  10. // ==/UserScript==
  11. (function () {
  12. 'use strict';
  13. const head = document.getElementsByTagName('head')[0];
  14. const exGlobalStyle = document.createElement('style');
  15. const M = [
  16. [
  17. [
  18. ".VideoAnswerPlayer",
  19. ".CornerButtons",
  20. ".AppHeader",
  21. ".QuestionHeader",
  22. ".Question-sideColumn",
  23. ".GlobalSideBar",
  24. ".Reward",
  25. ".Catalog",
  26. ".Sticky",
  27. ".MCNLinkCard",
  28. ".Topstory > div:not(.Topstory-container)"
  29. ], c => `${c}{display: none;}`
  30. ], [
  31. [
  32. ".Question-main",
  33. ".Question-mainColumn",
  34. ".Topstory-container",
  35. ".Topstory-mainColumn"
  36. ],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;}`
  37. ], [
  38. ["figure"],
  39. c => `${c}{width: 50%;padding-left:25%;pointer-events:none;}`
  40. ]
  41. ];
  42. exGlobalStyle.type = 'text/css';
  43. exGlobalStyle.innerHTML = M.flatMap(p => p[0].map(p[1])).join("\n");
  44. head.appendChild(exGlobalStyle);
  45. })();