-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_commands.js
42 lines (36 loc) · 1.04 KB
/
build_commands.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import { fallback, config } from "./config.js"
const createTableRow = function (name, home, aliases) {
const tr = document.createElement("tr")
const tdName = document.createElement("td")
tdName.innerHTML = `<a href="${home}" target="_blank"><strong>${name}</strong></a>`
tr.appendChild(tdName)
const tdAliases = document.createElement("td")
tdAliases.innerHTML = `<code>${aliases}</code>`
tr.appendChild(tdAliases)
return tr
}
window.onload = function () {
// fallback
const commandsTable = document.getElementById("commands-table")
commandsTable.appendChild(
createTableRow(
`Fallback: ${fallback}`,
config[fallback]["home"],
"aliases" in config[fallback] ? config[fallback]["aliases"] : []
)
)
// commands
Object.keys(config)
.sort()
.forEach((k, i) => {
if (k !== fallback) {
commandsTable.appendChild(
createTableRow(
k,
config[k]["home"],
"aliases" in config[k] ? config[k]["aliases"] : []
)
)
}
})
}