-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
233 lines (199 loc) · 6.36 KB
/
Copy pathindex.html
File metadata and controls
233 lines (199 loc) · 6.36 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
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>New Year Countdown</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Georgia', serif;
background: linear-gradient(135deg, #1a1a2e 0%, #0f3460 50%, #16213e 100%);
min-height: 100vh;
display: flex;
justify-content: center;
align-items: center;
overflow: hidden;
position: relative;
}
.snowflake {
position: absolute;
top: -10px;
color: #fff;
font-size: 1em;
opacity: 0.8;
animation: fall linear infinite;
text-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
}
@keyframes fall {
to {
transform: translateY(100vh) rotate(360deg);
}
}
.container {
text-align: center;
z-index: 10;
background: rgba(255, 255, 255, 0.05);
backdrop-filter: blur(10px);
padding: 60px 40px;
border-radius: 30px;
max-width: 90%;
}
h1 { color: #ffd700; font-size: 3.5em; }
.countdown {
display: flex;
justify-content: center;
gap: 30px;
flex-wrap: wrap;
margin: 40px 0;
}
.time-unit {
padding: 30px 25px;
border-radius: 20px;
min-width: 140px;
background: rgba(255,255,255,0.08);
}
.number {
font-size: 4em;
color: #ffd700;
}
.label {
color: #e0e0e0;
text-transform: uppercase;
letter-spacing: 2px;
}
.message {
color: #fff;
font-size: 1.3em;
margin-top: 30px;
font-style: italic;
}
.lang-btn {
margin-top: 25px;
padding: 10px 22px;
font-size: 14px;
cursor: pointer;
border-radius: 20px;
border: 1px solid rgba(255,255,255,0.3);
background: transparent;
color: #fff;
}
@media (max-width: 500px) {
.container {
transform: scale(0.85);
padding: 40px 20px;
}
h1 {
font-size: 2em;
}
.time-unit {
min-width: 90px;
padding: 15px 10px;
}
.number {
font-size: 2.5em;
}
.label {
font-size: 0.8em;
letter-spacing: 1px;
}
}
</style>
</head>
<body>
<div class="container">
<h1 data-i18n="heading"></h1>
<div class="countdown" id="countdown">
<div class="time-unit">
<span class="number" id="days">00</span>
<div class="label" data-i18n="labels.days"></div>
</div>
<div class="time-unit">
<span class="number" id="hours">00</span>
<div class="label" data-i18n="labels.hours"></div>
</div>
<div class="time-unit">
<span class="number" id="minutes">00</span>
<div class="label" data-i18n="labels.minutes"></div>
</div>
<div class="time-unit">
<span class="number" id="seconds">00</span>
<div class="label" data-i18n="labels.seconds"></div>
</div>
</div>
<div class="message" id="message" data-i18n="message"></div>
<!-- КНОПКА -->
<button class="lang-btn" id="langBtn">RU</button>
</div>
<script>
function createSnowflake() {
const snowflake = document.createElement('div');
snowflake.className = 'snowflake';
snowflake.textContent = '❄';
snowflake.style.left = Math.random() * 100 + '%';
snowflake.style.animationDuration = (Math.random() * 3 + 5) + 's';
snowflake.style.opacity = Math.random() * 0.6 + 0.4;
snowflake.style.fontSize = (Math.random() * 0.8 + 0.5) + 'em';
document.body.appendChild(snowflake);
setTimeout(() => snowflake.remove(), 8000);
}
setInterval(createSnowflake, 150);
const TRANSLATIONS = {
en: {
title: 'New Year Countdown',
heading: 'Happy Upcoming New Year!',
labels: { days: 'Days', hours: 'Hours', minutes: 'Minutes', seconds: 'Seconds' },
message: 'There is very little time left until the New Year...',
newYearMessage: 'Happy New Year! Congratulations!'
},
ru: {
title: 'Обратный отсчёт до Нового Года',
heading: 'С наступающим Новым Годом!',
labels: { days: 'Дней', hours: 'Часов', minutes: 'Минут', seconds: 'Секунд' },
message: 'До Нового Года осталось совсем немного...',
newYearMessage: 'С Новым Годом! Поздравляем!'
}
};
let lang = 'en';
let t = TRANSLATIONS[lang];
/* === i18n === */
function getTranslation(path, obj) {
return path.split('.').reduce((o, k) => o?.[k], obj);
}
function applyLanguage() {
t = TRANSLATIONS[lang];
document.title = t.title;
document.querySelectorAll('[data-i18n]').forEach(el => {
const value = getTranslation(el.dataset.i18n, t);
if (value) el.textContent = value;
});
document.getElementById('langBtn').textContent = lang === 'en' ? 'RU' : 'EN';
}
applyLanguage();
document.getElementById('langBtn').addEventListener('click', () => {
lang = lang === 'en' ? 'ru' : 'en';
applyLanguage();
});
function updateCountdown() {
const now = new Date();
const newYear = new Date(now.getFullYear() + 1, 0, 1);
const diff = newYear - now;
if (diff <= 0) {
document.getElementById('countdown').innerHTML = '🎉';
document.getElementById('message').textContent = t.newYearMessage;
return;
}
days.textContent = String(Math.floor(diff / 86400000)).padStart(2, '0');
hours.textContent = String(Math.floor(diff / 3600000) % 24).padStart(2, '0');
minutes.textContent = String(Math.floor(diff / 60000) % 60).padStart(2, '0');
seconds.textContent = String(Math.floor(diff / 1000) % 60).padStart(2, '0');
}
updateCountdown();
setInterval(updateCountdown, 1000);
</script>
</body>
</html>