-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
27 lines (25 loc) · 896 Bytes
/
index.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
(async function () {
const linksContainer = document.querySelector('#links');
const script = document.querySelector('script');
if (!linksContainer || !script) return;
let links = [];
try {
const response = await fetch('./entry-point.json');
const { entryPointsHtml } = await response.json();
links.push(...entryPointsHtml);
} catch (err) {
console.log(err)
}
if (links.length === 0) return;
const unorderedList = document.createElement('ul');
links.forEach(link => {
const listItem = document.createElement('li');
const anchorTag = document.createElement('a');
anchorTag.setAttribute('href', link.href);
anchorTag.innerText = link.folder;
listItem.append(anchorTag);
unorderedList.append(listItem);
})
linksContainer.append(unorderedList);
script.remove();
}());