33 lines
1.2 KiB
JavaScript
33 lines
1.2 KiB
JavaScript
import {$, doAfterLoad, footer, header, nav} from "@fwdekker/template";
|
|
import h from "hyperscript";
|
|
|
|
|
|
const unpackEntry = function (entry, depth = 0) {
|
|
return h("li",
|
|
h(`h${depth + 4}`, h("a", {href: entry.link, innerHTML: entry.name})),
|
|
entry.entries.length === 0 ? undefined : h("ul", entry.entries.map(it => unpackEntry(it, depth + 1)))
|
|
);
|
|
};
|
|
|
|
|
|
doAfterLoad(() => {
|
|
$("#nav").appendChild(nav());
|
|
$("#header").appendChild(header({title: "Tools", description: "An overview of tools I have created"}));
|
|
$("#footer").appendChild(footer({
|
|
author: "Felix W. Dekker",
|
|
authorURL: "https://fwdekker.com/",
|
|
license: "MIT License",
|
|
licenseURL: "https://git.fwdekker.com/FWDekker/tools/src/branch/master/LICENSE",
|
|
vcs: "git",
|
|
vcsURL: "https://git.fwdekker.com/FWDekker/tools/",
|
|
version: "v%%VERSION_NUMBER%%"
|
|
}));
|
|
$("main").style.display = null;
|
|
|
|
fetch("https://fwdekker.com/api/nav/")
|
|
.then(it => it.json())
|
|
.then(json => json.entries.find(it => it.name === "Tools"))
|
|
.then(json => h("ul", json.entries.map(entry => unpackEntry(entry))))
|
|
.then(listing => $("#listing").append(listing));
|
|
});
|