From d33ca4b849af982c92394ce11b73b3ed79ec8e8e Mon Sep 17 00:00:00 2001 From: Syndamia Date: Tue, 17 Mar 2026 21:04:58 +0200 Subject: feat!: Initial development userscript To more easily test locally, this script was created. It contains both the CSS stylesheet and javascript code which result in what I want. The style is roughly based on the old GitLab one: https://gitlab.com/Syndamia/userscripts/-/blob/main/gitlab-old-dark-colors.js?ref_type=heads --- theme_userscript.js | 207 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 207 insertions(+) create mode 100644 theme_userscript.js diff --git a/theme_userscript.js b/theme_userscript.js new file mode 100644 index 0000000..dd9ee01 --- /dev/null +++ b/theme_userscript.js @@ -0,0 +1,207 @@ +// ==UserScript== +// @name DEV git.syndamia.com stylesheet +// @namespace http://tampermonkey.net/ +// @version 2026-03-17 +// @description try to take over the world! +// @author You +// @match https://git.syndamia.com/* +// @icon https://www.google.com/s2/favicons?sz=64&domain=qwant.com +// @grant none +// ==/UserScript== + +var style = document.createElement('style') + +style.textContent = ` +body, div#cgit { + margin: 0; + padding: 0; +} +div.content { + min-height: calc(100vh - 17em); + border-bottom: none !important; + padding-bottom: 4em !important; +} +div#cgit { + font-size: 11pt; + position: relative; + min-height: 100vh; +} +div.footer { + position: absolute; + bottom: 0; + width: 100vw; + border-top: solid 3px #ccc; +} +div#cgit, a { + color: #fafafa !important; +} +a[href$=".zip"], a[href$=".tar"], a[href$=".tar.gz"] { + color: #f5e16c !important; +} +body, div#cgit, tr { + background-color: #212025 !important; +} +table.list { + border-collapse: separate !important; + border-spacing: 0 !important; +} +table.list th { + background-color: #484848; + border: 1px solid #404040; + + padding: 0.5rem !important; + font-size: 1.1em; + margin: 1em 0; +} +table.list th:not(:first-child):not(last-child) { + border-left: none; + border-right: none; +} +table.list th:first-child { + border-right: none; + border-top-left-radius: 6px; +} +table.list th:last-child { + border-left: none; + border-top-right-radius: 6px; +} +table.list td { + background-color: #303030; + border-bottom: 1px solid #404040 !important; + padding: 0.25em 0.5em !important; +} +table.list td:first-child { + border-left: 1px solid #404040 !important; +} +table.list td:last-child { + border-right: 1px solid #404040 !important; +} +table.list tr.nohover > td[colspan="5"] { + background-color: initial; + border: none !important; +} +table.list td.reposection { + color: #63a6e9 !important; +} +table#header tr:first-child td { + padding-top: 0.5em; +} +table#header tr:last-child td { + padding-bottom: 2em; +} +table#header td, table.tabs td, div.footer { + background-color: #303030; +} +div.footer { + margin-top: 0 !important; + padding: 0.5em 0; +} +table#header, table.tabs { + margin: 0 !important; +} +table#header td.main, table#header td.main a { + color: #f57f6c !important; +} +table#header td.main a[href="/"] { + color: #fafafa !important; +} +div.path { + color: #fefefe !important; + background-color: #453894 !important; + padding-bottom: 5px !important; +} +table.tabs { + border-color: #5b5bbd !important; +} +table.tabs td a.active { + background-color: #5b5bbd !important; + border-top-left-radius: 4px; + border-top-right-radius: 4px; +} + +select, input { + color: #fafafa; + background-color: #428fdc; + box-shadow: inset 0 0 0 1px #63a6e9; + border: none; + border-radius: 3px; +} + +table.commit-info td, table.commit-info th, +div.commit-subject, div.commit-msg, +div.cgit-panel, div.cgit-panel table td, +div.diffstat-header, table.diffstat > tbody > tr > td, div.diffstat-summary, table.diff td { + background-color: #303030 !important; +} +table.commit-info tr:first-child td, table.commit-info tr:first-child th { + padding-top: 2em !important; +} +table.commit-info tr:last-child td, table.commit-info tr:last-child th { + padding-bottom: 2em !important; +} +table.commit-info td:first-child, table.commit-info th:first-child { + padding-left: 1em !important; +} +table.commit-info td:last-child, table.commit-info th:last-child { + padding-right: 1em !important; +} +table.commit-info tr:first-child td:first-child, table.commit-info tr:first-child th:first-child { + border-top-left-radius: 6px; +} +table.commit-info tr:first-child td:last-child, table.commit-info tr:first-child th:last-child { + border-top-right-radius: 6px; +} + +div.commit-subject { + padding: 1.5em 1em 0 1em !important; + border-top-right-radius: 6px; +} +div.commit-msg { + padding: 1.5em 1em 1em 1.25em !important; + margin-top: -1em !important; +} +div.diffstat-header, table.diffstat > tbody > tr > td, div.diffstat-summary, table.diff td { + padding: 0 1.25em !important; +} +table.diff tr:last-child td { + padding-bottom: 1em !important; +} +` + +document.head.appendChild(style) + +const list = document.getElementsByClassName('list')[0] +const table = list.children[0] +const rows = table.children + +if (list.summary === "tree listing") { + /* Reorder directories before files */ + var lastDir = 1 + for (let i = 1; i < rows.length; ++i) { + if (rows[i].children[0].innerText.startsWith('d')) { + if (i > lastDir) { + table.insertBefore(rows[i], rows[lastDir]) + } + ++lastDir + } + } + /* Human size format */ + for (const row of rows) { + if (row.children[2].classList.contains('ls-size')) { + let size = row.children[2].innerText + if (size < 1024) { + size += ' B' + } + else if (size < 1048576) { + size = (size / 1024).toFixed(1) + ' KiB' + } + else if (size < 1073741824) { + size = (size / 1048576).toFixed(1) + ' MiB' + } + else { + size = (size / 1073741824).toFixed(1) + ' GiB' + } + row.children[2].innerText = size + } + } +} -- cgit v1.2.3