-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathneon-drowning.html
More file actions
1366 lines (1171 loc) · 44.7 KB
/
neon-drowning.html
File metadata and controls
1366 lines (1171 loc) · 44.7 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
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Yesterday Once More | 昨日重现</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&display=swap" rel="stylesheet">
<style>
:root {
--bg-color: #333;
--text-color: #fff;
--transition-speed: 0.3s;
--pink: #FF6B6B;
--pink-rgb: 255, 107, 107;
--blue: #00C4CC;
--blue-rgb: 0, 196, 204;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Space Grotesk', sans-serif;
height: 100vh;
overflow: hidden;
background: var(--bg-color);
color: var(--text-color);
}
.video-bg {
position: fixed;
top: 0;
left: 0;
width: 100%; /* 覆盖全屏 */
height: 100%; /* 覆盖全屏 */
object-fit: cover; /* 保持纵横比例的同时填充全屏 */
z-index: -2;
opacity: 1;
filter: contrast(1.1) brightness(0.9); /* 增强对比度 */
overflow: hidden; /* 防止内容溢出 */
}
/* YouTube iframe 样式 */
#video-container iframe {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 100vw;
height: 100vh;
pointer-events: none; /* 禁止点击视频 */
}
.glass-overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
backdrop-filter: blur(1px);
-webkit-backdrop-filter: blur(1px);
background-color: rgba(0, 0, 0, 0.2);
z-index: -1;
pointer-events: none;
}
.container {
display: flex;
flex-direction: column; /* Changed to column for centered title */
justify-content: flex-start;
align-items: center; /* Center align everything */
min-height: calc(100vh - 10rem);
padding: 2rem;
position: relative;
z-index: 1;
width: 100%; /* Use full width */
max-width: 1600px; /* Increased max-width */
margin: 0 auto;
margin-top: 5rem; /* 将容器向下移动 */
}
.quote-container {
width: 80%;
max-width: 800px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
position: relative;
text-align: center;
margin: 2rem auto;
}
.chat-section {
width: 80%;
max-width: 800px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
position: relative;
margin: 0 auto;
}
/* 翻转容器样式 */
.flip-container {
perspective: 1000px;
width: 100%;
max-width: 1200px;
height: 300px;
margin: 4rem auto 6rem;
cursor: pointer;
position: relative;
z-index: 10;
display: flex;
justify-content: center;
align-items: center;
}
.flip-container:hover .flipper {
transform: rotateX(180deg);
}
.flipper {
transition: 1s;
transform-style: preserve-3d;
position: relative;
width: 100%;
height: 100%;
}
.front, .back {
backface-visibility: hidden;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
border-radius: 10px;
}
.front {
z-index: 2;
transform: rotateX(0deg);
}
.back {
transform: rotateX(180deg);
overflow: visible;
padding: 1rem;
background-color: rgba(0, 0, 0, 0.2);
}
.logo {
font-size: 8rem; /* 放大标题 */
font-weight: 700;
letter-spacing: -0.05em;
text-align: center;
width: 100%;
opacity: 1;
color: white;
text-transform: lowercase;
line-height: 1;
text-shadow: 0 0 15px rgba(255, 255, 255, 0.7);
transition: all 0.3s ease;
white-space: nowrap; /* 确保标题在一行显示 */
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.flip-container:hover .logo {
transform: translate(-50%, -50%) scale(1.05);
text-shadow: 0 0 15px rgba(255, 255, 255, 0.7);
}
.quote-text {
font-size: 1.3rem;
line-height: 1.8;
text-align: center;
color: rgba(255, 255, 255, 1);
max-width: 100%;
padding: 1.5rem;
display: none; /* 默认隐藏,根据语言显示 */
overflow: visible;
height: auto;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 90%;
text-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
background-color: rgba(0, 0, 0, 0.3);
border-radius: 10px;
}
/* 根据语言显示相应的引用文本 */
.en-content {
display: none;
}
.zh-content {
display: none;
}
@keyframes glowPulse {
0% {
opacity: 0.3;
filter: blur(8px);
}
100% {
opacity: 0.7;
filter: blur(12px);
}
}
.tagline {
font-size: 1.2rem;
font-weight: 300;
margin-bottom: 3rem;
text-align: center;
max-width: 600px;
opacity: 0;
transform: translateY(20px);
animation: fadeIn 1s forwards 0.8s;
}
.chat-container {
width: 100%;
max-width: 800px;
background-color: rgba(0, 0, 0, 0.2);
border-radius: 8px;
padding: 2rem;
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
opacity: 1;
border: 1px solid rgba(255, 255, 255, 0.1);
position: relative;
overflow: hidden;
}
.chat-container::before {
content: '';
position: absolute;
top: -50%;
left: -50%;
width: 200%;
height: 200%;
background: linear-gradient(45deg,
transparent,
rgba(255, 255, 255, 0.03),
transparent);
transform: rotate(45deg);
animation: glassSweep 10s linear infinite;
pointer-events: none;
}
@keyframes glassSweep {
0% {
transform: rotate(45deg) translateY(-100%);
}
100% {
transform: rotate(45deg) translateY(100%);
}
}
.chat-messages {
max-height: 300px;
overflow-y: auto;
margin-bottom: 1.5rem;
padding-right: 0.5rem;
display: none;
}
/* Typing indicator */
.typing-indicator {
display: inline-flex;
align-items: center;
margin: 0.5rem 0;
}
.typing-indicator span {
height: 8px;
width: 8px;
background-color: white;
border-radius: 50%;
margin: 0 2px;
animation: bounce 1.5s infinite ease-in-out;
}
.typing-indicator span:nth-child(2) {
animation-delay: 0.2s;
}
.typing-indicator span:nth-child(3) {
animation-delay: 0.4s;
}
@keyframes bounce {
0%, 60%, 100% {
transform: translateY(0);
}
30% {
transform: translateY(-4px);
}
}
.chat-messages::-webkit-scrollbar {
width: 4px;
}
.chat-messages::-webkit-scrollbar-thumb {
background-color: rgba(255, 255, 255, 0.3);
border-radius: 2px;
}
.message {
margin-bottom: 1rem;
padding: 1rem;
border-radius: 10px;
animation: ripple 0.5s ease-out;
}
.user-message {
background-color: rgba(255, 255, 255, 0.2);
margin-left: 2rem;
}
.ai-message {
background-color: rgba(0, 0, 0, 0.2);
margin-right: 2rem;
}
.input-container {
display: flex;
position: relative;
}
.chat-input {
flex: 1;
padding: 1rem;
border: none;
background-color: rgba(255, 255, 255, 0.2);
border-radius: 10px;
color: white;
font-family: inherit;
font-size: 1rem;
outline: none;
transition: all 0.3s;
}
.chat-input::placeholder {
color: rgba(255, 255, 255, 0.7);
}
.chat-input:focus {
background-color: rgba(255, 255, 255, 0.3);
}
.media-upload {
position: absolute;
right: 6.5rem;
top: 50%;
transform: translateY(-50%);
background: none;
border: none;
color: white;
font-size: 1.2rem;
cursor: pointer;
opacity: 0.7;
transition: all 0.3s;
z-index: 2;
}
.media-upload:hover {
opacity: 1;
}
.send-button {
margin-left: 0.5rem;
padding: 0 1.5rem;
background: linear-gradient(135deg, var(--pink), var(--blue));
border: none;
border-radius: 10px;
color: white;
font-family: inherit;
font-size: 1rem;
cursor: pointer;
transition: all 0.3s;
position: relative;
z-index: 1;
min-width: 70px;
}
.send-button:hover {
transform: translateY(-2px);
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}
.media-preview {
display: flex;
flex-wrap: wrap;
gap: 0.5rem;
margin-top: 1rem;
display: none;
}
/* Ripple Effect */
.ripple {
position: absolute;
border-radius: 50%;
background-color: rgba(255, 255, 255, 0.3);
width: 5px;
height: 5px;
animation: ripple-effect 1s linear;
transform: translate(-50%, -50%);
pointer-events: none;
z-index: 9999;
}
@keyframes ripple-effect {
0% {
width: 0;
height: 0;
opacity: 0.5;
}
100% {
width: 500px;
height: 500px;
opacity: 0;
}
}
.preview-item {
position: relative;
width: 80px;
height: 80px;
border-radius: 8px;
overflow: hidden;
background-color: rgba(255, 255, 255, 0.1);
}
.preview-item img,
.preview-item video {
width: 100%;
height: 100%;
object-fit: cover;
}
.preview-item .audio-preview {
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
}
.remove-media {
position: absolute;
top: 5px;
right: 5px;
width: 20px;
height: 20px;
background-color: rgba(0, 0, 0, 0.5);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
color: white;
font-size: 0.7rem;
cursor: pointer;
}
.file-input {
display: none;
}
@keyframes fadeIn {
to {
opacity: 1;
transform: translateY(0);
}
}
@keyframes ripple {
0% {
transform: scale(0.8);
opacity: 0;
}
100% {
transform: scale(1);
opacity: 1;
}
}
@keyframes dissolve {
0% {
opacity: 0;
filter: blur(10px);
transform: scale(1.1);
}
50% {
opacity: 1;
filter: blur(0);
transform: scale(1);
}
100% {
opacity: 1;
filter: blur(0);
transform: scale(1);
}
}
.dissolve-in {
animation: dissolve 1.5s forwards;
}
.footer {
position: fixed;
bottom: 1rem;
left: 0;
width: 100%;
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 2rem;
font-size: 0.8rem;
opacity: 0.7;
z-index: 10;
}
.footer-left {
text-align: left;
}
.footer-right {
text-align: right;
}
.social-icons {
display: flex;
gap: 1rem;
}
.social-icon {
color: white;
opacity: 0.8;
transition: all 0.3s;
text-decoration: none;
}
.social-icon:hover {
opacity: 1;
transform: translateY(-2px);
}
.xiaohongshu {
font-size: 0.7rem;
font-weight: bold;
}
/* Language switcher */
.language-switcher {
display: flex;
justify-content: center;
align-items: center;
position: absolute;
top: 20px;
right: 20px;
z-index: 10;
}
.lang-btn {
background: none;
border: none;
color: rgba(255, 255, 255, 0.7);
font-size: 0.9rem;
cursor: pointer;
padding: 0.3rem 0.6rem;
transition: all 0.3s;
}
.lang-btn.active {
color: white;
font-weight: 600;
}
.lang-btn:hover {
color: white;
}
.lang-divider {
color: rgba(255, 255, 255, 0.5);
margin: 0 0.3rem;
}
/* 移除导航点相关的CSS */
/* 移除香水展示相关的CSS */
.page {
display: block;
}
/* 移除香水描述相关的CSS */
/* Language content control */
.zh-content {
display: none;
}
.en-content {
display: block;
}
/* 移除香水展示相关的标题样式 */
@media (max-width: 768px) {
.logo {
font-size: 3rem;
}
.chat-container {
padding: 1.5rem;
}
.container {
flex-direction: column;
padding: 2rem 1rem;
}
.content-left, .content-right {
width: 100%;
padding-right: 0;
padding-top: 2rem;
}
.content-left {
margin-bottom: 2rem;
}
.quote-text {
font-size: 1rem;
margin-bottom: 1.5rem;
}
}
</style>
</head>
<body>
<!-- Video Background -->
<div id="video-container" class="video-bg">
<!-- YouTube iframe will be inserted here by JavaScript -->
</div>
<!-- Fallback video (used if YouTube fails) -->
<video class="video-bg" id="video-bg" autoplay muted loop playsinline>
</video>
<!-- Debug info for video -->
<!-- 移除调试信息 -->
<!-- Glass Effect -->
<div class="glass-overlay"></div>
<div class="language-switcher">
<button id="en-lang" class="lang-btn active">EN</button>
<span class="lang-divider">|</span>
<button id="zh-lang" class="lang-btn">中文</button>
</div>
<div class="flip-container">
<div class="flipper">
<div class="front">
<h1 class="logo">Yesterday Once More</h1>
</div>
<div class="back">
<div class="quote-text en-content">
Scent is the only sensory input that directly affects emotions through the limbic system. When deeply associated with specific contexts, it can instantly remind you of a person or event - a phenomenon known as the Proustian effect. Find scents you love and record them in your life manual. Use one scent to preserve the present moment, and another to evoke the past. Slowly understand yourself, record yourself, use yourself well, and fall in love with yourself.
</div>
<div class="quote-text zh-content">
气味是唯一一种直接通过边缘系统影响情绪的感官输入,当它与特定情境深度关联,会瞬间让你想到某个人或是事,这种现象被称为Proustian( 普鲁斯特效应 )。去寻找自己喜欢的气味,记录在人生说明书里,一味香用来备份当下,一味香试着唤起过往,慢慢了解自己、记录自己、用好自己、爱上自己。
</div>
</div>
</div>
</div>
<div class="container">
<div class="chat-section">
<!-- 移除导航点 -->
<!-- Chat Container -->
<div class="chat-container">
<div id="chat-messages" class="chat-messages">
<!-- Messages will appear here -->
</div>
<div class="input-container">
<input type="text" id="chat-input" class="chat-input" placeholder="Type your message here..." />
<button id="media-upload" class="media-upload">
<i class="fas fa-paperclip"></i>
</button>
<input type="file" id="file-input" class="file-input" accept="image/*,audio/*,video/*" multiple />
<button id="send-button" class="send-button">Send</button>
</div>
<div id="media-preview" class="media-preview">
<!-- Media previews will appear here -->
</div>
</div>
</div>
</div>
<script src="config.js"></script>
<script src="api.js"></script>
<script>
// Video Background Management
// 使用视频背景
const useStaticBackground = false;
// YouTube视频ID
const youtubeVideoId = 'VKN2IdE-2KA'; // 您的YouTube视频ID
// 本地视频背景列表
const videoBackgrounds = [
"videos/background.mp4", // GitHub Pages上使用的相对路径
"C:/Users/LXH20/Videos/4月9日.mp4" // 本地开发时使用的绝对路径
];
// 当前播放的视频索引
let currentVideoIndex = 0;
// 检测当前环境
function isGitHubPages() {
return window.location.hostname.includes('github.io');
}
// 初始化视频背景
function initVideoBackground() {
if (isGitHubPages()) {
// 在GitHub Pages上使用YouTube视频
showDebug('Running on GitHub Pages, using YouTube video');
initYouTubeBackground();
} else {
// 在本地使用本地视频
showDebug('Running locally, using local video');
document.getElementById('video-container').style.display = 'none';
const videoBg = document.getElementById('video-bg');
videoBg.style.display = 'block';
playVideo(0);
}
}
// 初始化YouTube背景
function initYouTubeBackground() {
loadYouTubeAPI();
}
// 加载YouTube API
function loadYouTubeAPI() {
const tag = document.createElement('script');
tag.src = 'https://www.youtube.com/iframe_api';
const firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
}
// 初始化YouTube播放器
let youtubePlayer;
function onYouTubeIframeAPIReady() {
showDebug('YouTube API ready');
youtubePlayer = new YT.Player('video-container', {
videoId: youtubeVideoId,
playerVars: {
autoplay: 1,
controls: 0,
disablekb: 1,
fs: 0,
modestbranding: 1,
loop: 1,
playlist: youtubeVideoId, // 需要重复指定videoId才能循环播放
rel: 0,
showinfo: 0,
mute: 1
},
events: {
'onReady': onPlayerReady,
'onStateChange': onPlayerStateChange,
'onError': onPlayerError
}
});
}
// 播放器准备好时
function onPlayerReady(event) {
showDebug('YouTube player ready');
event.target.playVideo();
// 设置播放器样式
const iframe = document.querySelector('#video-container iframe');
if (iframe) {
iframe.style.position = 'absolute';
iframe.style.top = '50%';
iframe.style.left = '50%';
iframe.style.transform = 'translate(-50%, -50%)';
iframe.style.width = '100vw';
iframe.style.height = '100vh';
iframe.style.pointerEvents = 'none';
}
}
// 播放器状态改变时
function onPlayerStateChange(event) {
// 如果视频结束,重新播放
if (event.data === YT.PlayerState.ENDED) {
event.target.playVideo();
}
}
// 播放器错误时
function onPlayerError(event) {
showDebug(`YouTube player error: ${event.data}`);
// 如果YouTube播放失败,切换到本地视频
fallbackToLocalVideo();
}
// 切换到本地视频
function fallbackToLocalVideo() {
showDebug('Falling back to local video');
document.getElementById('video-container').style.display = 'none';
const videoBg = document.getElementById('video-bg');
videoBg.style.display = 'block';
playVideo(0);
}
// 初始化视频背景
initVideoBackground();
// Debug function - 只在控制台输出,不在页面显示
function showDebug(message) {
console.log(message);
}
// Check if video file exists
async function checkVideoExists(url) {
try {
const response = await fetch(url, { method: 'HEAD' });
return response.ok;
} catch (error) {
showDebug(`Error checking video: ${error.message}`);
return false;
}
}
// 移除渐变背景
function removeGradientBackground() {
// 移除动画类
document.body.classList.remove('animated-bg');
// 重置背景样式
document.body.style.background = '';
document.body.style.backgroundSize = '';
document.body.style.backgroundAttachment = '';
// 显示视频元素
const videoBg = document.getElementById('video-bg');
videoBg.style.display = 'block';
showDebug('Removed gradient background');
// 不需要隐藏调试信息,因为它只在控制台输出
return true;
}
// 播放指定索引的视频
async function playVideo(index) {
// 移除渐变背景
removeGradientBackground();
const videoBg = document.getElementById('video-bg');
showDebug(`Setting up video ${index + 1} of ${videoBackgrounds.length}...`);
// 使用指定的视频文件
const videoSource = videoBackgrounds[index];
showDebug(`Loading video: ${videoSource}`);
// 创建并添加source元素
const sourceElement = document.createElement('source');
sourceElement.src = videoSource;
sourceElement.type = 'video/mp4';
videoBg.innerHTML = ''; // 清除现有源
videoBg.appendChild(sourceElement);
// 加载并播放视频
videoBg.load();
try {
await videoBg.play();
showDebug(`Successfully playing video: ${videoSource}`);
return true; // 成功
} catch (error) {
showDebug(`Error playing video: ${error.message}`);
// 尝试播放下一个视频
if (index < videoBackgrounds.length - 1) {
return playVideo(index + 1);
}
return false;
}
}
// 页面加载时设置背景
window.addEventListener('DOMContentLoaded', async () => {
try {
// 不需要显示调试信息,因为它只在控制台输出
showDebug('Page loaded, initializing video background...');
// 初始化视频背景
initVideoBackground();
// 添加视频事件监听器
const videoBg = document.getElementById('video-bg');
videoBg.addEventListener('playing', () => {
console.log('Video is playing');
showDebug('Video is now playing');
});
videoBg.addEventListener('error', (e) => {
console.error(`Video error: ${e}`);
showDebug(`Video error: ${e}`);
});
// 不需要隐藏调试信息,因为它只在控制台输出
} catch (error) {
console.error(`Error in video setup: ${error.message}`);
showDebug(`Error in video setup: ${error.message}`);
}
});
// DOM Elements
const chatInput = document.getElementById('chat-input');
const sendButton = document.getElementById('send-button');
const chatMessages = document.getElementById('chat-messages');
const mediaUpload = document.getElementById('media-upload');
const fileInput = document.getElementById('file-input');
const mediaPreview = document.getElementById('media-preview');
const gradientBg = document.querySelector('.gradient-bg');
// Store uploaded files
let uploadedFiles = [];
// Dynamic background colors
const colors = [
{ pink: '#FF6B6B', pinkRgb: '255, 107, 107', blue: '#00C4CC', blueRgb: '0, 196, 204' }, // Default - Sunburn Pink & Chlorine Blue
{ pink: '#FF9E7D', pinkRgb: '255, 158, 125', blue: '#7D67FF', blueRgb: '125, 103, 255' }, // Sunset & Twilight
{ pink: '#FF5E87', pinkRgb: '255, 94, 135', blue: '#00D9B8', blueRgb: '0, 217, 184' }, // Neon Pink & Mint
{ pink: '#FF7EB3', pinkRgb: '255, 126, 179', blue: '#7B68EE', blueRgb: '123, 104, 238' }, // Bubblegum & Lavender
{ pink: '#FF8C42', pinkRgb: '255, 140, 66', blue: '#0096C7', blueRgb: '0, 150, 199' } // Tangerine & Ocean
];
let colorIndex = 0;
// Change background colors periodically
function changeBackgroundColor() {
colorIndex = (colorIndex + 1) % colors.length;
const newColors = colors[colorIndex];
document.documentElement.style.setProperty('--pink', newColors.pink);
document.documentElement.style.setProperty('--pink-rgb', newColors.pinkRgb);
document.documentElement.style.setProperty('--blue', newColors.blue);
document.documentElement.style.setProperty('--blue-rgb', newColors.blueRgb);
}
// Set interval for color change (every 30 seconds)
setInterval(changeBackgroundColor, 30000);
// Add ripple effect on click
document.addEventListener('click', function(e) {
const ripple = document.createElement('div');
ripple.classList.add('ripple');
ripple.style.left = e.clientX + 'px';
ripple.style.top = e.clientY + 'px';
document.body.appendChild(ripple);
setTimeout(() => {
ripple.remove();
}, 1000);
});
// Media upload handling
mediaUpload.addEventListener('click', () => {
fileInput.click();