blob: 3ad32aa3ea96b13d701bc99d9fed10252de65606 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
document.addEventListener("DOMContentLoaded", function(){
for (list of document.getElementsByClassName('list')) {
if (list.summary === "tree listing") {
const table = list.children[0]
const rows = table.children
// Reorder directories (and submodules) before files
// This is done here instead of during page generation for two reasons:
// 1. Implementing it in generation would be difficult, since the logic
// is done by a git function
// 2. It could be argued if your browser doesn't support javascript,
// navigation would be easier if everything is ordered normally
var lastDir = rows[1].getAttribute('summary') == '----------' ? 2 : 1
for (let i = 1; i < rows.length; ++i) {
if (!rows[i].getAttribute('summary').startsWith('-')) {
if (i > lastDir) {
table.insertBefore(rows[i], rows[lastDir])
}
++lastDir
}
}
}
}
});
|