-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
184 lines (147 loc) · 5.87 KB
/
Copy pathscript.js
File metadata and controls
184 lines (147 loc) · 5.87 KB
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
// API FETCH-Start
const SOYUZ_SERVER = atob('MTg1Ljk3LjI1NS4xNzoxMjE1');
const API_URL = `http://${SOYUZ_SERVER}/status`;
const REFRESH_INTERVAL = 5000;
const playersCount = document.getElementById('players-current');
const serverStatus = document.getElementById('server-status');
const serverRound = document.getElementById('server-round');
const serverMap = document.getElementById('server-map');
const serverIp = document.getElementById('server-ip');
const serverPreset = document.getElementById('server-preset');
async function fetchServerStatus() {
try {
const proxyUrl = `https://api.allorigins.win/get?url=${encodeURIComponent(API_URL)}`;
const response = await fetch(proxyUrl, {
method: 'GET'
});
if (!response.ok)
throw new Error(`HTTP ${response.status}`);
const data = await response.json();
if (!data.contents)
throw new Error('Нет полученной информации от прокси');
const serverData = JSON.parse(data.contents);
playersCount.textContent = `${serverData.players} из ${serverData.soft_max_players}` || '—';
serverRound.textContent = serverData.round_id || '—';
serverMap.textContent = serverData.map || '—';
serverPreset.textContent = serverData.preset || '—';
serverIp.textContent = SOYUZ_SERVER;
serverStatus.textContent = 'Онлайн';
serverStatus.style.color = '#03da39';
} catch (error) {
console.error('Ошибка запроса:', error);
updateOfflineState();
}
}
function updateOfflineState() {
playersCount.textContent = '—';
serverRound.textContent = '—';
serverMap.textContent = '—';
serverPreset.textContent = '—';
serverIp.textContent = SOYUZ_SERVER;
serverStatus.textContent = 'Недоступен';
serverStatus.style.color = '#eb2e51';
}
// API FETCH-End
// FOOTER-Start
function formatDate(date) {
return date.toLocaleDateString('ru-RU', {
day: '2-digit',
month: '2-digit',
year: 'numeric'
});
}
async function updateFooter() {
const footer = document.querySelector('footer.footer');
const today = new Date();
const files = [
{ type: 'HTML', url: window.location.href },
{ type: 'CSS', url: 'style.css' },
{ type: 'JS', url: 'script.js' }
];
const results = {};
for (const file of files) {
try {
const response = await fetch(file.url, {
method: 'HEAD',
cache: 'no-cache'
});
const lastModified = response.headers.get('Last-Modified');
if (lastModified) {
const date = new Date(lastModified);
results[file.type] = formatDate(date);
} else {
results[file.type] = formatDate(today);
}
} catch (err) {
console.warn(`Не удалось получить дату для ${file.type}:`, err);
results[file.type] = formatDate(today);
}
}
const htmlDate = results.HTML || formatDate(today);
const cssDate = results.CSS || formatDate(today);
const jsDate = results.JS || formatDate(today);
footer.textContent = `HTML: ${htmlDate} | CSS: ${cssDate} | JS: ${jsDate} © botcott & PERed`;
}
// FOOTER-End
document.addEventListener('DOMContentLoaded', () => {
AOS.init({
duration: 1000,
once: true
});
const container = document.getElementById('stars-container');
for (let i = 0; i < 250; i++) {
const star = document.createElement('div');
star.className = 'star';
const size = Math.random() * 3 + 1;
const x = Math.random() * 100;
const y = Math.random() * 100;
const duration = 2 + Math.random() * 6;
const opacity = 0.2 + Math.random() * 0.6;
star.style.width = size + 'px';
star.style.height = size + 'px';
star.style.left = x + '%';
star.style.top = y + '%';
star.style.setProperty('--duration', duration + 's');
star.style.setProperty('--opacity', opacity);
container.appendChild(star);
}
for (let i = 0; i < 80; i++) {
const star = document.createElement('div');
star.className = 'falling-star falling-star-fast';
const x = Math.random() * 100;
const delay = Math.random() * 8;
const drift = (Math.random() - 0.5) * 60;
star.style.left = x + '%';
star.style.animationDelay = delay + 's';
star.style.setProperty('--drift', drift + 'px');
star.style.setProperty('--base-opacity', 0.8 + Math.random() * 0.2);
container.appendChild(star);
}
for (let i = 0; i < 50; i++) {
const star = document.createElement('div');
star.className = 'falling-star falling-star-medium';
const x = Math.random() * 100;
const delay = Math.random() * 12;
const drift = (Math.random() - 0.5) * 40;
star.style.left = x + '%';
star.style.animationDelay = delay + 's';
star.style.setProperty('--drift', drift + 'px');
star.style.setProperty('--base-opacity', 0.6 + Math.random() * 0.3);
container.appendChild(star);
}
for (let i = 0; i < 30; i++) {
const star = document.createElement('div');
star.className = 'falling-star falling-star-slow';
const x = Math.random() * 100;
const delay = Math.random() * 18;
const drift = (Math.random() - 0.5) * 30;
star.style.left = x + '%';
star.style.animationDelay = delay + 's';
star.style.setProperty('--drift', drift + 'px');
star.style.setProperty('--base-opacity', 0.4 + Math.random() * 0.3);
container.appendChild(star);
}
fetchServerStatus();
updateFooter();
setInterval(fetchServerStatus, REFRESH_INTERVAL);
});