From b1df31cb9fdb7ed5a639721495e8f315248c6c0f Mon Sep 17 00:00:00 2001 From: Syndamia Date: Sat, 21 Mar 2026 14:35:28 +0200 Subject: feat: Reorder and rename tabs --- theme_userscript.js | 41 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 3 deletions(-) (limited to 'theme_userscript.js') 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' +} -- cgit v1.2.3