ApiCheck commited on
Commit
82d1101
·
verified ·
1 Parent(s): d48d14a

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +358 -18
index.html CHANGED
@@ -1,19 +1,359 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  </html>
 
1
+
2
+ <!DOCTYPE html>
3
+ <html lang="zh-CN">
4
+ <head>
5
+ <meta charset="UTF-8">
6
+ <title>中国春节倒计时</title>
7
+ <!-- 引入Google Fonts的Ma Shan Zheng字体 -->
8
+ <link href="https://ooo.0x0.ooo/2024/12/25/OEFMXM.jpg" rel="stylesheet">
9
+ <style>
10
+ /* 全局样式 */
11
+ body, html {
12
+ height: 100%;
13
+ width: 100%;
14
+ margin: 0;
15
+ font-family: 'Ma Shan Zheng', cursive;
16
+ color: #fff;
17
+ display: flex;
18
+ justify-content: center;
19
+ align-items: center;
20
+ overflow: hidden;
21
+ position: relative;
22
+ }
23
+
24
+ /* 背景图片样式 */
25
+ .background {
26
+ position: absolute;
27
+ width: 100%;
28
+ height: 100%;
29
+ background: url('https://s2.loli.net/2024/12/29/eMjyY6b1lQgdPGN.png') no-repeat center center/cover;
30
+ z-index: -3;
31
+ opacity: 1.2;
32
+ }
33
+
34
+ /* 烟花画布 */
35
+ #fireworks-canvas {
36
+ position: absolute;
37
+ top: 0;
38
+ left: 0;
39
+ width: 100%;
40
+ height: 100%;
41
+ z-index: -1; /* 确保烟花在背景之上,内容之下 */
42
+ pointer-events: none; /* 确保点击事件不被烟花遮挡 */
43
+ }
44
+
45
+ /* 主容器样式 */
46
+ .container {
47
+ text-align: center;
48
+ padding: 30px 40px;
49
+ background: rgba(0, 0, 0, 0.6);
50
+ border-radius: 20px;
51
+ box-shadow: 0 0 30px rgba(0,0,0,0.7);
52
+ animation: fadeIn 1s ease-out;
53
+ z-index: 1; /* 确保内容在烟花之上 */
54
+ }
55
+
56
+ /* 动画效果 */
57
+ @keyframes fadeIn {
58
+ from { opacity: 0; transform: scale(0.8); }
59
+ to { opacity: 1; transform: scale(1); }
60
+ }
61
+
62
+ h1 {
63
+ font-size: 2.5em;
64
+ margin-bottom: 15px;
65
+ font-weight: bold;
66
+ color: #FFD700;
67
+ text-shadow: 2px 2px 8px rgba(0,0,0,0.5);
68
+ animation: glow 2s infinite alternate;
69
+ }
70
+
71
+ .time, .cny-date, .countdown {
72
+ font-size: 2em; /* 增大时钟字体 */
73
+ margin: 15px 0;
74
+ animation: fadeInUp 1.5s ease-out;
75
+ }
76
+
77
+ /* 文字动画 */
78
+ @keyframes fadeInUp {
79
+ from { opacity: 0; transform: translateY(20px); }
80
+ to { opacity: 1; transform: translateY(0); }
81
+ }
82
+
83
+ /* 文字发光效果 */
84
+ @keyframes glow {
85
+ from { text-shadow: 2px 2px 8px rgba(255,215,0,0.7); }
86
+ to { text-shadow: 2px 2px 20px rgba(255,215,0,1); }
87
+ }
88
+
89
+ /* 响应式设计 */
90
+ @media (max-width: 600px) {
91
+ h1 {
92
+ font-size: 1.8em;
93
+ }
94
+ .time, .cny-date, .countdown {
95
+ font-size: 1.5em; /* 移动端适当减小字体 */
96
+ }
97
+ .container {
98
+ padding: 20px 25px;
99
+ }
100
+ }
101
+
102
+ /* 底部滚动字幕 */
103
+ .scrolling-message {
104
+ position: fixed;
105
+ bottom: 0;
106
+ left: 0;
107
+ width: 100%;
108
+ font-size: 65px;
109
+ color: yellow;
110
+ background-color: rgba(0, 0, 0, 0.4);
111
+ padding: 10px 0;
112
+ white-space: nowrap;
113
+ overflow: hidden;
114
+ box-sizing: border-box;
115
+ }
116
+
117
+ .scrolling-message span {
118
+ display: inline-block;
119
+ padding-left: 100%; /* 初始位置在屏幕右侧 */
120
+ animation: scrollText 26s linear infinite; /* 减慢滚动速度 */
121
+ }
122
+
123
+ @keyframes scrollText {
124
+ 0% {
125
+ transform: translateX(0); /* 从屏幕右侧边缘开始 */
126
+ }
127
+ 100% {
128
+ transform: translateX(-100%); /* 滚动到屏幕左侧 */
129
+ }
130
+ }
131
+
132
+ /* 禁止声音按钮 */
133
+ .sound-btn {
134
+ position: fixed;
135
+ top: 20px;
136
+ right: 20px;
137
+ background: rgba(255, 255, 255, 0.2);
138
+ border: none;
139
+ border-radius: 50%;
140
+ width: 40px;
141
+ height: 40px;
142
+ cursor: pointer;
143
+ display: flex;
144
+ align-items: center;
145
+ justify-content: center;
146
+ z-index: 10;
147
+ }
148
+
149
+ .sound-btn svg {
150
+ fill: white;
151
+ width: 24px;
152
+ height: 24px;
153
+ }
154
+ </style>
155
+ </head>
156
+ <body>
157
+ <!-- 背景图片 -->
158
+ <div class="background"></div>
159
+
160
+ <!-- 烟花画布 -->
161
+ <canvas id="fireworks-canvas"></canvas>
162
+
163
+
164
+ <!-- 主内容 -->
165
+ <div class="container">
166
+ <h1>中国春节倒计时</h1>
167
+ <div class="time">当前时间:<span id="currentTime">--:--:--</span></div>
168
+ <div class="cny-date">中国春节日期:<span id="cnyDate">--</span></div>
169
+ <div class="countdown">倒计时:<span id="countdown">--天 --小时 --分钟 --秒</span></div>
170
+ </div>
171
+
172
+
173
+ <!-- 在页面底部添加滚动字幕 -->
174
+ <div class="scrolling-message">
175
+ <span>LINUX DO年度寄语:愿新的一年,我们继续在技术海洋中携手成长!我为人人,人人为我,真诚、友善地对待他人,不以一己私利为重,这就是LINUX DO!</span>
176
+ </div>
177
+
178
+ <script>
179
+ // 当前时间和倒计时
180
+ const currentTimeEl = document.getElementById('currentTime');
181
+ const cnyDateEl = document.getElementById('cnyDate');
182
+ const countdownEl = document.getElementById('countdown');
183
+
184
+ // 中国春节日期(2020-2030)
185
+ const cnyDates = {
186
+ 2020: '2020-01-25',
187
+ 2021: '2021-02-12',
188
+ 2022: '2022-02-01',
189
+ 2023: '2023-01-22',
190
+ 2024: '2024-02-10',
191
+ 2025: '2025-01-29',
192
+ 2026: '2026-02-17',
193
+ 2027: '2027-02-06',
194
+ 2028: '2028-01-26',
195
+ 2029: '2029-02-13',
196
+ 2030: '2030-02-03'
197
+ };
198
+
199
+ function updateTime() {
200
+ const now = new Date();
201
+ const year = now.getFullYear();
202
+ const month = String(now.getMonth() + 1).padStart(2, '0');
203
+ const date = String(now.getDate()).padStart(2, '0');
204
+ const hours = String(now.getHours()).padStart(2, '0');
205
+ const minutes = String(now.getMinutes()).padStart(2, '0');
206
+ const seconds = String(now.getSeconds()).padStart(2, '0');
207
+ currentTimeEl.textContent = `${year}-${month}-${date} ${hours}:${minutes}:${seconds}`;
208
+
209
+ // 获取中国春节日期
210
+ let cnyYear = year;
211
+ let cnyDateStr = cnyDates[cnyYear];
212
+ let cnyDate = cnyDateStr ? new Date(cnyDateStr + 'T00:00:00') : null;
213
+
214
+ // 如果今年的中国春节已经过去,使用明年的
215
+ if (cnyDate && now > cnyDate) {
216
+ cnyYear += 1;
217
+ cnyDateStr = cnyDates[cnyYear];
218
+ if(cnyDateStr){
219
+ cnyDate = new Date(cnyDateStr + 'T00:00:00');
220
+ } else {
221
+ // 如果超出预设年份,提示无法计算
222
+ cnyDateEl.textContent = '无法计算';
223
+ countdownEl.textContent = '--';
224
+ return;
225
+ }
226
+ }
227
+ if (cnyDate) {
228
+ const cnyMonth = String(cnyDate.getMonth() + 1).padStart(2, '0');
229
+ const cnyDay = String(cnyDate.getDate()).padStart(2, '0');
230
+ cnyDateEl.textContent = `${cnyYear}-${cnyMonth}-${cnyDay}`;
231
+
232
+ // 计算倒计时
233
+ const diff = cnyDate - now;
234
+ if(diff <=0){
235
+ countdownEl.textContent = '今天是中国春节!';
236
+ return;
237
+ }
238
+ const days = Math.floor(diff / (1000 * 60 * 60 * 24));
239
+ const hoursLeft = Math.floor((diff % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
240
+ const minutesLeft = Math.floor((diff % (1000 * 60 * 60)) / (1000 * 60));
241
+ const secondsLeft = Math.floor((diff % (1000 * 60)) / 1000);
242
+ countdownEl.textContent = `${days}天 ${hoursLeft}小时 ${minutesLeft}分钟 ${secondsLeft}秒`;
243
+ } else {
244
+ // 如果无法获取中国春节日期
245
+ cnyDateEl.textContent = '无法计算';
246
+ countdownEl.textContent = '--';
247
+ }
248
+ }
249
+
250
+ // 更新每秒
251
+ updateTime();
252
+ setInterval(updateTime, 1000);
253
+
254
+ // 烟花效果
255
+ const canvas = document.getElementById('fireworks-canvas');
256
+ const ctx = canvas.getContext('2d');
257
+ canvas.width = window.innerWidth;
258
+ canvas.height = window.innerHeight;
259
+
260
+ // 烟花粒子类
261
+ class Particle {
262
+ constructor(x, y, color) {
263
+ this.x = x;
264
+ this.y = y;
265
+ this.color = color;
266
+ this.radius = Math.random() * 2 + 1;
267
+ this.velocity = {
268
+ x: (Math.random() - 0.5) * 5,
269
+ y: (Math.random() - 0.5) * 5
270
+ };
271
+ this.alpha = 1;
272
+ }
273
+
274
+ draw() {
275
+ ctx.save();
276
+ ctx.globalAlpha = this.alpha;
277
+ ctx.beginPath();
278
+ ctx.arc(this.x, this.y, this.radius, 0, Math.PI * 2, false);
279
+ ctx.fillStyle = this.color;
280
+ ctx.fill();
281
+ ctx.restore();
282
+ }
283
+
284
+ update() {
285
+ this.draw();
286
+ this.x += this.velocity.x;
287
+ this.y += this.velocity.y;
288
+ this.alpha -= 0.01;
289
+ }
290
+ }
291
+
292
+ // 烟花类
293
+ class Firework {
294
+ constructor(x, y, color) {
295
+ this.x = x;
296
+ this.y = y;
297
+ this.color = color;
298
+ this.particles = [];
299
+ for (let i = 0; i < 100; i++) {
300
+ this.particles.push(new Particle(this.x, this.y, this.color));
301
+ }
302
+ }
303
+
304
+ update() {
305
+ this.particles.forEach((particle, index) => {
306
+ if (particle.alpha <= 0) {
307
+ this.particles.splice(index, 1);
308
+ } else {
309
+ particle.update();
310
+ }
311
+ });
312
+ }
313
+ }
314
+
315
+ // 烟花数组
316
+ let fireworks = [];
317
+
318
+ // 动画循环
319
+ function animate() {
320
+ requestAnimationFrame(animate);
321
+ ctx.clearRect(0, 0, canvas.width, canvas.height); // 清除画布,保留背景
322
+
323
+ fireworks.forEach((firework, index) => {
324
+ if (firework.particles.length === 0) {
325
+ fireworks.splice(index, 1);
326
+ } else {
327
+ firework.update();
328
+ }
329
+ });
330
+ }
331
+
332
+ // 随机生成烟花
333
+ function createFirework() {
334
+ const x = Math.random() * canvas.width;
335
+ const y = Math.random() * canvas.height;
336
+ const color = `hsl(${Math.random() * 360}, 50%, 50%)`;
337
+ fireworks.push(new Firework(x, y, color));
338
+ }
339
+
340
+ // 每 500 毫秒生成一个烟花
341
+ setInterval(createFirework, 500);
342
+
343
+ // 开始动画
344
+ animate();
345
+
346
+ // 禁止声音按钮逻辑
347
+ //const soundBtn = document.querySelector('.sound-btn');
348
+ //let isSoundOn = true;
349
+
350
+ //soundBtn.addEventListener('click', () => {
351
+ // isSoundOn = !isSoundOn;
352
+ // soundBtn.innerHTML = isSoundOn
353
+ // ? '<path id="icon-sound-on" d="M3 9v6h4l5 5V4L7 9H3zm13.5 3c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02zM14 3.23v2.06c2.89.86 5 3.54 5 6.71s-2.11 5.85-5 6.71v2.06c4.01-.91 7-4.49 7-8.77s-2.99-7.86-7-8.77z"/>'
354
+ // : '<path id="icon-sound-off" d="M16.5 12c0-1.77-1.02-3.29-2.5-4.03v2.21l2.45 2.45c.03-.2.05-.41.05-.63zm2.5 0c0 .94-.2 1.82-.54 2.64l1.51 1.51C20.63 14.91 21 13.5 21 12c0-4.28-2.99-7.86-7-8.77v2.06c2.89.86 5 3.54 5 6.71zM4.27 3L3 4.27 7.73 9H3v6h4l5 5v-6.73l4.25 4.25c-.67.52-1.42.93-2.25 1.18v2.06c1.38-.31 2.63-.95 3.69-1.81L19.73 21 21 19.73l-9-9L4.27 3zM12 4L9.91 6.09 12 8.18V4z"/>';
355
+ //});
356
+ </script>
357
+ <script defer src="https://static.cloudflareinsights.com/beacon.min.js/vcd15cbe7772f49c399c6a5babf22c1241717689176015" integrity="sha512-ZpsOmlRQV6y907TI0dKBHq9Md29nnaEIPlkf84rnaERnq6zvWvPUqr2ft8M1aS28oN72PdrCzSjY4U6VaAw1EQ==" data-cf-beacon='{"rayId":"8f992b9bee3fd049","version":"2024.10.5","r":1,"token":"2a84cf81469744fabd107d17169c271a","serverTiming":{"name":{"cfExtPri":true,"cfL4":true,"cfSpeedBrain":true,"cfCacheStatus":true}}}' crossorigin="anonymous"></script>
358
+ </body>
359
  </html>