GitHub - single-column repository page with important info on the top

Pulls Readme above files list and moves sidebar content as foremost horizontal row before content.

  1. /* ==UserStyle==
  2. @name GitHub - single-column repository page with important info on the top
  3. @namespace myfonj
  4. @version 1.17.6
  5. @description Pulls Readme above files list and moves sidebar content as foremost horizontal row before content.
  6. @author myf
  7. @license CC0
  8. ==/UserStyle== */
  9. @-moz-document domain("github.com") {
  10. /*
  11. https://userstyles.world/style/5069/github-repository-page-in-single-column-with-important-info-on-the-top
  12. https://greasyfork.org/en/scripts/406729/versions/new
  13. Changelog
  14. 1.17.6 (2024-11-27) - Issues new structure.
  15. 1.17.5 (2024-08-29) - Commits counts first before last commint details.
  16. 1.17.4 (2024-08-20) - Fix untrucated naked link in sponsor box.
  17. 1.17.3 (2024-08-13) - Fix narrow "sidebar" width in "new issue" (and presumably elsewhere).
  18. 1.17.2 (2024-07-03) - Fix broken header width (my fault, sorry folks).
  19. 1.17.1 (2024-06-21) - Fix "last commit" content order: count and "last" to the start.
  20. 1.17.0 (2024-05-30) - Also for pull request conversations
  21. 1.16.3 (2024-04-05) - Issue Notification button box fixed width, so it will not cause shift after init.
  22. 1.16.2 (2024-04-04) - Flex-shrink for the issues header; allows wrapping content inside items, but will not overflow.
  23. 1.16.1 (2024-04-03) - Max-width for labels in issues
  24. 1.16.0 (2024-03-26) - Preliminary support for single-column discussions.
  25. 1.15.3 (2024-03-23) - Issue comment header content narrower, to match max line length better
  26. 1.15.2 (2024-03-21) - Better align with issues header
  27. 1.15.1 (2024-03-21) - Issues Subscription reason prose into hover/focus popup to reduce height
  28. 1.15.0 (2024-03-20) - Preliminary single-columning of Issue pages
  29. 1.14.1 (2024-03-12) - "Last commit" back left.
  30. 1.14.0 (2024-02-28) - shrink "contributors" and "used by" lists' height, unless hovered
  31. 1.13.0 (2024-02-14) - adapt to a new structure, yet again
  32. 1.12.4 (2023-12-13) - fix last commit "…" more info dropdown position
  33. 1.12.3 (2023-12-13) - total commit count and last commit time pulled to the left edge
  34. 1.12.2 (2023-12-12) - also rushed pulling of "last commit" info, for now above readme - license - (...) - edit - menu line
  35. 1.12.0 (2023-12-12) - rushed hotfix for new main content structure, readme is back up. Ton of dead code remains.
  36. 1.11.1 (2023-11-15) - restore compacting stuff under tags (license, CoC, ... icons) after structure change (new wrapper)
  37. 1.11.0 (2023-09-25) - Hide redundant ☆ / 👁 / 🜉 + counts under tags.
  38. 1.10.0 (2023-09-25) - Hide "No releases published" / "No packages published" boxes
  39. 1.9.4 (2023-09-20) - prevent links under tags wrapping between words
  40. 1.9.3 (2023-09-07) - wider "About" box, narrower rest, icons-(+ counts)-only footer
  41. 1.9.2 (2023-08-15) - max-width for header
  42. 1.9.1 (2023-07-13) - fix superfluous line break in resources (`include-fragment`)
  43. 1.9.0 (2023-06-22) - readme pulled to top even on subpages; requires modern Chromium or Firefox with `layout.css.has-selector.enabled` pref
  44. 1.8.4 (2023-03-03) - hopefuly applied even for "turbopages"
  45. 1.8.3 (2022-08-11) - just name and info changes
  46. */
  47. /* just for categorization */
  48. /* … and this little photo zoom */
  49. .Popover .avatar-user {
  50. min-width: 240px;
  51. min-height: 240px;
  52. /* image-rendering: crisp-edges */
  53. }
  54. /* make transparent avatars more contrasting */
  55. .avatar-user {
  56. filter:drop-shadow(0 0 1px canvastext)
  57. }
  58. /* … and pulling the readme at code pages deeper */
  59. main div:has(> #readme) {
  60. /* wohohoo, new era of usestyling just arrived. */
  61. order: -1;
  62. }
  63. }
  64.  
  65. @-moz-document regexp("^https?://github.com/[^?#]*?/(discussions|pull)/.*") {
  66. /*
  67. § Discussions: pull sidebar up as well
  68. gosh, why every page has completely different layout structure??
  69. */
  70. #discussion_bucket {
  71. :has(#partial-discussion-header) {
  72. order: -2;
  73. }
  74. #partial-discussion-sidebar {
  75. order: -1;
  76. display: flex;
  77. width: 100%;
  78. gap: 2ch;
  79. .discussion-sidebar-item {
  80. margin: 0;
  81. padding: 0;
  82. border: none;
  83. }
  84. & create-branch {
  85. /*
  86. shrinking long "Successfully merging this pull request may close these issues."
  87. */
  88. max-width: 25ch
  89. }
  90. }
  91. }
  92. }
  93. @-moz-document regexp("^https?://github.com/[^?#]*?/(issues|pull)/.*") {
  94. /*
  95. § Issue: pull sidebar up as well
  96. */
  97. [data-testid="issue-viewer-metadata-container"] {
  98. width: auto;
  99. }
  100. *:has(> [data-testid="issue-viewer-metadata-container"]) {
  101. flex-direction: column-reverse;
  102. & [data-testid="issue-viewer-metadata-pane"] {
  103. display: flex !important;
  104. flex-direction: row
  105. }
  106. }
  107. /*
  108. § Old issues structure, not used as of 2024-11-27 (deleteme)
  109. */
  110. .Layout {
  111. display: flex;
  112. flex-direction: column-reverse;
  113. --Layout-sidebar-width: none;
  114. & > .Layout-sidebar {
  115. --Layout-sidebar-width: none;
  116. & > * {
  117. display: flex;
  118. flex-direction: row;
  119. gap: 3ch;
  120. & > *.discussion-sidebar-item {
  121. margin-top: -34px;
  122. flex-grow: 1;
  123. flex-shrink: 1;
  124. &:has(>.participation),
  125. &:has(>.js-issue-labels) {
  126. /* * /flex-shrink: 1 !important; /* */
  127. }
  128. &.sidebar-notifications {
  129. order: 1;
  130. flex-grow: 0;
  131. flex-shrink: 0;
  132. flex-basis: 12em;
  133. min-width: 12em;
  134. position: relative;
  135. & #notification-subscribe-button-reason {
  136. position: absolute;
  137. top: calc(100% + 2ch);
  138. background-color: var(--bgColor-default, var(--color-canvas-default));
  139. z-index: -1;
  140. opacity: 0;
  141. padding: 2ch;
  142. margin: -2ch;
  143. }
  144. &:is(:hover,:focus-within) #notification-subscribe-button-reason {
  145. z-index: 0;
  146. opacity: 1;
  147. }
  148. }
  149. }
  150. }
  151. }
  152. }
  153. /*
  154. § limit comment line length (crude preliminary)
  155. */
  156. .comment-body {
  157. & p,
  158. & > :is(ul,ol) > li {
  159. max-width: 80ch
  160. }
  161. }
  162. /*
  163. § limit comment header content length, so it does not dangle
  164. */
  165. .timeline-comment-header {
  166. justify-content: left;
  167. h3 { max-width: 80ch !important}
  168. }
  169. /*
  170. § REVIEW sweep reactions aside so they do not add vertical space?
  171. it seems it is not possible to make them vertical
  172. since they watch width and collapse them to button when narrow (?)
  173. */
  174. :has(>.pr-review-reactions) {
  175. > .pr-review-reactions {
  176. > .comment-reactions{
  177. }
  178. .js-comment-reactions-options{
  179. }
  180. }
  181. }
  182. /*
  183. § swipe reactions to the, if available
  184. */
  185. }
  186.  
  187.  
  188. @-moz-document regexp("^https?://github.com/(?!password_reset|settings)([^#?/]+)/([^#?/]+)/?([#?].*)?$") {
  189. /*
  190. examples
  191. https://github.com/mmulet/code-relay
  192. few contributors, many columns
  193. https://github.com/mozilla/readability
  194. used by ..
  195. https://github.com/GoogleChromeLabs/dark-mode-toggle
  196. many tags, much everything
  197. https://github.com/WebReflection/sqlite-worker
  198. five columns
  199. https://github.com/rilwis/bamboo
  200. fork, just two columns
  201. https://github.com/mozilla/standards-positions
  202. no about, no tags
  203. https://github.com/mcmilk/7-Zip-zstd/
  204. sponsor
  205. https://github.com/clauseggers/Playfair
  206. super long sponsor naked URL
  207. https://github.com/mdn/mdn-minimalist
  208. no readme TOC
  209. `.repository-content` class is actually unreliable, since it is not present for ajaxified turbonavigations
  210. using `#repository-container-header + *` instead
  211. that `*` seems like
  212. <turbo-frame id="repo-content-turbo-frame" target="_top" data-turbo-action="advance" class="">
  213. <div id="repo-content-pjax-container" class="repository-content ">
  214. */
  215. /* header block nentred
  216. */
  217. .AppHeader > * {
  218. max-width: 1280px;
  219. margin: auto;
  220. }
  221. /* unify main max width and centering of the main blocks
  222. */
  223. main > div {
  224. max-width: none !important;
  225. max-width: 80rem !important;
  226. max-width: 90rem !important;
  227. margin-left: auto;
  228. margin-right: auto;
  229. }
  230. /* main "columns" wrapper (files | sidebar) - convert to reversed rows */
  231. #repository-container-header + * .Layout {
  232. display: flex !important;
  233. flex-direction: column-reverse !important;
  234. }
  235. /* Files, Sidebar - now rows*/
  236. #repository-container-header + * .Layout > div {
  237. width: auto;
  238. }
  239. /*
  240. main column - wrapper of:
  241. - file navigation (branches, tags left, goto, file right)
  242. - files (moved to bottom, except for 1. "row" with latest commit positioned to file navigation)
  243. - readme (moved under file navigation)
  244. */
  245. #repository-container-header + * .Layout > .Layout-main {
  246. position: relative;
  247. display: flex;
  248. flex-direction: column;
  249. }
  250. #repository-container-header + * .Layout > .Layout-main > .file-navigation {
  251. order: -2;
  252. }
  253. /*
  254. Readme - move before files files
  255. there are two kinds of readme blocks:
  256. - "fancy" readme-toc component with kebab menu of headings (introduced around 2021-03-26)
  257. - see e.g. https://github.com/SerenityOS/serenity
  258. - "normal" div#readme
  259. - see e.g. https://github.com/mozilla/readability
  260. */
  261. #repository-container-header + * .Layout > .Layout-main > readme-toc,
  262. #repository-container-header + * .Layout > .Layout-main > #readme {
  263. order: -1;
  264. }
  265. /* sticky "README.md" heading / TOC box make simple button */
  266. #repository-container-header + * .Layout > .Layout-main > readme-toc > #readme > :first-child {
  267. display: inline-flex !important;
  268. border: none !important;
  269. background-color: transparent !important/**/
  270. }
  271. /* "readme.md" label/link heading after TOC button: hide */
  272. #repository-container-header + * .Layout > .Layout-main > readme-toc > #readme > :first-child h2 {
  273. display: none;
  274. }
  275. /* actual readme box: push up into place freed by heading / TOC box */
  276. #repository-container-header + * .Layout > .Layout-main > readme-toc > #readme > :last-child {
  277. margin-top: -3rem
  278. }
  279. /* readme - line length limit (originnaly 1012px through .container-lg) */
  280. #repository-container-header + * .Layout > .Layout-main > readme-toc > #readme article.markdown-body.entry-content {
  281. max-width: 80ch;
  282. }
  283. /*
  284. sidebar - now top content
  285. for god's sake, THIS div should be MAIN and should be near H1 or something
  286. not suffocated at the end of the document in sidebar
  287. */
  288. #repository-container-header + * .Layout > .Layout-sidebar > div {
  289. display: flex;
  290. flex-direction: row;
  291. /* let's try without
  292. flex-wrap: wrap;
  293. now */
  294. padding-bottom: 1rem;
  295. }
  296. /* all main flex items (about .. languages)*/
  297. #repository-container-header + * .Layout > .Layout-sidebar > div > * {
  298. flex-grow: 1;
  299. flex-shrink: 1;
  300. flex-basis: 0;
  301. border-left: 1px solid var(--color-border-secondary);
  302. border-left: none;
  303. padding-left: .5rem;
  304. padding-right: .5rem;
  305. padding-bottom: 1rem;
  306. }
  307. /*
  308. first "about" cell
  309. */
  310. #repository-container-header + * .Layout > .Layout-sidebar > div:first-child > div:first-child {
  311. flex-basis: 50ch;
  312. flex-grow: 2;
  313. max-width: 80ch;
  314. border-left: none;
  315. padding-left: 0;
  316. }
  317. /* 📖 Readme ⚖️ License : condense, icons-(+ counts)-only footer */
  318. /* those h3 are .sr-only, preceding divs and `include-fragment` */
  319. #repository-container-header + * .Layout > .Layout-sidebar > div:first-child > div:first-child > div h3 ~ * {
  320. display: inline;
  321. font-size: 0;
  322. line-height: 1rem;
  323.  
  324. & strong,
  325. & a[href$="/LICENSE"],
  326. & a:not(:has(svg)) {
  327. font-size: 1rem;
  328. white-space: nowrap !important;
  329. }
  330. &:has(svg)::after {
  331. content: '\A0';
  332. font-size: 1rem;
  333. }
  334. /*
  335. Hide redundant ☆ / 👁 / 🜉 + counts under tags.
  336. They are present in the header already, and better.
  337. */
  338. &:has( a[href$="/stargazers"],
  339. a[href$="/watchers"],
  340. a[href$="/forks"]) {
  341. display: none !important
  342. }
  343. }
  344. /* unnecessary 🔗 link icon, may cause wrap, hide */
  345. #repository-container-header + * .Layout > .Layout-sidebar > div:first-child > div:first-child .octicon-link {
  346. display: none;
  347. }
  348. /* last "(programming) languages" cell */
  349. #repository-container-header + * .Layout > .Layout-sidebar > div:first-child > div:last-child {
  350. /*
  351. flex-shrink: 100;
  352. flex-grow: 0;
  353. /* let's try without limiting */
  354. }
  355. /* Contributors "grid" min three in rows (to not get a two or single row skyscraper) */
  356. #repository-container-header + * .Layout > .Layout-sidebar > div:first-child h2 + ul {
  357. min-width: 8rem !important;
  358. }
  359. /* no border nor paddings */
  360. #repository-container-header + * .Layout > .Layout-sidebar > div > div > div {
  361. border: none;
  362. padding: 0;
  363. }
  364. /* headings */
  365. #repository-container-header + * .Layout > .Layout-sidebar > div > div > div > h2,
  366. #repository-container-header + * .Layout > .Layout-sidebar > div > div > div > h2 > a {
  367. white-space: nowrap !important;
  368. }
  369. /* tags in about cell - restack and dim */
  370. #repository-container-header + * .Layout > .Layout-sidebar > div:first-child > div .f6:not(:hover) {
  371. opacity: 0.5;
  372. }
  373. #repository-container-header + * .Layout > .Layout-sidebar > div:first-child > div .f6 {
  374. display: flex;
  375. flex-wrap: wrap;
  376. }
  377. #repository-container-header + * .Layout > .Layout-sidebar > div:first-child > div .f6 > * {
  378. flex-grow: 1;
  379. text-align: center;
  380. }
  381. /* "used by 108" - make 8 avatars wrap */
  382. .hx_flex-avatar-stack {
  383. flex-wrap: wrap;
  384. max-width: 10rem;
  385. padding-right: .8rem;
  386. }
  387. /* allowing wrap of counter under "used by" avatars */
  388. #repository-container-header + * .Layout > .Layout-sidebar > div:first-child > div .d-flex.flex-items-center {
  389. flex-wrap: wrap;
  390. }
  391. /*
  392. un-truncating everything to allow wrapping of long (esp. in "releases" cell
  393. affects "releases", but whatever
  394. */
  395. #repository-container-header + * .Layout > .Layout-sidebar > div > * * {
  396. white-space: normal !important;
  397. }
  398. /* un-flexing latest release */
  399. #repository-container-header + * .Layout > .Layout-sidebar > div > * .Link--primary.d-flex * {
  400. display: block !important
  401. }
  402.  
  403. /* superfluous link icon in "sponsor this project" */
  404. #repository-container-header + * .Layout > .Layout-sidebar > div > * [style="min-width:32px;height:32px;"] {
  405. display: none !important;
  406. & + * {
  407. /*
  408. Naked "sponsor" link:
  409. As we are un-trucatining this content, we have to fix it back.
  410. Instad of ellipsis, let it just break to lines.
  411. Break all looks better, but with this one the host stands out better.
  412. */
  413. word-break: break-word;
  414. }
  415. }
  416. /* environments "active" tag below text */
  417. #repository-container-header + * .Layout > .Layout-sidebar > div > * h2 + .list-style-none li .Label {
  418. display: block;
  419. }
  420.  
  421. /*
  422. § Hide "No releases published" / "No packages published" boxes.
  423. */
  424. #repository-container-header + * .Layout > .Layout-sidebar > div > div.BorderGrid-row:has( > .BorderGrid-cell:only-child > h2:first-child/* :has( a[href$="/releases"]) */
  425. + div.text-small.color-fg-muted:last-child) {
  426. display: none;
  427. }
  428.  
  429. /*
  430. § contributors tentatively wider
  431. */
  432. .BorderGrid-row:has(h2 :link[href$="/contributors"]) {
  433. flex-basis: 25% !important;
  434. xflex-grow: 40;
  435. xflex-shrink: 30;
  436. xoutline: #0FF6 solid;
  437. xoutline-offset: -2px;
  438. }
  439.  
  440. /*
  441. § shrink "contributors" and "used by" lists' height, unless hovered
  442. */
  443. .BorderGrid-cell ul {
  444. max-height: 100vh;
  445. transition-property: max-height, overflow;
  446. transition-duration: 200ms;
  447. transition-delay: 500ms;
  448. overflow: hidden;
  449. }
  450. .BorderGrid-cell ul:not(:hover) {
  451. max-height: 5rem !important;
  452. }
  453.  
  454. /* unnecesary non-TOC "readme.md" heading box */
  455. #repository-container-header + * .Layout > .Layout-main > [id="readme"] > .Box-header:first-child {
  456. display: none !important;
  457. }
  458. /* hide hash */
  459. #repository-container-header + * .Layout > .Layout-main .Box-header .text-mono {
  460. display: none !important
  461. }
  462. /* reverse order so commit count ends up beside tag count */
  463. #repository-container-header + * .Layout > .Layout-main .Box-header > div > :last-child {
  464. order: -1;
  465. padding-right: 1rem;
  466. }
  467. /* hide "commits" text (lave icon) (more space for last commit msg) */
  468. #repository-container-header + * .Layout > .Layout-main .Box-header > div > :last-child .color-text-secondary {
  469. display: none !important;
  470. }
  471. /* hide "branches" and "tags" text (lave icons) (more space for last commit msg) */
  472. .file-navigation .color-text-tertiary {
  473. display: none;
  474. }
  475. /*
  476. hide word "commits", "tags", "branches" after counts
  477. */
  478. svg[aria-hidden="true"]:first-child + strong:not(:hover) + span:last-child {
  479. font-size: 0;
  480. }
  481. svg[aria-hidden="true"]:first-child + span:last-child:not(:hover) > strong:first-child + span:last-child {
  482. font-size: 0;
  483. }
  484.  
  485. /*
  486. (just trying) see wide tables without scrolling them
  487. */
  488. .markdown-body table {
  489. overflow: visible;
  490. }
  491.  
  492.  
  493. /**
  494. 2023-12-11
  495. new structure, totally turdy
  496. rushed hotfix
  497. readme first
  498. **/
  499. [data-selector="repos-split-pane-content"] {
  500. margin: 0;
  501. max-width: none;
  502. & div:has(>div>h2#folders-and-files) {
  503. order: 1;
  504. }
  505. }
  506.  
  507.  
  508. /*
  509. "last commit" info: pull between header and readme
  510. */
  511. table[aria-labelledby="folders-and-files"] > tbody > tr:first-child > td:only-child > div:has([data-testid="latest-commit"]) {
  512. position: absolute;
  513. top: -2.2rem;
  514. left: 0rem;
  515. padding-inline: 0;
  516. /*
  517. commit count and "Last commit" to the start
  518. */
  519. & > :has([data-testid="latest-commit-details"]) {
  520. order: -1;
  521. & relative-time,
  522. & :has(>[aria-label="Commit history"]),
  523. & [aria-label="Commit history"] {
  524. order: -2;
  525. color: var(--color-fg-default);
  526. font-weight: 600;
  527. }
  528. [data-testid="latest-commit-details"] {
  529. order: 1;
  530. }
  531. }
  532. /*
  533. that "~more info" dropdown opened by "…" button
  534. */
  535. & + div {
  536. position: absolute;
  537. top: 0;
  538. right: 20%;
  539. max-width: 80%;
  540. }
  541. /*
  542. fix separators and spacing
  543. */
  544. & [aria-label="Commit history"] {
  545. margin-left: -12px;
  546. }
  547. & :has(> relative-time) {
  548. /* removing the ' · ' */
  549. font-size: 0;
  550. /* and put it back; */
  551. & > * {
  552. font-size: var(--body-font-size, 0.875rem);
  553. }
  554. & relative-time {
  555. &::before,
  556. &::after {
  557. color: var(--color-fg-muted);
  558. font-weight: normal;
  559. }
  560. &::before {
  561. content: 'Last commit: ';
  562. }
  563. &::after {
  564. content: '; ';
  565. }
  566. }
  567. }
  568. }
  569.  
  570. /*
  571. 2024-02-13 new structure again, "yaaaay".
  572. */
  573. [partial-name="repos-overview"] {
  574. & > * > * > * {
  575. display: flex;
  576. & > *:has([id="folders-and-files"]) {
  577. order: 1;
  578. }
  579. }
  580. }
  581.  
  582. /* END */
  583. }