Better StackOverflow

adds outline to code blocks, ad block, no cookie modal, various fixes.

目前为 2023-05-26 提交的版本。查看 最新版本

  1. /* ==UserStyle==
  2. @name Better StackOverflow
  3. @description adds outline to code blocks, ad block, no cookie modal, various fixes.
  4. @author NotYou
  5. @match *://stackoverflow.com/*
  6. @match *://*.stackoverflow.com/*
  7. @match *://stackexchange.com/*
  8. @match *://superuser.com/*
  9. @match *://serverfault.com/*
  10. @match *://askubuntu.com/*
  11. @match *://stackapps.com/*
  12. @match *://mathoverflow.net/*
  13. @namespace -
  14. @version 1.2.2
  15. @license GPL-3.0-or-later
  16. ==/UserStyle== */
  17.  
  18. /* Darker Accepted Mark Background in questions list */
  19.  
  20. .s-post-summary--stats .s-post-summary--stats-item.has-answers.has-accepted-answer {
  21. background-color: var(--green-600);
  22. border-color: var(--green-600);
  23. }
  24.  
  25. /* Fix; Keyboard and Tag Elements | https://meta.stackexchange.com/a/257138/260841 */
  26.  
  27. kbd,
  28. .s-prose .post-tag {
  29. white-space: pre-wrap;
  30. max-width: calc(100% - 0.1em);
  31. }
  32.  
  33. /* Fix; Non-Vertically Aligned Elements at Sidebar | https://meta.stackexchange.com/q/388770/ */
  34.  
  35. #sidebar .related a,
  36. #sidebar .linked a {
  37. margin: auto 0;
  38. }
  39.  
  40. /* Fix; Remove Default FF styles for <select> */
  41.  
  42. select {
  43. -webkit-appearance: none;
  44. -moz-appearance: none;
  45. appearance: none;
  46. }
  47.  
  48. /* Ad Block */
  49.  
  50. .img_ad,
  51. #dfp-tsb,
  52. #dfp-smlb,
  53. #dfp-tlb,
  54. #dfp-mlb,
  55. .js-report-ad-button-container,
  56. .adsbox,
  57.  
  58. /* Cookie */
  59.  
  60. .js-consent-banner {
  61. display: none !important;
  62. }
  63.  
  64. .js-tag-editor.tag-editor.multi-line.s-input {
  65. width: 100% !important;
  66. }
  67.  
  68. /* Code Outline */
  69.  
  70. .default.s-code-block {
  71. --color: rgba(0, 0, 0, .2);
  72. }
  73.  
  74. [class*="lang-"] {
  75. border: 2px solid var(--color);
  76. }
  77.  
  78. [class*="lang-"]::after {
  79. content: '\a'var(--content);
  80. color: var(--color) !important;
  81. padding: 2px 5px 5px 5px;
  82. font-weight: 800;
  83. }
  84.  
  85. .snippet-code [class*="lang-"]::after {
  86. content: '\a\a'var(--content);
  87. }
  88.  
  89. .s-code-block::after {
  90. font-family: BlinkMacSystemFont, -apple-system, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  91. }
  92.  
  93. .lang-none {
  94. --color: rgb(100, 0, 0);
  95. --content: "Plain";
  96. }
  97.  
  98. .lang-js {
  99. --color: rgb(247, 223, 30);
  100. --content: "JS";
  101. }
  102.  
  103. .lang-js::after {
  104. color: rgb(0, 0, 0);
  105. }
  106.  
  107. .lang-html {
  108. --color: rgb(242, 103, 44);
  109. --content: "HTML";
  110. }
  111.  
  112. .lang-css {
  113. --color: rgb(52, 169, 222);
  114. --content: "CSS";
  115. }
  116.  
  117. .lang-java {
  118. --color: rgb(234, 146, 5);
  119. --content: "Java";
  120. }
  121.  
  122. .lang-py,
  123. .lang-python {
  124. --color: rgb(54, 119, 173);
  125. --content: "Python";
  126. }
  127.  
  128. .lang-cpp {
  129. --color: rgb(101, 154, 210);
  130. --content: "C++";
  131. }
  132.  
  133. .lang-cs,
  134. .lang-csharp {
  135. --color: rgb(93, 108, 189);
  136. --content: "C#";
  137. }
  138.  
  139. .lang-c {
  140. --color: rgb(93, 108, 189);
  141. --content: "C";
  142. }
  143.  
  144. .lang-php {
  145. --color: rgb(93, 108, 189);
  146. --content: "PHP";
  147. }
  148.  
  149. .lang-rb {
  150. --color: rgb(174, 21, 5);
  151. --content: "Ruby";
  152. }
  153.  
  154. .lang-r {
  155. --color: rgb(35, 105, 190);
  156. --content: "R";
  157. }
  158.  
  159. .lang-perl {
  160. --color: rgb(66, 68, 109);
  161. --content: "Perl";
  162. }
  163.  
  164. .lang-bsh {
  165. --color: rgb(41, 48, 54);
  166. --content: "Bash";
  167. }
  168.  
  169. .lang-kotlin {
  170. --color: rgb(117, 114, 227);
  171. --content: "Kotlin";
  172. }
  173.  
  174. .lang-rust {
  175. --color: rgb(0, 0, 0);
  176. --content: "Rust";
  177. }
  178.  
  179. .lang-regex {
  180. --color: rgb(64, 209, 178);
  181. --content: "RegEx";
  182. }
  183.  
  184. .lang-sql {
  185. --color: rgb(192, 207, 212);
  186. --content: "SQL";
  187. }
  188.  
  189. .lang-pascal {
  190. --color: rgb(50, 96, 160);
  191. --content: "Pascal";
  192. }
  193.  
  194. .lang-vb {
  195. --color: rgb(60, 110, 179);
  196. --content: "VB";
  197. }
  198.  
  199. .lang-xml {
  200. --color: rgb(0, 95, 174);
  201. --content: "XML";
  202. }
  203.  
  204. .lang-lua {
  205. --color: rgb(0, 0, 128);
  206. --content: "Lua";
  207. }
  208.  
  209. .lang-go {
  210. --color: rgb(106, 215, 228);
  211. --content: "Go";
  212. }
  213.  
  214. .lang-swift {
  215. --color: rgb(250, 42, 31);
  216. --content: "Swift";
  217. }
  218.  
  219. .lang-clj {
  220. --color: rgb(145, 180, 255);
  221. --content: "Clojure";
  222. }
  223.  
  224. .lang-scala {
  225. --color: rgb(234, 2, 0);
  226. --content: "Scala";
  227. }
  228.  
  229. .lang-typescript {
  230. --color: rgb(49, 120, 198);
  231. --content: "TypeScript";
  232. }