-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.html
244 lines (227 loc) · 7.43 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
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
<!DOCTYPE html>
<html>
<head>
<title>Discord UI Clone - Godot</title>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, user-scalable=no" />
<meta http-equiv="x-ua-compatible" content="ie=edge" />
<meta name="title" content="Discord UI Clone - Godot" />
<meta
name="description"
content="Clone of Discord's UI made using Godot Game Engine."
/>
<meta name="keywords" content="discord, godot, ui, game, pro ui" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="language" content="English" />
<meta name="author" content="Delano Lourenco" />
<!-- OpenGraph Tags -->
<meta property="og:title" content="Discord UI Clone - Godot" />
<meta property="og:site_name" content="Discord UI Clone - Godot" />
<meta property="og:url" content="https://discord-ui-godot.web.app" />
<meta
property="og:description"
content="Clone of Discord's UI made using Godot Game Engine."
/>
<meta property="og:type" content="website" />
<meta
property="og:image"
content="https://cdn.discordapp.com/attachments/360062738615107605/914080251502555146/DiscordClone_windows_1V7HVkM5OS.png"
/>
<!-- Twitter tags -->
<meta name="twitter:card" content="app" />
<meta name="twitter:site" content="@3ddelano" />
<meta name="twitter:description" content="Discord UI Clone - Godot" />
<!-- Favicon setup -->
<link rel="icon" type="image/png" href="/favicon.png" />
<meta name="theme-color" content="#5865F2" />
<!-- Google search -->
<meta name="google-site-verification" content="p6kpn0ibyxyJLO414X0bhvnEAaqykira1UVJZicpQ40" />
<style>
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
touch-action: none;
margin: 0;
padding: 0;
border: 0 none;
overflow: hidden;
text-align: center;
font-family: Whitney, "Helvetica Neue", Helvetica, Arial, sans-serif;
color: #fff;
background-color: #202225;
}
.text-container{
display: flex;
flex-direction: column;
align-items: center;
}
#canvas {
display: block;
margin: 0;
color: white;
}
#canvas:focus {
outline: none;
}
#status {
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
visibility: hidden;
}
#status-progressbar {
width: 200px;
background-color: #5865f2;
border-radius: 6px;
padding: 2px;
visibility: visible;
}
#status-progressbar-inner {
background-color: #ffffff;
width: 2%;
height: 4px;
border-radius: 3px;
transition: width 0.5s ease-in-out;
}
#status-spinner {
border: 3px solid #f6f6f6;
border-top: 3px solid #5865f2;
border-radius: 50%;
width: 32px;
height: 32px;
animation: spin 2s linear infinite;
visibility: visible;
}
@keyframes spin {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
#status-notice {
color: #df4759;
background-color: #f6f6f6;
font-weight: bold;
padding: 8px;
border-radius: 4px;
visibility: visible;
}
</style>
</head>
<body>
<canvas id="canvas">
HTML5 canvas appears to be unsupported in the current browser.<br />
Please try updating or use a different browser.
</canvas>
<div id="status">
<div class="text-container" style="margin-bottom: 18px; visibility: visible">
<h1>Discord UI Clone - Godot</h1>
<p style="max-width: 85%; color: rgba(255,255,255,0.75); font-size: 14px; position: absolute; bottom: 24px">This site is not Discord.com and is not affiliated with Discord Inc. We do not send any data from your local machine.</p>
</div>
<!-- Indeterminate progress -->
<div id="status-spinner" style="display: none"></div>
<!-- Determinate progress -->
<div id="status-progressbar" style="display: block;">
<div id="status-progressbar-inner"></div>
</div>
<!--- Notice -->
<p id="status-notice" style="display: none">This is a message</p>
</div>
<script src="$GODOT_URL"></script>
<script type="text/javascript">
let engine = new Engine($GODOT_CONFIG);
(function () {
const INDETERMINATE_STATUS_STEP_MS = 100;
let statusDiv = document.getElementById("status");
let statusProgress = document.getElementById("status-progressbar");
let statusProgressInner = document.getElementById(
"status-progressbar-inner"
);
let statusIndeterminate = document.getElementById("status-spinner");
let statusNotice = document.getElementById("status-notice");
let initializing = true;
let statusMode = "hidden";
function setStatusNotice(text) {
while (statusNotice.lastChild) {
statusNotice.removeChild(statusNotice.lastChild);
}
let lines = text.split("\n");
lines.forEach((line) => {
statusNotice.appendChild(document.createTextNode(line));
statusNotice.appendChild(document.createElement("br"));
});
}
function setStatusMode(mode) {
if (statusMode === mode || !initializing) return;
[statusProgress, statusIndeterminate, statusNotice].forEach(
(elem) => {
elem.style.display = "none";
}
);
switch (mode) {
case "progress":
statusProgress.style.display = "block";
break;
case "indeterminate":
statusIndeterminate.style.display = "block";
break;
case "notice":
statusNotice.style.display = "block";
break;
case "hidden":
break;
default:
throw new Error("Invalid status mode");
}
statusMode = mode;
}
function displayFailureNotice(err) {
let msg = err.message || err;
console.error(msg);
setStatusNotice(msg);
setStatusMode("notice");
initializing = false;
}
if (!Engine.isWebGLAvailable()) {
displayFailureNotice("WebGL not available");
} else {
setStatusMode("indeterminate");
engine
.startGame({
onProgress: function (current, total) {
if (total > 0) {
statusProgressInner.style.width =
(current / total) * 100 + "%";
setStatusMode("progress");
if (current === total) {
// wait for progress bar animation
setTimeout(() => {
setStatusMode("indeterminate");
}, 500);
}
} else {
setStatusMode("indeterminate");
}
},
})
.then(() => {
setStatusMode("hidden");
statusDiv.style.display = "none";
initializing = false;
}, displayFailureNotice);
}
})();
</script>
</body>
</html>