-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
1061 lines (897 loc) · 56.5 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
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>
<head>
<!-- Common Tag -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Website Undangan Pernikahan Wahyu dan Riski Secara Online</title>
<script src="https://www.gstatic.com/firebasejs/9.9.2/firebase-app-compat.js"></script>
<!-- Firebase Realtime Database -->
<script src="https://www.gstatic.com/firebasejs/9.9.2/firebase-database-compat.js"></script>
<!-- SEO Tag -->
<meta name="author" content="Anhar">
<meta name="language" content="Indonesia">
<meta name="robots" content="index, follow, max-image-preview:large">
<meta name="googlebot" content="index, follow, max-image-preview:large">
<meta name="title" content="Website Undangan Pernikahan Riski dan Dhea Secara Online">
<meta name="description" content="Website Undangan Pernikahan Riski dan Dhea Secara Online">
<meta name="keywords" content="undangan, wedding, undangan digital, undangan online, wedding invitation, template undangan, template undangan pernikahan, undangan pernikahan, template undangan online, wedding invitation github, template website, template website undangan pernikahan">
<meta property="og:title" content="Website Undangan Pernikahan Riski dan dhea Secara Online">
<meta property="og:description" content="Website Undangan Pernikahan Riski dan Dhea Secara Online">
<meta property="og:keywords" content="undangan, wedding, undangan digital, undangan online, wedding invitation, template undangan, template undangan pernikahan, undangan pernikahan, template undangan online, wedding invitation github, template website, template website undangan pernikahan">
<meta property="og:image" content="./assets/images/bg.jpeg">
<meta property="og:image:secure_url" content="./images/bg.jpeg">
<meta property="og:image:type" content="image/jpeg">
<meta property="og:image:alt" content="Website Undangan Pernikahan Riski dan Dhea Secara Online">
<meta property="og:type" content="website">
<meta property="og:locale" content="id_ID">
<meta property="og:site_name" content="Website Undangan Pernikahan Riski dan Dhea Secara Online">
<!-- Appearance -->
<meta name="mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-title" content="Website Undangan Pernikahan Riski dan dhea Secara Online">
<meta name="theme-color" content="#111111">
<meta name="color-scheme" content="dark">
<link rel="shortcut icon" type="image/x-icon" href="./favicon.ico">
<link rel="apple-touch-icon" sizes="192x192" type="image/png" href="./assets/images/icon-192x192.png">
<link rel="icon" type="image/x-icon" href="./favicon.ico">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/normalize.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/[email protected]/css/all.min.css">
<link rel="stylesheet" href="https://unpkg.com/aos@next/dist/aos.css"/>
<link rel="stylesheet" href="./css/app.css">
<!-- Fonts -->
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Josefin+Sans&display=swap">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Sacramento&display=swap">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Noto+Naskh+Arabic&display=swap">
</head>
<body data-key="bfb9cfea33ab7ae21a315fbd6f065a815d3e20ff2f007aa2ca" >
<div id="invitation" >
<nav class="navbar bg-white navbar-expand fixed-bottom rounded-top-5 rounded-bottom-5 p-0" id="navbar-menu">
<ul class="navbar-nav nav-justified w-100 align-items-center">
<li class="nav-item">
<a class="nav-link" href="#home">
<i class="fa-solid fa-house"></i>
<span class="d-block" style="font-size: 0.7rem;">Home</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#mempelai">
<i class="fa-solid fa-user-group"></i>
<span class="d-block" style="font-size: 0.7rem;">Mempelai</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#tanggal">
<i class="fa-solid fa-calendar-check"></i>
<span class="d-block" style="font-size: 0.7rem;">Tanggal</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#galeri">
<i class="fa-solid fa-images"></i>
<span class="d-block" style="font-size: 0.7rem;">Galeri</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#ucapan">
<i class="fa-solid fa-comments"></i>
<span class="d-block" style="font-size: 0.7rem;">Ucapan</span>
</a>
</li>
</ul>
</nav>
<main class="text-light" data-bs-spy="scroll" data-bs-target="#navbar-menu" data-bs-root-margin="0px 0px -40%" data-bs-smooth-scroll="true" tabindex="0" >
<div class="particle-wrapper"></div>
<!-- Carousel for background slideshow -->
<div id="backgroundCarousel" class="carousel slide carousel-fade" data-bs-ride="carousel" style="position: fixed; width: 100%; height: 100%; z-index: -1; height: 100vh;">
<div class="carousel-inner">
<div class="carousel-item active">
<img src="./assets/images/bg1.jpeg" class="d-block w-100" style="height: 100vh; object-fit: cover;" alt="Background 1">
</div>
<div class="carousel-item">
<img src="./assets/images/bg2.jpeg" class="d-block w-100" style="height: 100vh; object-fit: cover;" alt="Background 2">
</div>
<div class="carousel-item">
<img src="./assets/images/bg3.jpeg" class="d-block w-100" style="height: 100vh; object-fit: cover;" alt="Background 3">
</div>
</div>
</div>
<!-- Home -->
<section class="container" id="home">
<div class="text-center pt-2">
<h1 class="font-esthetic my-4" style="font-size: 2.5rem;">Undangan Pernikahan</h1>
<h1 class="font-esthetic my-4 " style="font-size: 3rem;">Riski </h1>
<h1 class="font-esthetic my-4" style="font-size: 3rem; "> & </h1>
<h1 class="font-esthetic my-4" style="font-size: 3rem; ">Dhea</h1>
<p class="mb-0" style="font-size: 1.5rem;">Rabu, 15 Maret 2023</p>
<a class="btn btn-outline-light btn-sm shadow rounded-pill px-3 my-2" target="_blank" href="https://calendar.google.com/calendar/render?action=TEMPLATE&text=The%20Wedding%20of%20Wahyu%20and%20Riski&details=The%20Wedding%20of%20Wahyu%20and%20Riski%20%7C%2015%20Maret%202023%20%7C%20RT%2010%20RW%2002,%20Desa%20Pajerukan,%20Kec.%20Kalibagor,%20Kab.%20Banyumas,%20Jawa%20Tengah%2053191%20%7C%2010.00%20-%2011.00%20WIB&dates=20230315T100000/20230315T110000&location=https://goo.gl/maps/ALZR6FJZU3kxVwN86">
<i class="fa-solid fa-calendar-check me-2"></i>Save The Date
</a>
<div class="d-flex justify-content-center align-items-center mt-4 mb-2">
<div class="mouse-animation border border-2">
<div class="scroll-animation"></div>
</div>
</div>
<p class="m-0">Scroll Down</p>
</div>
</section>
<!-- Wave Separator -->
<svg xmlns="https://www.w3.org/2000/svg" viewBox="0 0 1440 320" class="color-theme-white">
<path fill="currentColor" fill-opacity="1" d="M0,160L48,144C96,128,192,96,288,106.7C384,117,480,171,576,165.3C672,160,768,96,864,96C960,96,1056,160,1152,154.7C1248,149,1344,75,1392,37.3L1440,0L1440,320L1392,320C1344,320,1248,320,1152,320C1056,320,960,320,864,320C768,320,672,320,576,320C480,320,384,320,288,320C192,320,96,320,48,320L0,320Z"></path>
</svg>
<!-- Mempelai -->
<section style="background-color: grey;" id="mempelai">
<div class="text-center">
<h1 class="font-arabic py-4 px-2" style="font-size: 2rem">بِسْمِ اللّٰهِ الرَّحْمٰنِ الرَّحِيْمِ</h1>
<!-- Love animation -->
<div class="position-relative">
<div class="position-absolute" style="top: 0%; right: 10%;">
<svg xmlns="https://www.w3.org/2000/svg" width="48" height="48" fill="currentColor" class="opacity-50" onload="util.animate(this, 500, 'animate-love')" viewBox="0 0 16 16">
<path d="m8 2.748-.717-.737C5.6.281 2.514.878 1.4 3.053c-.523 1.023-.641 2.5.314 4.385.92 1.815 2.834 3.989 6.286 6.357 3.452-2.368 5.365-4.542 6.286-6.357.955-1.886.838-3.362.314-4.385C13.486.878 10.4.28 8.717 2.01zM8 15C-7.333 4.868 3.279-3.04 7.824 1.143q.09.083.176.171a3 3 0 0 1 .176-.17C12.72-3.042 23.333 4.867 8 15" />
</svg>
</div>
</div>
<h1 class="font-esthetic py-4 px-2" style="font-size: 2rem">Assalamualaikum Warahmatullahi Wabarakatuh</h1>
<p class="pb-3 px-3">
Tanpa mengurangi rasa hormat. Kami mengundang Bapak/Ibu/Saudara/i serta kerabat
sekalian untuk menghadiri acara pernikahan kami:
</p>
<!-- Love animation -->
<div class="position-relative">
<div class="position-absolute" style="top: 0%; left: 10%;">
<svg xmlns="https://www.w3.org/2000/svg" width="48" height="48" fill="currentColor" class="opacity-50" onload="util.animate(this, 2000, 'animate-love')" viewBox="0 0 16 16">
<path d="m8 2.748-.717-.737C5.6.281 2.514.878 1.4 3.053c-.523 1.023-.641 2.5.314 4.385.92 1.815 2.834 3.989 6.286 6.357 3.452-2.368 5.365-4.542 6.286-6.357.955-1.886.838-3.362.314-4.385C13.486.878 10.4.28 8.717 2.01zM8 15C-7.333 4.868 3.279-3.04 7.824 1.143q.09.083.176.171a3 3 0 0 1 .176-.17C12.72-3.042 23.333 4.867 8 15" />
</svg>
</div>
</div>
<div class="overflow-x-hidden">
<div data-aos="fade-right" data-aos-duration="2000">
<div class="img-crop border border-3 border-light shadow my-4 mx-auto">
<img src="./assets/images/cowo.png" alt="cowo" onclick="util.modal(this)">
</div>
<h1 class="font-esthetic" style="font-size: 3rem;">Riski Siapa</h1>
<p class="mt-3 mb-0" style="font-size: 1.25rem;">Putra</p>
<p class="mb-0">Bapak ... & Ibu ...</p>
</div>
<!-- Love animation -->
<div class="position-relative">
<div class="position-absolute" style="top: 0%; right: 10%;">
<svg xmlns="https://www.w3.org/2000/svg" width="48" height="48" fill="currentColor" class="opacity-50" onload="util.animate(this, 3000, 'animate-love')" viewBox="0 0 16 16">
<path d="m8 2.748-.717-.737C5.6.281 2.514.878 1.4 3.053c-.523 1.023-.641 2.5.314 4.385.92 1.815 2.834 3.989 6.286 6.357 3.452-2.368 5.365-4.542 6.286-6.357.955-1.886.838-3.362.314-4.385C13.486.878 10.4.28 8.717 2.01zM8 15C-7.333 4.868 3.279-3.04 7.824 1.143q.09.083.176.171a3 3 0 0 1 .176-.17C12.72-3.042 23.333 4.867 8 15" />
</svg>
</div>
</div>
<h1 class="font-esthetic my-4" style="font-size: 4rem;">&</h1>
<!-- Love animation -->
<div class="position-relative">
<div class="position-absolute" style="top: 0%; left: 10%;">
<svg xmlns="https://www.w3.org/2000/svg" width="48" height="48" fill="currentColor" class="opacity-50" onload="util.animate(this, 2000, 'animate-love')" viewBox="0 0 16 16">
<path d="m8 2.748-.717-.737C5.6.281 2.514.878 1.4 3.053c-.523 1.023-.641 2.5.314 4.385.92 1.815 2.834 3.989 6.286 6.357 3.452-2.368 5.365-4.542 6.286-6.357.955-1.886.838-3.362.314-4.385C13.486.878 10.4.28 8.717 2.01zM8 15C-7.333 4.868 3.279-3.04 7.824 1.143q.09.083.176.171a3 3 0 0 1 .176-.17C12.72-3.042 23.333 4.867 8 15" />
</svg>
</div>
</div>
<div data-aos="fade-left" data-aos-duration="2000">
<div class="img-crop border border-3 border-light shadow my-4 mx-auto">
<img src="./assets/images/cewe.png" alt="cewe" onclick="util.modal(this)">
</div>
<h1 class="font-esthetic" style="font-size: 3rem;">Dhea Siapa</h1>
<p class="mt-3 mb-0" style="font-size: 1.25rem;">Putri</p>
<p class="mb-0">Bapak ... & Ibu ...</p>
</div>
</div>
<!-- Ballon animation -->
<div class="position-relative">
<div class="position-absolute" style="top: 0%; right: 5%;">
<svg xmlns="https://www.w3.org/2000/svg" width="48" height="48" fill="currentColor" class="opacity-50" onload="util.animate(this, 1500, 'animate-love')" viewBox="0 0 16 16">
<path fill-rule="evenodd" d="m8 2.42-.717-.737c-1.13-1.161-3.243-.777-4.01.72-.35.685-.451 1.707.236 3.062C4.16 6.753 5.52 8.32 8 10.042c2.479-1.723 3.839-3.29 4.491-4.577.687-1.355.587-2.377.236-3.061-.767-1.498-2.88-1.882-4.01-.721zm-.49 8.5c-10.78-7.44-3-13.155.359-10.063q.068.062.132.129.065-.067.132-.129c3.36-3.092 11.137 2.624.357 10.063l.235.468a.25.25 0 1 1-.448.224l-.008-.017c.008.11.02.202.037.29.054.27.161.488.419 1.003.288.578.235 1.15.076 1.629-.157.469-.422.867-.588 1.115l-.004.007a.25.25 0 1 1-.416-.278c.168-.252.4-.6.533-1.003.133-.396.163-.824-.049-1.246l-.013-.028c-.24-.48-.38-.758-.448-1.102a3 3 0 0 1-.052-.45l-.04.08a.25.25 0 1 1-.447-.224l.235-.468ZM6.013 2.06c-.649-.18-1.483.083-1.85.798-.131.258-.245.689-.08 1.335.063.244.414.198.487-.043.21-.697.627-1.447 1.359-1.692.217-.073.304-.337.084-.398"></path>
</svg>
</div>
</div>
</div>
</section>
<!-- Wave Separator -->
<svg xmlns="https://www.w3.org/2000/svg" viewBox="0 0 1440 320" class="color-theme-white">
<path fill="currentColor" fill-opacity="1" d="M0,192L40,181.3C80,171,160,149,240,149.3C320,149,400,171,480,165.3C560,160,640,128,720,128C800,128,880,160,960,186.7C1040,213,1120,235,1200,218.7C1280,203,1360,149,1400,122.7L1440,96L1440,0L1400,0C1360,0,1280,0,1200,0C1120,0,1040,0,960,0C880,0,800,0,720,0C640,0,560,0,480,0C400,0,320,0,240,0C160,0,80,0,40,0L0,0Z"></path>
</svg>
<!-- Firman Allah Subhanahu Wa Ta'ala -->
<div class="container">
<div class="text-center" data-aos="fade-up" data-aos-duration="2000">
<h1 class="font-esthetic mt-0 mb-3" style="font-size: 2rem">
Allah Subhanahu Wa Ta'ala berfirman
</h1>
<p style="font-size: 0.9rem;" class="px-2">
Dan di antara tanda-tanda (kebesaran)-Nya ialah Dia menciptakan pasangan-pasangan untukmu dari
jenismu sendiri, agar kamu cenderung dan merasa tenteram kepadanya, dan Dia menjadikan di antaramu
rasa kasih dan sayang. Sungguh, pada yang demikian itu benar-benar terdapat tanda-tanda
(kebesaran Allah) bagi kaum yang berpikir.
</p>
<p class="m-0 fw-bold">QS. Ar-Rum Ayat 21</p>
</div>
</div>
<!-- Ballon animation -->
<div class="position-relative">
<div class="position-absolute" style="top: 0%; left: 5%;">
<svg xmlns="https://www.w3.org/2000/svg" width="48" height="48" fill="currentColor" class="opacity-50" onload="util.animate(this, 4000, 'animate-love')" viewBox="0 0 16 16">
<path fill-rule="evenodd" d="m8 2.42-.717-.737c-1.13-1.161-3.243-.777-4.01.72-.35.685-.451 1.707.236 3.062C4.16 6.753 5.52 8.32 8 10.042c2.479-1.723 3.839-3.29 4.491-4.577.687-1.355.587-2.377.236-3.061-.767-1.498-2.88-1.882-4.01-.721zm-.49 8.5c-10.78-7.44-3-13.155.359-10.063q.068.062.132.129.065-.067.132-.129c3.36-3.092 11.137 2.624.357 10.063l.235.468a.25.25 0 1 1-.448.224l-.008-.017c.008.11.02.202.037.29.054.27.161.488.419 1.003.288.578.235 1.15.076 1.629-.157.469-.422.867-.588 1.115l-.004.007a.25.25 0 1 1-.416-.278c.168-.252.4-.6.533-1.003.133-.396.163-.824-.049-1.246l-.013-.028c-.24-.48-.38-.758-.448-1.102a3 3 0 0 1-.052-.45l-.04.08a.25.25 0 1 1-.447-.224l.235-.468ZM6.013 2.06c-.649-.18-1.483.083-1.85.798-.131.258-.245.689-.08 1.335.063.244.414.198.487-.043.21-.697.627-1.447 1.359-1.692.217-.073.304-.337.084-.398"></path>
</svg>
</div>
</div>
<!-- Wave Separator -->
<svg xmlns="https://www.w3.org/2000/svg" viewBox="0 0 1440 320" class="color-theme-white mt-3">
<path fill="currentColor" fill-opacity="1" d="M0,96L30,106.7C60,117,120,139,180,154.7C240,171,300,181,360,186.7C420,192,480,192,540,181.3C600,171,660,149,720,154.7C780,160,840,192,900,208C960,224,1020,224,1080,208C1140,192,1200,160,1260,138.7C1320,117,1380,107,1410,101.3L1440,96L1440,320L1410,320C1380,320,1320,320,1260,320C1200,320,1140,320,1080,320C1020,320,960,320,900,320C840,320,780,320,720,320C660,320,600,320,540,320C480,320,420,320,360,320C300,320,240,320,180,320C120,320,60,320,30,320L0,320Z"></path>
</svg>
<!-- Tanggal -->
<section style="background-color: grey;" class="dark-section " id="tanggal">
<div class="container">
<div class="text-center">
<h1 class="font-esthetic py-3" style="font-size: 2rem;">Waktu Menuju Acara</h1>
<div class="border rounded-pill shadow py-2 px-4 mx-2 mb-4">
<!-- Ganti waktunya pada data-waktu (sesuai format tersebut) -->
<div class="row justify-content-center" data-time="2024-01-01 00:00:00" id="count-down">
<div class="col-3 p-1">
<h2 class="d-inline m-0 p-0" id="day">0</h2><small class="ms-1 me-0 my-0 p-0 d-inline">Hari</small>
</div>
<div class="col-3 p-1">
<h2 class="d-inline m-0 p-0" id="hour">0</h2><small class="ms-1 me-0 my-0 p-0 d-inline">Jam</small>
</div>
<div class="col-3 p-1">
<h2 class="d-inline m-0 p-0" id="minute">0</h2><small class="ms-1 me-0 my-0 p-0 d-inline">Menit</small>
</div>
<div class="col-3 p-1">
<h2 class="d-inline m-0 p-0" id="second">0</h2><small class="ms-1 me-0 my-0 p-0 d-inline">Detik</small>
</div>
</div>
</div>
<p style="font-size: 0.9rem;" class="mt-4 py-2">
Dengan memohon rahmat dan ridho Allah Subhanahu Wa Ta'ala, insyaAllah kami akan menyelenggarakan
acara :
</p>
<!-- Love animation -->
<div class="position-relative">
<div class="position-absolute" style="top: 0%; right: 10%;">
<svg xmlns="https://www.w3.org/2000/svg" width="48" height="48" fill="currentColor" class="opacity-50" onload="util.animate(this, 3000, 'animate-love')" viewBox="0 0 16 16">
<path d="m8 2.748-.717-.737C5.6.281 2.514.878 1.4 3.053c-.523 1.023-.641 2.5.314 4.385.92 1.815 2.834 3.989 6.286 6.357 3.452-2.368 5.365-4.542 6.286-6.357.955-1.886.838-3.362.314-4.385C13.486.878 10.4.28 8.717 2.01zM8 15C-7.333 4.868 3.279-3.04 7.824 1.143q.09.083.176.171a3 3 0 0 1 .176-.17C12.72-3.042 23.333 4.867 8 15" />
</svg>
</div>
</div>
<div class="overflow-x-hidden">
<div class="py-2" data-aos="fade-right" data-aos-duration="1500">
<h1 class="font-esthetic" style="font-size: 2rem;">Akad</h1>
<p>Pukul 10.00 WIB - Selesai</p>
</div>
<div class="py-2" data-aos="fade-left" data-aos-duration="1500">
<h1 class="font-esthetic" style="font-size: 2rem;">Resepsi</h1>
<p>Pukul 13.00 WIB - Selesai</p>
</div>
</div>
<div class="py-2" data-aos="fade-up" data-aos-duration="1500">
<a style="color: black;" href="https://www.google.com/maps/@-8.5051308,118.6274948,0a,44.5y,22.74h,84.86t/data=!3m4!1e1!3m2!1sSb0-6cX8DXxCTw7flkCiaA!2e0" target="_blank" class="btn btn-outline-light btn-sm rounded-pill shadow-sm mb-2 px-3">
<i style="color: black;" class="fa-solid fa-map-location-dot me-2"></i>Lihat Google Maps
</a>
<p class="mb-0 mt-1 mx-1 pb-4" style="font-size: 0.9rem;">
RT 14 RW 01, Desa Timu, Kec. Bolo, Kab. Bima, Nusa Tenggara Barat
</p>
</div>
</div>
</div>
</section>
<!-- Love animation -->
<div class="position-relative">
<div class="position-absolute" style="top: 0%; left: 10%;">
<svg xmlns="https://www.w3.org/2000/svg" width="48" height="48" fill="currentColor" class="opacity-50" onload="util.animate(this, 2000, 'animate-love')" viewBox="0 0 16 16">
<path d="m8 2.748-.717-.737C5.6.281 2.514.878 1.4 3.053c-.523 1.023-.641 2.5.314 4.385.92 1.815 2.834 3.989 6.286 6.357 3.452-2.368 5.365-4.542 6.286-6.357.955-1.886.838-3.362.314-4.385C13.486.878 10.4.28 8.717 2.01zM8 15C-7.333 4.868 3.279-3.04 7.824 1.143q.09.083.176.171a3 3 0 0 1 .176-.17C12.72-3.042 23.333 4.867 8 15" />
</svg>
</div>
</div>
<!-- Galeri Foto -->
<section style="background-color: grey;" class="dark-section " id="galeri">
<div class="container pb-2 pt-4">
<div class="card-body border rounded-4 shadow p-3">
<h1 class="font-esthetic text-center py-3" data-aos="fade-down" data-aos-duration="1500" style="font-size: 2rem;">Galeri</h1>
<div id="carousel-image-one" data-aos="fade-up" data-aos-duration="1500" class="carousel slide" data-bs-ride="carousel">
<div class="carousel-indicators">
<button type="button" data-bs-target="#carousel-image-one" data-bs-slide-to="0" class="active" aria-current="true" aria-label="Slide 1"></button>
<button type="button" data-bs-target="#carousel-image-one" data-bs-slide-to="1" aria-label="Slide 2"></button>
<button type="button" data-bs-target="#carousel-image-one" data-bs-slide-to="2" aria-label="Slide 3"></button>
</div>
<div class="carousel-inner rounded-4">
<div class="carousel-item active">
<img src="https://picsum.photos/1280/720?random=1" alt="gambar 1" class="d-block w-100" onclick="util.modal(this)">
</div>
<div class="carousel-item">
<img src="https://picsum.photos/1280/720?random=2" alt="gambar 2" class="d-block w-100" onclick="util.modal(this)">
</div>
<div class="carousel-item">
<img src="https://picsum.photos/1280/720?random=3" alt="gambar 3" class="d-block w-100" onclick="util.modal(this)">
</div>
</div>
<button class="carousel-control-prev" type="button" data-bs-target="#carousel-image-one" data-bs-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="visually-hidden">Previous</span>
</button>
<button class="carousel-control-next" type="button" data-bs-target="#carousel-image-one" data-bs-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="visually-hidden">Next</span>
</button>
</div>
<div id="carousel-image-two" data-aos="fade-up" data-aos-duration="1500" class="carousel slide mt-4" data-bs-ride="carousel">
<div class="carousel-indicators">
<button type="button" data-bs-target="#carousel-image-two" data-bs-slide-to="0" class="active" aria-current="true" aria-label="Slide 1"></button>
<button type="button" data-bs-target="#carousel-image-two" data-bs-slide-to="1" aria-label="Slide 2"></button>
<button type="button" data-bs-target="#carousel-image-two" data-bs-slide-to="2" aria-label="Slide 3"></button>
</div>
<div class="carousel-inner rounded-4">
<div class="carousel-item active">
<img src="https://picsum.photos/1280/720?random=4" alt="gambar 4" class="d-block w-100" onclick="util.modal(this)">
</div>
<div class="carousel-item">
<img src="https://picsum.photos/1280/720?random=5" alt="gambar 5" class="d-block w-100" onclick="util.modal(this)">
</div>
<div class="carousel-item">
<img src="https://picsum.photos/1280/720?random=6" alt="gambar 6" class="d-block w-100" onclick="util.modal(this)">
</div>
</div>
<button class="carousel-control-prev" type="button" data-bs-target="#carousel-image-two" data-bs-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="visually-hidden">Previous</span>
</button>
<button class="carousel-control-next" type="button" data-bs-target="#carousel-image-two" data-bs-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="visually-hidden">Next</span>
</button>
</div>
</div>
</div>
</section>
<!-- Wave Separator -->
<svg xmlns="https://www.w3.org/2000/svg" viewBox="0 0 1440 320" class="color-theme-white">
<path fill="currentColor" fill-opacity="1" d="M0,96L30,106.7C60,117,120,139,180,154.7C240,171,300,181,360,186.7C420,192,480,192,540,181.3C600,171,660,149,720,154.7C780,160,840,192,900,208C960,224,1020,224,1080,208C1140,192,1200,160,1260,138.7C1320,117,1380,107,1410,101.3L1440,96L1440,0L1410,0C1380,0,1320,0,1260,0C1200,0,1140,0,1080,0C1020,0,960,0,900,0C840,0,780,0,720,0C660,0,600,0,540,0C480,0,420,0,360,0C300,0,240,0,180,0C120,0,60,0,30,0L0,0Z"></path>
</svg>
<div class="container">
<div class="py-4">
<div class="text-center">
<h1 class="font-esthetic mt-0 mb-3" style="font-size: 3rem;">Love Gift</h1>
<p class="mb-1" style="font-size: 0.9rem;">
Tanpa mengurangi rasa hormat, bagi anda yang ingin memberikan tanda kasih untuk kami,
dapat melalui :
</p>
<div class="overflow-x-hidden">
<div class="row justify-content-center">
<div class="col-5 card-body border rounded-4 shadow p-3 m-3" data-aos="fade-down" data-aos-duration="1500">
<img src="https://upload.wikimedia.org/wikipedia/id/thumb/5/55/BNI_logo.svg/640px-BNI_logo.svg.png" class="img-fluid w-50 rounded" alt="bni">
<p class="card-text mt-3 mb-0" style="font-size: 0.9rem;">No. Rekening 123456789</p>
<p class="card-text" style="font-size: 0.9rem;">a.n Lorem ipsum dolor</p>
<!-- Ubah juga data-copy sesuai dengan no rekening -->
<button class="btn btn-light btn-sm rounded-3" data-copy="123456789" onclick="util.copy(this, 'Tersalin')" autofocus>Salin No. Rekening</button>
</div>
<div class="col-5 card-body border rounded-4 shadow p-3 m-3" data-aos="fade-down" data-aos-duration="1500">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/6/68/BANK_BRI_logo.svg/640px-BANK_BRI_logo.svg.png" class="img-fluid w-50 rounded" alt="bri">
<p class="card-text mt-3 mb-0" style="font-size: 0.9rem;">No. Rekening 123456789</p>
<p class="card-text" style="font-size: 0.9rem;">a.n Lorem ipsum dolor</p>
<!-- Ubah juga data-copy sesuai dengan no rekening -->
<button class="btn btn-light btn-sm rounded-3" data-copy="123456789" onclick="util.copy(this, 'Tersalin')" autofocus>Salin No. Rekening</button>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Comments -->
<section class="m-0 p-0" id="ucapan">
<div class="container">
<div class="card-body border rounded-4 shadow p-3">
<h1 class="font-esthetic text-center mb-3" style="font-size: 3rem;">Ucapan & Doa</h1>
<div class="mb-1" id="response"></div>
<div class="mb-3">
<label for="form-name" class="form-label">Nama</label>
<input type="text" class="form-control shadow-sm" id="form-name" placeholder="Isikan Nama Anda">
</div>
<div class="mb-3">
<label for="form-presence" class="form-label" id="label-attendance">Kehadiran</label>
<select class="form-select shadow-sm" id="form-presence">
<option value="0" selected>Konfirmasi Kehadiran</option>
<option value="1">Hadir</option>
<option value="2">Berhalangan</option>
</select>
</div>
<div class="mb-3">
<label for="form-comment" class="form-label">Ucapan & Doa</label>
<div id="information" class="alert alert-info alert-dismissible fade show" role="alert">
<p style="font-size: 1.5rem;">Bestieee!!!</p>
<p class="m-0">Sekarang bisa format text seperti whatsapp lohh... cobainn sekaranggg, makaciwww bestieee</p>
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close" onclick="localStorage.setItem('alertClosed', 'true');"></button>
</div>
<textarea class="form-control shadow-sm" id="form-comment" rows="4" placeholder="Tulis Ucapan & Doa"></textarea>
</div>
<div class="d-grid">
<button class="btn btn-primary btn-sm rounded-3 shadow m-1" onclick="util.comment.send(this)">
<i class="fa-solid fa-paper-plane me-1"></i>Send
</button>
</div>
</div>
<div class="mt-4 mb-2" id="comments"></div>
<nav class="d-flex justify-content-center mb-0">
<ul class="pagination mb-0">
<li class="page-item disabled" id="previous">
<button class="page-link" onclick="pagination.previous(this)">
<i class="fa-solid fa-circle-left me-1"></i>Previous
</button>
</li>
<li class="page-item disabled">
<span class="page-link text-light" id="page">1</span>
</li>
<li class="page-item" id="next">
<button class="page-link" onclick="pagination.next(this)">
Next<i class="fa-solid fa-circle-right ms-1"></i>
</button>
</li>
</ul>
</nav>
</div>
</section>
<!-- Wave Separator -->
<svg xmlns="https://www.w3.org/2000/svg" viewBox="0 0 1440 320" class="color-theme-white">
<path fill="currentColor" fill-opacity="1" d="M0,224L34.3,234.7C68.6,245,137,267,206,266.7C274.3,267,343,245,411,234.7C480,224,549,224,617,213.3C685.7,203,754,181,823,197.3C891.4,213,960,267,1029,266.7C1097.1,267,1166,213,1234,192C1302.9,171,1371,181,1406,186.7L1440,192L1440,320L1405.7,320C1371.4,320,1303,320,1234,320C1165.7,320,1097,320,1029,320C960,320,891,320,823,320C754.3,320,686,320,617,320C548.6,320,480,320,411,320C342.9,320,274,320,206,320C137.1,320,69,320,34,320L0,320Z"></path>
</svg>
</main>
<!-- Footer Undangan -->
<footer style="color: white; background-color:grey">
<div class="container">
<div class="text-center">
<p style="font-size: 0.9rem;" class="pt-2 pb-1 px-2" data-aos="fade-up" data-aos-duration="1500">
Merupakan suatu kehormatan dan kebahagiaan bagi kami apabila, Bapak / Ibu / Saudara / i.
berkenan hadir untuk memberikan do'a restunya kami ucapkan terimakasih.
</p>
<h1 class="font-esthetic" data-aos="fade-up">Wassalamualaikum Warahmatullahi Wabarakatuh</h1>
<h1 class="font-arabic py-4 px-2" data-aos="fade-up" data-aos-duration="2000" style="font-size: 2rem;">اَلْحَمْدُ لِلّٰهِ رَبِّ الْعٰلَمِيْنَۙ</h1>
<hr class="mt-3 mb-2">
<div class="row align-items-center justify-content-between flex-column flex-sm-row">
<div class="col-auto">
<small class="text-dark">
Build with<i class="fa-solid fa-heart mx-1"></i>Anhar
</small>
</div>
<div class="col-auto">
<small>
<i class="fa-brands fa-facebook me-1"></i><a style="color: black;" target="_blank" href="https://www.facebook.com/profile.php?id=100093961165463">Anhar</a>
</small>
<small>
<i class="fa-brands fa-whatsapp me-1"></i><a style="color: black;" target="_blank" href="https://wa.me/6287841947229">6287841947229</a>
</small>
</div>
</div>
</div>
</div>
</footer>
<!-- Theme Button -->
<button type="button" id="button-theme" style="display: none;" class="btn bg-dark border border-2 btn-sm rounded-circle btn-theme" onclick="theme.change()">
<i class="fa-solid fa-circle-half-stroke"></i>
</button>
<!-- Audio Button -->
<button type="button" id="button-music" style="display: none;" class="btn bg-dark border border-2 btn-sm rounded-circle btn-music" onclick="audio.button(this)" data-status="true" data-url="./assets/music/sound.mp3">
<i class="fa-solid fa-circle-pause spin-button"></i>
</button>
<!-- Modal Image Large -->
<div class="modal fade" id="modal-image" tabindex="-1" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered modal-xl">
<div class="modal-content rounded-4">
<div class="modal-body p-0">
<div class="d-flex justify-content-center align-items-center" style="height: 100%;">
<img src="./assets/images/bg.jpeg" class="w-100" alt="image" id="show-modal-image">
</div>
</div>
</div>
</div>
</div>
</div>
<div id="welcome" class="loading-page" style="position: relative; height: 100vh;">
<!-- Carousel for background slideshow -->
<div id="backgroundCarousel" class="carousel slide carousel-fade" data-bs-ride="carousel" style="position: absolute; width: 100%; height: 100%; z-index: -1;">
<div class="carousel-inner">
<div class="carousel-item active">
<img src="./assets/images/bg1.jpeg" class="d-block w-100" style="height: 100vh; object-fit: cover;" alt="Background 1">
</div>
<div class="carousel-item">
<img src="./assets/images/bg2.jpeg" class="d-block w-100" style="height: 100vh; object-fit: cover;" alt="Background 2">
</div>
<div class="carousel-item">
<img src="./assets/images/bg3.jpeg" class="d-block w-100" style="height: 100vh; object-fit: cover;" alt="Background 3">
</div>
</div>
</div>
<!-- Content -->
<div class="d-flex justify-content-center" style="height: 100%; positon: fixed; font-weight: 700; ">
<div class="text-center text-light mt-5">
<h1 class="font-esthetic" style="font-size: 2.5rem; text-shadow: 2px 0px 0px rgba(255, 255, 255, 0.7);">The Wedding Of</h1>
<h1 class="font-esthetic my-4 text-center " style="font-size: 2.5rem; text-shadow: 2px 0px 0px rgba(255, 255, 255, 0.7); position: absolute; bottom: 20%; left:75px"> Riski & Dhea</h1>
<div style="position: absolute; bottom: 18%;" id="guest-name" data-message="Kepada Yth Bapak/Ibu/Saudara/i">Kepada Yth Bapak/Ibu/Saudara/i</div>
<button id="invitation-button" type="button" class="btn btn-dark shadow rounded-4" onclick="util.open(this)"
style="position: absolute; bottom: 10%; left: 50%; transform: translateX(-50%);">
<i class="fa-solid fa-envelope-open me-2"></i>Open Invitation
</button>
</div>
</div>
</div>
<!-- Loading page -->
<div class="loading-page bg-black" id="loading" style="opacity: 1;">
<div class="d-flex justify-content-center align-items-center" style="height: 100vh !important;">
<div class="w-75 text-center">
<img class="img-fluid mb-3" src="./assets/images/icon-192x192.png" alt="icon" style="width: 3.5rem;">
<div class="progress" role="progressbar" style="height: 0.5rem;">
<div class="progress-bar" id="progress-bar" style="width: 0%"></div>
</div>
<small class="mt-1 text-light" id="progress-info" style="display: none;">Loading asset</small>
<noscript>
<small class="mt-1 text-danger">Sorry, this invitation requires javascript to work</small>
</noscript>
</div>
</div>
</div>
<script>
function updateProgress(percentage, info) {
const progressBar = document.getElementById('progress-bar');
const progressInfo = document.getElementById('progress-info');
progressBar.style.width = percentage + '%';
if (info) {
progressInfo.style.display = 'block';
progressInfo.textContent = info;
}
}
function hideLoadingPage() {
const loadingPage = document.getElementById('loading');
loadingPage.style.opacity = '0';
setTimeout(() => {
loadingPage.style.display = 'none';
}, 500);
}
let progress = 0;
const progressInterval = setInterval(() => {
if (progress < 100) {
progress += 10;
updateProgress(progress, `Loading ${progress}%...`);
} else {
clearInterval(progressInterval);
updateProgress(100, 'Done!');
setTimeout(hideLoadingPage, 1000);
}
}, 500);
const util = {
open: async function(button) {
const invitation = document.getElementById('invitation');
const welcome = document.getElementById('welcome');
const body = document.body;
const dataKey = body.getAttribute('data-key');
console.log('Data Key:', dataKey);
invitation.style.display = 'block';
welcome.style.display = 'none';
button.disabled = true;
confetti({
origin: { y: 1 },
zIndex: 1057
});
AOS.init({
duration: 3000, // Animation duration in milliseconds
once: false, // Animation happens only once
});
AOS.refresh(); // Ensure AOS is refreshed
},
animate: function(svg, timeout, classes) {
let handler = setTimeout(() => {
svg.classList.add(classes);
clearTimeout(handler); // Clear the timeout to avoid memory leaks
}, timeout);
},
countDownDate: function() {
const until = document.getElementById('count-down').getAttribute('data-time').replace(' ', 'T');
const count = (new Date(until)).getTime();
setInterval(() => {
const distance = Math.abs(count - (new Date()).getTime());
document.getElementById('day').innerText = Math.floor(distance / (1000 * 60 * 60 * 24));
document.getElementById('hour').innerText = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
document.getElementById('minute').innerText = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
document.getElementById('second').innerText = Math.floor((distance % (1000 * 60)) / 1000);
}, 1000);
},
opacity: function(id, speed = 0.01) {
const element = document.getElementById(id);
let op = parseInt(element.style.opacity);
let clear = null;
clear = setInterval(() => {
if (op > 0) {
element.style.opacity = op.toString();
op -= speed;
} else {
clearInterval(clear);
clear = null;
element.remove();
}
}, 10);
},
escapeHtml: function(unsafe) {
return unsafe
.replace(/&/g, '&')
.replace(/</g, '<')
.replace(/>/g, '>')
.replace(/"/g, '"')
.replace(/'/g, ''');
},
disableButton: function(button, message = 'Loading..') {
button.disabled = true;
let tmp = button.innerHTML;
button.innerHTML = message;
const restore = () => {
button.innerHTML = tmp;
button.disabled = false;
};
return {
restore,
};
},
show: function() {
util.guest();
util.opacity('loading', 0.025);
window.scrollTo(0, 0);
},
modal: function(img) {
document.getElementById('show-modal-image').src = img.src;
(new bootstrap.Modal('#modal-image')).show();
},
copy: async function(button, message, timeout = 1500) {
try {
await navigator.clipboard.writeText(button.getAttribute('data-copy'));
} catch {
alert('Failed to copy');
return;
}
button.disabled = true;
let tmp = button.innerText;
button.innerText = message;
let clear = null;
clear = setTimeout(() => {
button.disabled = false;
button.innerText = tmp;
clearTimeout(clear);
clear = null;
return;
}, timeout);
},
animation: function() {
const duration = 15 * 1000;
const animationEnd = Date.now() + duration;
const colors = ["#FFC0CB", "#FF1493", "#C71585"];
const randomInRange = (min, max) => {
return Math.random() * (max - min) + min;
};
const heart = confetti.shapeFromPath({
path: 'M167 72c19,-38 37,-56 75,-56 42,0 76,33 76,75 0,76 -76,151 -151,227 -76,-76 -151,-151 -151,-227 0,-42 33,-75 75,-75 38,0 57,18 76,56z',
matrix: [0.03333333333333333, 0, 0, 0.03333333333333333, -5.566666666666666, -5.533333333333333]
});
(function frame() {
const timeLeft = animationEnd - Date.now();
colors.forEach((color) => {
confetti({
particleCount: 1,
startVelocity: 0,
ticks: Math.max(50, 75 * (timeLeft / duration)),
origin: {
x: Math.random(),
y: Math.abs(Math.random() - (timeLeft / duration)),
},
zIndex: 1057,
colors: [color],
shapes: [heart],
drift: randomInRange(-0.5, 0.5),
gravity: randomInRange(0.5, 1),
scalar: randomInRange(0.5, 1),
});
});
if (timeLeft > 0) {
requestAnimationFrame(frame);
}
})();
},
comment: {
send: async function(button) {
const name = document.getElementById('form-name').value;
const presence = document.getElementById('form-presence').value;
const commentText = document.getElementById('form-comment').value;
if (name && presence && commentText) {
const commentData = {
name: name,
presence: presence,
comment: commentText,
likes: 0, // Initial likes set to 0
likedBy: {}, // To track users who liked the comment
replies: {} // Add this line to handle replies
};
const newCommentKey = firebase.database().ref().child('comments').push().key;
const updates = {};
updates['/comments/' + newCommentKey] = commentData;
await firebase.database().ref().update(updates);
document.getElementById('form-name').value = '';
document.getElementById('form-presence').value = '0';
document.getElementById('form-comment').value = '';
} else {
alert('Please fill all fields');
}
},
retrieveComments: function() {
firebase.database().ref('comments/').on('value', (snapshot) => {
const commentsContainer = document.getElementById('comments');
commentsContainer.innerHTML = '';
const data = snapshot.val();
for (let key in data) {
const comment = data[key];
const commentElement = document.createElement('div');
commentElement.className = 'comment mb-3';
commentElement.id = key;
let repliesCount = 0;
// Count replies
if (comment.replies) {
repliesCount = Object.keys(comment.replies).length;
}
commentElement.innerHTML = `
<div class="card bg-grey border">
<div class="card-body">
<h5 class="card-title" style="color: white;">${comment.name}/-
<span class="card-subtitle mb-2"
style="color: ${comment.presence === '1' ? 'blue' : 'red'};">
${comment.presence === '1' ? 'Hadir' : 'Berhalangan'}
</span>
</h5>
<p class="card-text" style="color: white;">${comment.comment}</p>
<button class="btn btn-sm btn-outline-primary" onclick="util.comment.reply(this)" data-uuid="${key}">Reply</button>
<span class="badge bg-secondary" onclick="util.comment.toggleReplies('${key}')">Replies (${repliesCount})</span>
<div id="replies-${key}" class="replies" style="display: none;"></div>
<button class="btn btn-sm btn-outline-success float-end" onclick="util.comment.like(this)" data-uuid="${key}">
<i class="fa fa-thumbs-up"></i> Like (${comment.likes || 0})
</button>
</div>
</div>`;
commentsContainer.appendChild(commentElement);
// Retrieve and display replies
if (comment.replies) {
const repliesContainer = document.getElementById(`replies-${key}`);
for (let replyKey in comment.replies) {
const reply = comment.replies[replyKey];
const replyElement = document.createElement('div');
replyElement.className = 'reply mb-2';
replyElement.id = replyKey;
replyElement.innerHTML = `
<div class="card bg-grey border mt-2">
<div class="card-body">
<h6 class="card-title" style="color: lightgreen;">${reply.name}</h6>
<p class="card-text" style="color: lightgray;">${reply.comment}</p>
<button class="btn btn-sm btn-outline-success float-end" onclick="util.comment.likeReply(this)" data-comment="${key}" data-reply="${replyKey}">
<i class="fa fa-thumbs-up"></i> Like (${reply.likes || 0})
</button>
</div>
</div>`;
repliesContainer.appendChild(replyElement);
}
}
}
});
},
reply: function(button) {
const commentKey = button.getAttribute('data-uuid');
const replyName = prompt('Enter your name:');
const replyText = prompt('Enter your reply:');
if (replyName && replyText) {
const replyData = {
name: replyName,
comment: replyText,
likes: 0, // Initial likes set to 0
likedBy: {} // To track users who liked the reply
};
const newReplyKey = firebase.database().ref().child('comments/' + commentKey + '/replies').push().key;
const updates = {};
updates['/comments/' + commentKey + '/replies/' + newReplyKey] = replyData;
firebase.database().ref().update(updates);
}
},
like: function(button) {
const commentKey = button.getAttribute('data-uuid');
const userId = 'currentUser'; // Ganti dengan ID pengguna saat ini
const likesRef = firebase.database().ref('comments/' + commentKey + '/likes');
const likedByRef = firebase.database().ref('comments/' + commentKey + '/likedBy/' + userId);
likedByRef.once('value', (snapshot) => {
if (snapshot.exists()) {
// If user has already liked, remove the like
likesRef.transaction((currentLikes) => {
return (currentLikes || 0) - 1;
});
likedByRef.remove();
button.innerHTML = `<i class="fa fa-thumbs-up"></i> Like (${parseInt(button.textContent.split(' ')[2]) - 1})`;
} else {
// If user has not liked, add the like
likesRef.transaction((currentLikes) => {
return (currentLikes || 0) + 1;
});
likedByRef.set(true);
button.innerHTML = `<i class="fa fa-thumbs-up"></i> Like (${parseInt(button.textContent.split(' ')[2]) + 1})`;
}
});
},
likeReply: function(button) {
const commentKey = button.getAttribute('data-comment');
const replyKey = button.getAttribute('data-reply');
const userId = 'currentUser'; // Ganti dengan ID pengguna saat ini
const likesRef = firebase.database().ref(`comments/${commentKey}/replies/${replyKey}/likes`);
const likedByRef = firebase.database().ref(`comments/${commentKey}/replies/${replyKey}/likedBy/${userId}`);
likedByRef.once('value', (snapshot) => {
if (snapshot.exists()) {
// If user has already liked, remove the like
likesRef.transaction((currentLikes) => {
return (currentLikes || 0) - 1;
});
likedByRef.remove();
button.innerHTML = `<i class="fa fa-thumbs-up"></i> Like (${parseInt(button.textContent.split(' ')[2]) - 1})`;
} else {
// If user has not liked, add the like
likesRef.transaction((currentLikes) => {
return (currentLikes || 0) + 1;
});
likedByRef.set(true);
button.innerHTML = `<i class="fa fa-thumbs-up"></i> Like (${parseInt(button.textContent.split(' ')[2]) + 1})`;
}
});
},
toggleReplies: function(commentKey) {
const repliesContainer = document.getElementById(`replies-${commentKey}`);
if (repliesContainer.style.display === 'none') {
repliesContainer.style.display = 'block';
} else {
repliesContainer.style.display = 'none';
}
}
}
};
// Ensure DOM is fully loaded before retrieving comments
document.addEventListener('DOMContentLoaded', util.comment.retrieveComments);