-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
106 lines (97 loc) · 3.48 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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Сервер Liberty онлайн</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<meta name="description" content="Сервер Liberty онлайн статус">
<style>
body {
background-color: #f5f5f5;
}
#serverInfo {
text-align: center;
margin: 0 auto;
width: 80%;
padding: 20px;
background-color: rgba(255, 255, 255, 0.9);
border-radius: 10px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
}
#serverInfo .alert {
color: #333;
margin-top: 15px;
padding: 10px;
border-radius: 5px;
font-size: 16px;
border: 2px solid transparent;
}
h1 {
margin-top: 20px;
text-align: center;
}
.container {
margin-top: 20px;
}
#loading {
font-size: 18px;
display: block;
text-align: center;
margin-top: 20px;
animation: blink 1s linear infinite;
}
@keyframes blink {
0%, 100% {
opacity: 0;
}
50% {
opacity: 1;
}
}
</style>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script>
$(function() {
var serverInfo = $("#serverInfo");
var loading = $("#loading");
setInterval(function() {
loading.show();
$.ajaxSetup({
cache: false
});
$.ajax({
url: 'https://cdn.rage.mp/master/',
success: function(data) {
loading.hide();
var serverData = JSON.parse(data);
var targetServer = serverData['s1.arizona-v.com:22005'];
if (targetServer) {
var onlinePlayers = targetServer.players;
if (onlinePlayers > 0) {
serverInfo.html("<div class='alert alert-success' role='alert'>Сервер Liberty онлайн. Игроков онлайн: " + onlinePlayers + "</div>");
} else {
serverInfo.html("<div class='alert alert-danger' role='alert'>Сервер Liberty оффлайн. Нет игроков онлайн.</div>");
}
} else {
serverInfo.html("<div class='alert alert-danger' role='alert'>Сервер Liberty не найден в массиве (Возможно отключен)</div>");
}
},
error: function() {
loading.hide();
serverInfo.html("<div class='alert alert-danger' role='alert'>Ошибка при получении данных.</div>");
}
});
}, 700);
});
</script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css">
</head>
<body>
<div class="container mt-5">
<h1>Сервер Liberty онлайн</h1>
<section id="serverInfo">
<div id="loading">Получаю данные...</div>
</section>
</div>
</body>
</html>