GitHub - single column with important info on the top

Pull sidebar info and readme above files on repository page

当前为 2021-04-12 提交的版本,查看 最新版本

  1. /* ==UserStyle==
  2. @name GitHub - single column with important info on the top
  3. @namespace myfonj
  4. @version 1.8.0
  5. @description Pull sidebar info and readme above files on repository page
  6. @author myf
  7. ==/UserStyle== */
  8. @-moz-document domain("github.com") {
  9. /* just for categorization */
  10. }
  11. @-moz-document regexp("^https?://github.com/(?!password_reset|settings)([^#?/]+)/([^#?/]+)/?([#?].*)?$") {
  12. /*
  13. GitHub - single column with important info on the top
  14. https://greasyfork.org/en/scripts/406729/versions/new
  15.  
  16. examples
  17. https://github.com/mmulet/code-relay
  18. few contributors, many columns
  19. https://github.com/mozilla/readability
  20. used by ..
  21. https://github.com/GoogleChromeLabs/dark-mode-toggle
  22. many tags, much everything
  23. https://github.com/WebReflection/sqlite-worker
  24. five columns
  25. https://github.com/rilwis/bamboo
  26. fork, just two columns
  27. https://github.com/mozilla/standards-positions
  28. no about, no tags
  29. https://github.com/mcmilk/7-Zip-zstd/
  30. sponsor
  31. https://github.com/mdn/mdn-minimalist
  32. no readme TOC
  33. */
  34. /* unify main max width and centering
  35. */
  36. main > div {
  37. max-width: none !important;
  38. max-width: 80rem !important;
  39. max-width: 90rem !important;
  40. margin-left: auto;
  41. margin-right: auto;
  42. }
  43. /* Header row with name, description for mobile, tabs, etc */
  44. main > div:first-child {
  45. display: flex;
  46. flex-direction: column;
  47. background-color: transparent !important;
  48. padding-top: 0 !important;
  49. }
  50. /* "Tabs" (Code , PRs, Actions, ... ) pull above main heading */
  51. main > div:first-child > nav {
  52. order: -1;
  53. margin-bottom: 1rem;
  54. }
  55. /* main "columns" wrapper (files | sidebar) - convert to reversed rows */
  56. .repository-content > div > div:last-child {
  57. flex-direction: column-reverse !important;
  58. }
  59. /* Files, Sidebar - now rows*/
  60. .repository-content > div > div:last-child > div {
  61. width: auto;
  62. }
  63. /*
  64. main column - wrapper of:
  65. - file navigation (branches, tags left, goto, file right)
  66. - files (moved to bottom, except for 1. "row" with latest commit positioned to file navigation)
  67. - readme (moved under file navigation)
  68. */
  69. .repository-content > div > div:last-child > div:first-child {
  70. position: relative;
  71. display: flex;
  72. flex-direction: column;
  73. }
  74. .repository-content > div > div:last-child > div:first-child > .file-navigation {
  75. order: -2;
  76. }
  77. /*
  78. Readme - move before files files
  79. there are two kinds of readme blocks:
  80. - "fancy" readme-toc component with kebab menu of headings (introduced around 2021-03-26)
  81. - see e.g. https://github.com/SerenityOS/serenity
  82. - "normal" div#readme
  83. - see e.g. https://github.com/mozilla/readability
  84. */
  85. .repository-content > div > div:last-child > div:first-child > readme-toc,
  86. .repository-content > div > div:last-child > div:first-child > #readme {
  87. order: -1;
  88. }
  89. /* sticky "README.md" heading / TOC box make simple button */
  90. .repository-content > div > div:last-child > div:first-child > readme-toc > #readme > :first-child {
  91. display: inline-flex !important;
  92. border: none !important;
  93. background-color: transparent !important
  94. /**/
  95. }
  96. /* "readme.md" label/link heading after TOC button: hide */
  97. .repository-content > div > div:last-child > div:first-child > readme-toc > #readme > :first-child h2{ display: none; }
  98. /* actual readme box: push up into place freed by heading / TOC box */
  99. .repository-content > div > div:last-child > div:first-child > readme-toc > #readme > :last-child{
  100. margin-top: -3rem
  101. }
  102. /*
  103. sidebar - now top content
  104. for god's sake, THIS div should be MAIN and should be near H1 or something
  105. not suffocated at the end of the document in sidebar
  106. */
  107. .repository-content > div > div:last-child > div:last-child > div {
  108. display: flex;
  109. flex-direction: row;
  110. /* let's try without
  111. flex-wrap: wrap;
  112. now */
  113. padding-bottom: 1rem;
  114. }
  115. /* all main flex items (about .. languages)*/
  116. .repository-content > div > div:last-child > div:last-child > div > * {
  117. flex-grow: 1;
  118. flex-shrink: 10;
  119. border-left: 1px solid var(--color-border-secondary);
  120. border-left: none;
  121. padding-left: .5rem;
  122. padding-right: .5rem;
  123. padding-bottom: 1rem;
  124. }
  125. /*
  126. first "about" cell
  127. */
  128. .repository-content > div > div:last-child > div:last-child > div:first-child > div:first-child {
  129. flex-basis: 25rem;
  130. flex-grow: 50;
  131. flex-shrink: 1;
  132. border-left: none;
  133. padding-left: 0;
  134. }
  135. /* 📖 Readme ⚖️ License : condense */
  136. .repository-content > div > div:last-child > div:last-child > div:first-child > div:first-child > div > h3 + div {
  137. display: inline-block;
  138. margin-right: 1em;
  139. }
  140. /* unnecessary link icon, may cause wrap, hide */
  141. .repository-content > div > div:last-child > div:last-child > div:first-child > div:first-child .octicon-link {
  142. display: none;
  143. }
  144. /* last "(programming) languages" cell */
  145. .repository-content > div > div:last-child > div:last-child > div:first-child > div:last-child {
  146. flex-shrink: 100;
  147. /* let's try without limiting */
  148. }
  149. /* no border nor paddings */
  150. .repository-content > div > div:last-child > div:last-child > div > div > div {
  151. border: none;
  152. padding: 0;
  153. }
  154. /* headings */
  155. .repository-content > div > div:last-child > div:last-child > div > div > div > h2 ,
  156. .repository-content > div > div:last-child > div:last-child > div > div > div > h2 > a {
  157. white-space: nowrap !important;
  158. }
  159. /* tags in about cell - restack and dim */
  160. .repository-content > div > div:last-child > div:last-child > div:first-child > div .f6:not(:hover) {
  161. opacity: 0.5;
  162. }
  163. .repository-content > div > div:last-child > div:last-child > div:first-child > div .f6 {
  164. display: flex;
  165. flex-wrap: wrap;
  166. }
  167. .repository-content > div > div:last-child > div:last-child > div:first-child > div .f6 > * {
  168. flex-grow: 1;
  169. text-align: center;
  170. }
  171. /* "used by 108" - make 8 avatars wrap */
  172. .hx_flex-avatar-stack {
  173. flex-wrap: wrap;
  174. max-width: 10rem;
  175. padding-right: .8rem;
  176. }
  177. /* allowing wrap of counter under "used by" avatars */
  178. .repository-content > div > div:last-child > div:last-child > div:first-child > div .d-flex.flex-items-center {
  179. flex-wrap: wrap;
  180. }
  181. /*
  182. un-truncating everything to allow wrapping of long (esp. in "releases" cell
  183. affects "releases", but whatever
  184. */
  185. .repository-content > div > div:last-child > div:last-child > div > * * {
  186. white-space: normal !important;
  187. }
  188. /* un-flexing latest release */
  189. .repository-content > div > div:last-child > div:last-child > div > * .Link--primary.d-flex * { display: block !important}
  190.  
  191. /* superfluous link icon in "sponsor this project" */
  192. .repository-content > div > div:last-child > div:last-child > div > * [style="min-width:32px;height:32px;"] {
  193. display: none !important;
  194. }
  195. /* environments "active" tag below text */
  196. .repository-content > div > div:last-child > div:last-child > div > * h2 + .list-style-none li .Label {
  197. display: block;
  198. }
  199. /*
  200. last commit & "commits" link
  201. normally above files table, moving into file navigation
  202. */
  203. .repository-content > div > div:last-child > div:first-child > *:not([id]) > .Box-header {
  204. position: absolute !important;
  205. padding: 0;
  206. top: .33rem;
  207. border: none;
  208. left: 16rem; /* space for branch selector, branches, tags */
  209. right: 21rem; /* space for Go to file, Add file, Code/clone */
  210. background-color: transparent !important;
  211. z-index: 90; /* for "..." unfolding */
  212. }
  213. /* unnecesary non-TOC "readme.md" heading box */
  214. .repository-content > div > div:last-child > div:first-child > [id="readme"] > .Box-header:first-child { display: none !important; }
  215. /* hide hash */
  216. .repository-content > div > div:last-child > div:first-child .Box-header .text-mono {
  217. display: none !important
  218. }
  219. /* reverse order so commit count ends up beside tag count */
  220. .repository-content > div > div:last-child > div:first-child .Box-header > div > :last-child {
  221. order: -1;
  222. padding-right: 1rem;
  223. }
  224. /* hide "commits" text (lave icon) (more space for last commit msg) */
  225. .repository-content > div > div:last-child > div:first-child .Box-header > div > :last-child .color-text-secondary {
  226. display: none !important;
  227. }
  228. /* hide "branches" and "tags" text (lave icons) (more space for last commit msg) */
  229. .file-navigation .color-text-tertiary{
  230. display: none;
  231. }
  232. }