forked from SilentArctic/silentarctic.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.mjs
More file actions
17 lines (15 loc) · 694 Bytes
/
index.mjs
File metadata and controls
17 lines (15 loc) · 694 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import core from './api/index.json' assert { type: 'json' };
import community from './api/community/index.json' assert { type: 'json' };
function createLink(file, selector) {
const dir = selector === 'core' ? '' : 'community/';
const url = `${window.location.origin}/api/${dir}${file}`
const ul = document.querySelector(`#${selector}-links`);
const li = document.createElement('li');
const anchor = document.createElement('a');
anchor.setAttribute('href', url);
anchor.innerText = file;
li.appendChild(anchor);
ul.appendChild(li);
}
Object.keys(core).forEach(file => createLink(file, 'core'));
Object.keys(community).forEach(file => createLink(file, 'community'));