-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
204 lines (172 loc) · 5.16 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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
<!DOCTYPE html>
<html lang="en">
<head>
<title>othelgo</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="A command-line Othello game with online singleplayer and multiplayer.">
<style>
:root {
--bg-color: #170f2b;
--fg-color: rgb(146, 146, 146);
--accent-color: gainsboro;
--line-height: 1.25rem;
}
/* Works well with flexbox styling, allowing us to use padding. */
* {
box-sizing: border-box;
}
html {
font-size: 12pt;
}
html, body {
height: 100%;
margin: 0;
}
body {
background: var(--bg-color);
color: var(--fg-color);
font-family: "Source Code Pro", monospace;
display: flex;
flex-direction: column;
align-items: center;
}
header {
user-select: none;
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
padding: var(--line-height);
}
.banner {
margin: 0;
font-size: smaller;
color: var(--accent-color);
text-shadow: 0 0 2px var(--accent-color), 0 0 5px var(--accent-color);
cursor: default;
font-family: inherit;
}
main {
flex: 1;
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
padding: 0 var(--line-height);
}
footer {
width: 100%;
display: flex;
justify-content: flex-end;
padding: var(--line-height);
}
.button {
color: inherit;
text-decoration: inherit;
white-space: nowrap;
user-select: none;
}
.button:hover {
background: var(--accent-color);
color: var(--bg-color);
cursor: pointer;
}
::selection {
color: var(--bg-color);
background: var(--accent-color);
}
#checksum {
overflow-wrap: anywhere;
font-size: smaller;
}
p {
margin: var(--line-height) 0;
}
/*
Responsive CSS
Breakpoints borrowed from Bootstrap: https://getbootstrap.com/docs/4.1/layout/overview/#responsive-breakpoints
*/
/* Small devices (landscape phones) */
@media (min-width: 576px) {
html {
font-size: 14pt;
}
.banner {
font-size: inherit;
}
}
/* Medium devices (tablets) */
@media (min-width: 768px) {
html {
font-size: 18pt;
}
}
/* Large devices (desktops) */
@media (min-width: 992px) {
html {
font-size: 22pt;
}
.banner {
padding-top: calc(2 * var(--line-height));
}
}
/* Extra large devices (large desktops) */
@media (min-width: 1200px) {
#checksum {
font-size: inherit;
}
}
</style>
</head>
<body>
<header>
<pre class="banner">
_ _ _
___ | |_| |__ ___| | __ _ ___
/ _ \| __| '_ \ / _ \ |/ _` |/ _ \
| (_) | |_| | | | __/ | (_| | (_) |
\___/ \__|_| |_|\___|_|\__, |\___/
|___/</pre>
</header>
<main>
<a class="button" id="download" onclick="downloading()">[ Download ]</a>
<p id="checksum" hidden></p>
</main>
<footer>
<a class="button" href="https://github.com/armsnyder/othelgo">[ GitHub ]</a>
</footer>
<script>
const platform = window.navigator.platform.toLowerCase();
let os;
if (platform.includes('linux')) {
os = 'linux'
} else if (platform.includes('mac')) {
os = 'darwin'
} else if (platform.includes('win')) {
os = 'windows'
} else {
alert("Unsupported platform: " + platform)
console.log("Unsupported platform: " + platform)
}
let checksum;
fetch('/dist/checksums.txt')
.then(response => response.text())
.then(checksums => {
const re = RegExp(`(?<sum>\\w+)\\s+(?<file>othelgo_(?<version>.+)_${os}_(?:x86_64|amd64).tar.gz)`, 'i')
const match = checksums.match(re);
if (match) {
const {groups} = match;
checksum = groups['sum'];
document.getElementById("download").href = `https://github.com/armsnyder/othelgo/releases/download/v${groups['version']}/${groups['file']}`
}
})
.catch(console.error);
function downloading() {
const el = document.getElementById("checksum");
el.hidden = false;
el.innerHTML = `Checksum: ${checksum}`;
}
</script>
</body>
</html>