知乎排版优化

知乎排版优化!

目前为 2017-06-18 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name 知乎排版优化
  3. // @namespace https://www.zhihu.com/
  4. // @version 1.3
  5. // @description 知乎排版优化!
  6. // @author chenglinz <onepiece8971@163.com>
  7. // @match https://www.zhihu.com/question/*
  8. // @match https://www.zhihu.com/people/*
  9. // @match https://www.zhihu.com/topic/*
  10. // @match https://www.zhihu.com/search?*
  11. // @match https://www.zhihu.com
  12. // @grant none
  13. // ==/UserScript==
  14.  
  15. (function() {
  16. 'use strict';
  17. var path = location.pathname.slice(0);
  18. (function (){
  19. if (path == '/') {
  20. var re = document.querySelector('.TopstorySideBar');
  21. console.log(re);
  22. re.remove();
  23. var inner = document.querySelector('.Topstory-mainColumn');
  24. inner.style.marginLeft = '150px';
  25. inner.style.marginRight = '150px';
  26. }
  27. })();
  28. (function (){
  29. if (path.match(/\/question\/\d+/g)) {
  30. var re = document.querySelector('.Question-sideColumn');
  31. re.remove();
  32. var inner = document.querySelector('.Question-mainColumn');
  33. inner.style.marginLeft = '155px';
  34. }
  35. })();
  36. (function (){
  37. if (path.match(/\/topic\/.*/g)) {
  38. var inner = document.querySelector('.zu-main-content-inner');
  39. inner.style.marginLeft = '140px';
  40. inner.style.marginRight = '150px';
  41. var backtotop = document.querySelector('.zh-backtotop');
  42. backtotop.style.marginLeft = '350px';
  43. var rightInner = document.querySelector('.zu-main-sidebar');
  44. rightInner.className='zu-main-sidebar';
  45. rightInner.style.width = '120px';
  46. rightInner.style.marginLeft = '-130px';
  47. }
  48. })();
  49. (function (){
  50. if (path.match(/\/people\/.*/g)) {
  51. var right = document.querySelector('.Profile-sideColumn');
  52. right.style.visibility = "hidden";
  53. var inner = document.querySelector('.Profile-mainColumn');
  54. inner.style.marginLeft = '155px';
  55. }
  56. })();
  57. // 只应用到主页,问题页,话题页,搜索页
  58. if (path.match(/\/search?.*/g)) {
  59. var re = document.querySelector('.zu-main-sidebar');
  60. re.style.visibility = "hidden";
  61. var inner = document.querySelector('.zu-main-content-inner');
  62. inner.style.marginLeft = '150px';
  63. inner.style.marginRight = '150px';
  64. var backtotop = document.querySelector('.zh-backtotop');
  65. backtotop.style.marginLeft = '350px';
  66. }
  67. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址