隐藏标题栏

隐藏网站的标题栏

  1. // ==UserScript==
  2. // @name 隐藏标题栏
  3. // @namespace Violentmonkey Scripts
  4. // @match https://pychina.org/*
  5. // @match https://*.pychina.org/*
  6. // @match https://realpython.com/*
  7. // @match https://*.realpython.com/*
  8. // @match https://v2ex.com/*
  9. // @match https://*.v2ex.com/*
  10. // @match https://pycoders.com/*
  11. // @match https://*.pycoders.com/*
  12. // @match https://airflow.apache.org/*
  13. // @match https://*.airflow.apache.org/*
  14. // @match https://zhihu.com/*
  15. // @match https://*.zhihu.com/*
  16. // @match https://ddys.pro/*
  17. // @grant none
  18. // @version 1.2
  19. // @author cichine
  20. // @license GPL3
  21. // @run-at document-start
  22. // @description 隐藏网站的标题栏
  23. // ==/UserScript==
  24.  
  25. (() => {
  26. const host = window.location.host;
  27. // const url = window.location.href;
  28. // const protocol = window.location.protocol;
  29. // const port = window.location.port;
  30. // const path = window.location.pathname;
  31. // const search = window.location.search;
  32.  
  33. const styleMap = {
  34. "pychina.org": `
  35. /* 清除顶栏固定 */
  36. .navbar-fixed-top {
  37. top: unset;
  38. z-index: unset;
  39. position: unset;
  40. }
  41. body{
  42. padding-top: unset;
  43. }
  44. `,
  45. "realpython.com": `
  46. /* 清除顶栏固定 */
  47. .fixed-top {
  48. position: unset;
  49. }
  50. /* 隐藏右下角Help */
  51. #beacon-container {
  52. display: none;
  53. }
  54. `,
  55. "v2ex.com": `
  56. /* 隐藏背景 */
  57. #Wrapper {
  58. background-color: #fff !important;
  59. background-image: unset !important;
  60. }
  61. /* 隐藏头像 */
  62. .avatar {
  63. display: none;
  64. }`,
  65. "pycoders.com": `
  66. .bg-brand-gradient {
  67. background-image: unset !important;
  68. }
  69. `,
  70. "airflow.apache.org": `
  71. .navbar {
  72. position: unset;
  73. padding: unset;
  74. }
  75. .base-layout--button {
  76. display: none;
  77. }
  78. .base-layout {
  79. padding: unset;
  80. }
  81. .roadmap .td-sidebar {
  82. top: unset;
  83. }
  84. `,
  85. "zhihu.com": `
  86. .Sticky.is-fixed {
  87. position: unset;
  88. }
  89. `,
  90. "ddys.pro": `
  91. body {
  92. background-color: unset;
  93. }
  94. .hthb-notification {
  95. display: none;
  96. }
  97. .pagination a, .pagination span {
  98. background-color: unset;
  99. border: unset;
  100. color: unset;
  101. }
  102. `,
  103. };
  104.  
  105. // 查找匹配的域名样式
  106. let s = "";
  107. for (const domain in styleMap) {
  108. if (host.endsWith(domain)) {
  109. s = styleMap[domain];
  110. break;
  111. }
  112. }
  113. console.log(`host: ${host}, style: ${s}`);
  114.  
  115. const style = document.createElement("style");
  116. style.innerHTML = s;
  117. document.head.appendChild(style);
  118. })();
  119.  

QingJ © 2025

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