-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
67 lines (62 loc) · 2 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<!DOCTYPE html>
<html>
<head>
<meta
http-equiv="Content-Type"
content="text/html; charset=utf-8"
/>
<title>Archived Sampled Pages</title>
<style>
body {
font-family: sans-serif;
font-size: 1.2em;
margin: 2rem;
}
ul {
list-style-type: none;
padding-left: 0;
}
li {
display: block;
line-height: 2rem;
border-bottom: 1px solid #ccc;
}
a {
text-decoration: none;
color: blue !important;
font-size: 14px;
}
a:hover {
text-decoration: underline;
}
</style>
</head>
<body>
<script>
(async () => {
const response = await fetch(
`https://api.github.com/repos/${
location.hostname.match(/(.*)\.github\.io/)[1]
}${location.pathname.match(/\/.*\//)[0]}contents/`,
);
const files = await response.json();
const listElement = document.createElement('ul');
for (const file of files) {
if (file.name != 'index.html') {
const itemElement = document.createElement('li');
const linkElement = document.createElement('a');
linkElement.href = file.path;
linkElement.textContent = file.name;
linkElement.target = '_blank';
itemElement.appendChild(linkElement);
listElement.appendChild(itemElement);
}
}
document.body.appendChild(listElement);
})();
</script>
<body>
<h1>Directory Listing</h1>
</body>
</body>
</html>