-
Notifications
You must be signed in to change notification settings - Fork 24
/
index.html
42 lines (40 loc) · 1.55 KB
/
index.html
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
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>SystemJS examples</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<script>
if (window.location.origin.includes('github.io')) {
document.write('<base href="/systemjs-examples/">');
}
</script>
</head>
<body>
<h1>SystemJS Examples</h1>
<p>
This website is a live demo of a variety of SystemJS applications and use cases.
</p>
<script>
(async () => {
const directories = await(await fetch('https://api.github.com/repos/systemjs/systemjs-examples/contents')).json()
directories.filter(dir => dir.type === 'dir').forEach(async function(dir) {
const exampleDirs = await(await fetch(`https://api.github.com/repos/systemjs/systemjs-examples/contents/${dir.name}`)).json()
addExamples(dir.name, exampleDirs)
})
function addExamples(prefixDir, examples) {
const containerEl = document.createElement('section')
const header = Object.assign(document.createElement('h2'), {textContent: prefixDir})
containerEl.appendChild(header)
examples.filter(example => example.type === 'dir').forEach(example => {
const li = document.createElement('li')
li.appendChild(Object.assign(document.createElement('a'), {href: `${prefixDir}/${example.name}/`, textContent: example.name}))
containerEl.appendChild(li)
})
document.body.appendChild(containerEl)
}
})()
</script>
</body>
</html>