-
Notifications
You must be signed in to change notification settings - Fork 0
/
load.html
80 lines (75 loc) · 2.57 KB
/
load.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
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Verbinde mit 5bChat by WebWarp…</title>
<style>
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
font-family: Arial, sans-serif;
}
.loading-container {
text-align: center;
}
.loading-gif {
margin-top: 20px;
}
.loading-gif img {
width: 50px; /* Kleinere Größe für das Lade-Icon */
height: 50px; /* Kleinere Größe für das Lade-Icon */
}
</style>
</head>
<body>
<div class="loading-container">
<h1>Verbindung zu 5bChat by WebWarp…</h1>
<div class="loading-gif">
<img src="loading.gif" alt="Laden...">
</div>
</div>
<script>
function fetchStatus() {
fetch('https://webwarpgames.github.io/api/chat.conf')
.then(response => {
if (!response.ok) {
throw new Error('Network response was not ok');
}
return response.text();
})
.then(data => {
parseStatus(data);
})
.catch(error => {
showError('112-4522', 'Konnte nicht zum Server verbinden. Bitte kontaktiere support@webwarp.com für Support.');
});
}
function parseStatus(data) {
const statusLine = data.match(/STATUS:([^\s]+)/);
const errorCodeLine = data.match(/ERRORCODE:(.*)/);
const messageLine = data.match(/MESSAGE:(.*)/);
if (statusLine) {
const status = statusLine[1];
if (status === 'OK') {
window.location.href = 'chat.html';
} else if (status === 'MESSAGE' && errorCodeLine && messageLine) {
const errorCode = errorCodeLine[1].trim();
const message = messageLine[1].trim();
showError(errorCode, message);
} else {
showError('Unknown', 'Unbekannter Fehler');
}
} else {
showError('Unknown', 'Fehlerhafte Antwort vom Server');
}
}
function showError(code, message) {
alert(`Fehlercode: ${code}\nBeschreibung: ${message}`);
}
setTimeout(fetchStatus, 5000);
</script>
</body>
</html>