// noinspection JSUnresolvedVariable
const {$, doAfterLoad, footer, header, nav, showPage, stringToHtml} = window.fwdekker;
const unpackEntry = function (entry, depth = 0) {
const subEntries = entry.entries.length === 0
? ""
: `
` + entry.entries.map(it => unpackEntry(it, depth + 1)).join("") + `
`;
return "" +
`` +
`${entry.name}` +
subEntries +
``;
};
doAfterLoad(() => {
$("#nav").appendChild(nav("/Tools/"));
$("#header").appendChild(header({title: "Tools", description: "An overview of tools I have created"}));
$("#footer").appendChild(footer({
vcsURL: "https://git.fwdekker.com/FWDekker/tools/",
version: "v%%VERSION_NUMBER%%"
}));
showPage();
fetch("https://fwdekker.com/api/nav/")
.then(it => it.json())
.then(json => json.entries.find(it => it.name === "Tools"))
.then(json => stringToHtml(`${json.entries.map(entry => unpackEntry(entry)).join("")}
`, "ul"))
.then(listing => $("#listing").append(listing));
});