-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
48 lines (40 loc) · 2.07 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
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Bootstrap CSS -->
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG2x" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css" integrity="sha512-iBBXm8fW90+nuLcSKlbmrPcLa0OT92xO1BIsZ+ywDWZCvqsWgccV3gFoRBv0z+8dLJgyAHIhR35VZc2oM/gI1w==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<title>Usabilitydave</title>
</head>
<body>
<h1 id="title">Usabilitydave</h1>
<div id="index"></div>
<script>
(async () => {
const path = window.location.pathname.split('/')[1]
const extensions = ['xml', 'ini', 'toml', 'qml', 'sql', 'yaml']
const response = await fetch('https://api.github.com/repos/signedav/usabilitydave/contents/' + path);
const data = await response.json();
let dirHtmlString = '';
let fileHtmlString = '';
for (let file of data) {
if (file.type == 'dir') {
dirHtmlString += `<li class="list-group-item list-group-item-secondary"><span class="fa-li"><i class="far fa-folder-open"></i></span><a href="${file.name}">${file.name}</a></li>`;
continue;
}
fileExtension = file.name.substr((file.name.lastIndexOf('.') + 1));
if (extensions.indexOf(fileExtension) != -1) {
fileHtmlString += `<li class="list-group-item"><span class="fa-li"><i class="far fa-file"></i></span><a href="${file.name}">${file.name}</a></li>`;
}
}
fileHtmlString = `<ul class="fa-ul list-group">${dirHtmlString}${fileHtmlString}</ul>`;
document.getElementById('index').innerHTML = fileHtmlString;
document.getElementById('title').innerHTML += ` - ${path}`;
document.title += ` - ${path}`;
})()
</script>
</body>
</html>