summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--theme_userscript.js41
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'
+}