-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
100 lines (90 loc) · 2.87 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>格雷新视界流程图</title>
<style>
* {
margin: 0;
}
html {
width: 100%;
height: 100%;
font-size: 18px;
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}
body {
width: 100%;
height: 100%;
}
a {
color: #16161D;
text-decoration: none;
}
a:hover {
text-decoration: underline dotted 0.1rem;
text-underline-offset: 0.5rem;
}
#container {
margin: 0 auto;
height: 100%;
width: 50vw;
}
#credit {
position: absolute;
width: 50%;
bottom: 0;
text-align: center;
}
.item {
display: block;
position: relative;
counter-increment: step-counter;
margin: 0.6rem;
}
.item:before {
color: #AAA;
content: counter(step-counter) '. ';
position: absolute;
right: 100%;
top: 50%;
transform: translateY(-50%);
}
</style>
</head>
<body>
<div id="container">
<h1><a href="https://github.com/Taskeren/gtnh-flowchart-cn">格雷新视界流程图</a></h1>
<div id="file-list">
</div>
<div id="credit">2024 © Taskeren。项目以 CC BY-NC 协议开源。</div>
</div>
<script>
const container = document.getElementById('file-list');
(async function() {
const response = await fetch('https://api.github.com/repos/Taskeren/gtnh-flowchart-cn/contents/')
const data = await response.json()
console.log(data)
if(data.message && data.message.startsWith("API rate limit exceeded")) {
container.innerHTML += "<em>您的访问次数超过 Github API 限制了,请过会再来吧。</em>"
return
}
if(data.length == 0) {
container.innerHTML += "<em>空</em>"
return
}
for (const item of data) {
if(item.name.endsWith(".drawio")) {
/** @type string */
const srcName = item.name
/** @type string */
const svgName = srcName.substring(0, srcName.length - 7) + ".svg"
console.log(`Listed ${svgName}(${srcName})`)
container.innerHTML += `<a class="item" href="${svgName}">${svgName}</a>`
}
}
})()
</script>
</body>
</html>