diff options
| author | Syndamia <kamen@syndamia.com> | 2026-03-21 14:35:28 +0200 |
|---|---|---|
| committer | Syndamia <kamen@syndamia.com> | 2026-03-21 14:35:28 +0200 |
| commit | b1df31cb9fdb7ed5a639721495e8f315248c6c0f (patch) | |
| tree | b9ccd3f538e7bb02ddcdfeb704b879f3703033fb /theme_userscript.js | |
| parent | 55dcd5d261773ed083a44f1e6aa7d9a74310f88a (diff) | |
| download | cgit_theme-b1df31cb9fdb7ed5a639721495e8f315248c6c0f.tar cgit_theme-b1df31cb9fdb7ed5a639721495e8f315248c6c0f.tar.gz cgit_theme-b1df31cb9fdb7ed5a639721495e8f315248c6c0f.zip | |
feat: Reorder and rename tabs
Diffstat (limited to 'theme_userscript.js')
| -rw-r--r-- | theme_userscript.js | 41 |
1 files changed, 38 insertions, 3 deletions
diff --git a/theme_userscript.js b/theme_userscript.js index fb59555..f78b6dc 100644 --- a/theme_userscript.js +++ b/theme_userscript.js @@ -1042,10 +1042,11 @@ document.styleSheets[0].disabled = true document.head.appendChild(style) const list = document.getElementsByClassName('list')[0] -const table = list.children[0] -const rows = table.children -if (list.summary === "tree listing") { +if (list !== undefined && list.summary === "tree listing") { + const table = list.children[0] + const rows = table.children + /* Reorder directories before files */ var lastDir = 1 for (let i = 1; i < rows.length; ++i) { @@ -1076,3 +1077,37 @@ if (list.summary === "tree listing") { } } } + +const tabs = document.getElementsByClassName('tabs')[0].children[0].children[0].children[0] +if (tabs !== undefined && tabs.children.length === 7) { + const about = tabs.children[0] + const summary = tabs.children[1] + const refs = tabs.children[2] + const log = tabs.children[3] + const tree = tabs.children[4] + const commit = tabs.children[5] + const diff = tabs.children[6] + + tabs.insertBefore(tree, refs) + tabs.insertBefore(log, refs) + + about.innerText = 'README' + summary.innerText = 'Summary' + tree.innerText = 'Files' + log.innerText = 'Commits' +} +else if (tabs !== undefined && tabs.children.length === 6) { + const summary = tabs.children[0] + const refs = tabs.children[1] + const log = tabs.children[2] + const tree = tabs.children[3] + const commit = tabs.children[4] + const diff = tabs.children[5] + + tabs.insertBefore(tree, refs) + tabs.insertBefore(log, refs) + + summary.innerText = 'Summary' + tree.innerText = 'Files' + log.innerText = 'Commits' +} |
