-
Notifications
You must be signed in to change notification settings - Fork 0
/
prod.html
1019 lines (831 loc) · 42.8 KB
/
prod.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 lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>ApproVideo - Appropriate Technology Videos for the DIY Sector - September 2024</title>
<script src="https://cdn.tailwindcss.com"></script>
<script type="module">
import videoData from './videoData2b.js';
window.videoData = videoData;
</script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css">
<link rel="stylesheet" href="style8.css">
<style>
footer {
position: relative;
top: 250px;
overflow: display;
bottom: 100px;
}
.landscape {
position: absolute;
bottom: 0px;
left: 0;
width: 200%;
background-image: url("gyyy5r.webp"); /* Or PNG, GIF, etc. */
animation: landscapeScroll 15s linear infinite; /* Adjust duration as needed */
}
@keyframes landscapeScroll {
0% {
transform: translateX(0);
}
100% {
transform: translateX(-50%);
}
}
/* Optional: Add some "jumpiness" to the animation */
.landscape img {
image-rendering: pixelated; /* Ensure the image stays pixelated even when scaled */
animation: jump 0.5s steps(1) infinite; /* Adjust timing as needed */
}
@keyframes jump {
0% {
transform: translateY(0);
}
50% {
transform: translateY(-2px); /* Adjust the jump height as needed */
}
100% {
transform: translateY(0);
}
}
#mondrian-box {
transition: all 0.3s ease-in-out;
max-height: 50vh;
overflow-y: auto;
}
#subcategory-links a {
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
transition: all 0.3s ease-in-out;
}
#subcategory-links a:hover {
transform: translateY(-5px);
box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15);
}
#close-detail-x {
transition: transform 0.3s ease;
}
#close-detail-x:hover {
transform: scale(1.1);
}
#edit-detail, #add-content {
transition: transform 0.2s ease-in-out;
}
#edit-detail:hover {
transform: scale(1.1);
}
.header .absolute {
z-index: 10; /* Ensure buttons are above other header content */
}
#add-content-modal {
transition: opacity 0.3s ease-in-out;
z-index:10000;
}
#add-content-modal.hidden {
opacity: 0;
pointer-events: none;
}
#add-content-modal:not(.hidden) {
opacity: 1;
}
body.dark #add-content {
text: #fff !important;
}
#add-content {
text: #000;
position: abslolute;
right:65px;
}
#add-content-form input:focus,
#add-content-form textarea:focus,
#add-content-form select:focus {
border-color: #4299e1;
box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.5);
}
#video-player-btn {
background: none;
border: none;
cursor: pointer;
font-size: 1.5rem;
color: #fff;
transition: color 0.3s ease;
position: relative;
right: 108px;
}
body.dark #video-player-btn {
color: #fff;
}
#video-player-btn:hover {
color: #3B82F6; /* Tailwind's blue-500 */
}
</style>
<div class="embossed-background"></div>
<div class="absolute top-2 right-2 flex items-center space-x-2">
<button id="add-content" class="theme-toggle text-2xl p-2 bg-white bg-opacity-80 rounded-full shadow-md hover:bg-opacity-100 transition-all duration-300">
<i class="fas fa-plus-circle"></i>
</button>
<button id="spacer" class="theme-toggle text-2xl p-2 bg-white bg-opacity-80 rounded-full shadow-md hover:bg-opacity-100 transition-all duration-300">
<i class="fas fa-plus-circle"></i>
</button>
<button id="theme-toggle" class="theme-toggle text-2xl">
<i class="fas fa-sun" id="theme-toggle-light-icon"></i>
<i class="fas fa-moon hidden text-white" id="theme-toggle-dark-icon"></i>
</button>
</div>
<div class="floating-icons">
<a href="#" class="flex items-center px-3 py-2 rounded-md hover:bg-opacity-20 hover:bg-white" data-category="Drinking Water"><i class="fas fa-tint fa-3x floating-icon" style="--i:1;"></i></a>
<i class="fas fa-recycle fa-3x floating-icon" style="--i:2;"></i>
<i class="fas fa-solar-panel fa-3x floating-icon" style="--i:3;"></i>
<i class="fas fa-heartbeat fa-3x floating-icon" style="--i:4;"></i>
</div>
<div class="header relative overflow-hidden">
<div class="container mx-auto flex justify-center space-x-8">
<div class="group">
<a href="#" class="flex items-center px-4 py-3 rounded-md hover:bg-opacity-20 hover:bg-white" data-category="Shelter">
<i class="fas fa-home mr-2"></i>
</a>
<div class="drop-up-menu absolute hidden group-hover:block bg-white shadow-md rounded-md mt-2 py-2 z-10">
<a href="#" class="drop-up-item category-link" data-category="Temporary Shelter">Temporary Shelter</a>
<a href="#" class="drop-up-item category-link" data-category="Permanent Housing">Permanent Housing</a>
<a href="#" class="drop-up-item category-link" data-category="Insulation">Insulation</a>
<a href="#" class="drop-up-item category-link" data-category="Ventilation">Ventilation</a>
<a href="#" class="drop-up-item category-link" data-category="Natural Building">Natural Building</a>
</div>
</div>
<div class="group">
<a href="#" class="flex items-center px-3 py-2 rounded-md hover:bg-opacity-20 hover:bg-white" data-category="Drinking Water">
<i class="fas fa-tint mr-2"></i>
</a>
<div class="drop-up-menu">
<a href="#" class="drop-up-item category-link" data-category="Water Filtration">Filtration</a>
<a href="#" class="drop-up-item category-link" data-category="Urban Water">*Urban</a>
<a href="#" class="drop-up-item category-link" data-category="Water Purification">Purification</a>
<a href="#" class="drop-up-item category-link" data-category="Drinking Water Storrage">Storage</a>
<a href="#" class="drop-up-item category-link" data-category="Water Distribution">Distribution</a>
</div>
</div>
<div class="group">
<a href="#" class="flex items-center px-3 py-2 rounded-md hover:bg-opacity-20 hover:bg-white" data-category="Waste Management">
<i class="fas fa-recycle mr-2"></i>
</a>
<div class="drop-up-menu">
<a href="#" class="drop-up-item" data-category="Composting">Composting</a>
<a href="#" class="drop-up-item" data-category="Recycling">Recycling</a>
<a href="#" class="drop-up-item" data-category="Upcycling">Upcycling</a>
<a href="#" class="drop-up-item" data-category="Hygiene">Health & Hygiene</a>
<a href="#" class="drop-up-item" data-category="Zero Waste">Zero Waste</a>
</div>
</div>
ApproVideo
<div class="group">
<a href="#" class="flex items-center px-3 py-2 rounded-md hover:bg-opacity-20 hover:bg-white" data-category="Energy">
<i class="fas fa-solar-panel mr-2"></i>
</a>
<div class="drop-up-menu">u
<a href="#" class="drop-up-item" data-category="Solar">Solar</a>
<a href="#" class="drop-up-item" data-category="Wind">Wind</a>
<a href="#" class="drop-up-item" data-category="Hydropower">Hydropower</a>
<a href="#" class="drop-up-item" data-category="Biogas">Biogas</a>
<a href="#" class="drop-up-item" data-category="Motors">Motors</a>
<a href="#" class="drop-up-item" data-category="Wiring">Wiring</a>
<a href="#" class="drop-up-item" data-category="Compressors">Compressors</a>
<a href="#" class="drop-up-item" data-category="HVAC">HVAC</a>
<a href="#" class="drop-up-item" data-category="Plumbing">Plumbing</a>
<a href="#" class="drop-up-item" data-category="Design">Design</a>
</div>
</div>
<div class="group">
<a href="#" class="flex items-center px-3 py-2 rounded-md hover:bg-opacity-20 hover:bg-white" data-category="Appropriate Tech.">
<i class="fas fa-heartbeat mr-2"></i>
</a>
<div class="drop-up-menu">
<a href="#" class="drop-up-item" data-category="Agriculture">Agriculture</a>
<a href="#" class="drop-up-item" data-category="Construction">Construction</a>
<a href="#" class="drop-up-item" data-category="People">People</a>
<a href="#" class="drop-up-item" data-category="Healthcare">Healthcare</a>
<a href="#" class="drop-up-item" data-category="ptsd">PTSD Care</a>
<a href="#" class="drop-up-item" data-category="field-medicine">Field Medicine</a>
<a href="#" class="drop-up-item" data-category="Education">Education</a>
</div>
</div>
<div class="group">
<a href="#" class="flex items-center px-4 py-3 rounded-md hover:bg-opacity-20 hover:bg-white" data-category="Sustainable Ag">
<i class="fas fa-seedling mr-2"></i>
</a>
<div class="drop-up-menu">
<a href="#" class="drop-up-item">Integrated Pest Management</a>
<a href="#" class="drop-up-item" data-category="Soil Improvement">Soil Improvement</a>
<a href="#" class="drop-up-item" data-category="Cover Cropping">Cover Cropping</a>
<a href="#" class="drop-up-item" data-category="Diversified Agriculture">Diversified Agriculture</a>
<a href="#" class="drop-up-item" data-category="Specialty Crops">Specialty Crops</a>
<a href="#" class="drop-up-item" data-category="Organic Techniques">Organic Techniques</a>
</div>
</div>
</div>
<div class="floating-icons">
<div class="floating-icons">
<i class="fas fa-tint fa-2x floating-icon" style="--i:1;"></i>
<i class="fas fa-recycle fa-2x floating-icon" style="--i:2;"></i>
<i class="fas fa-solar-panel fa-2x floating-icon" style="--i:3;"></i>
<i class="fas fa-heartbeat fa-2x floating-icon" style="--i:4;"></i>
<i class="fas fa-leaf fa-2x floating-icon" style="--i:5;"></i>
<i class="fas fa-seedling fa-2x floating-icon" style="--i:6;"></i>
<i class="fas fa-water fa-2x floating-icon" style="--i:7;"></i>
<i class="fas fa-wind fa-2x floating-icon" style="--i:8;"></i>
</div>
</div>
<div class="subheader">Appropriate Technology Videos for the DIY Sector</div>
</div>
<div class="p-4 mt-4">
<div class="mb-4 flex justify-center space-x-4">
<a href="#" class="category-link bg-blue-500/50 hover:bg-blue-500/80 dark:text-white text-black font-semibold py-2 px-4 border-2 dark:border-white border-blue rounded-full shadow-sm transition duration-300 ease-in-out flex items-center" data-category="Drinking Water">
<i class="fas fa-tint mr-2 text-xl"></i>
<span>Drinking Water</span>
</a>
<a href="#" class="category-link bg-green-500/50 hover:bg-green-500/80 dark:text-white text-black font-semibold py-2 px-4 border-2 dark:border-white border-blue rounded-full shadow-sm transition duration-300 ease-in-out flex items-center" data-category="Waste Management">
<i class="fas fa-recycle mr-2 text-xl"></i>
<span>Waste Management</span>
</a>
<a href="#" class="category-link bg-yellow-500/50 hover:bg-yellow-500/80 dark:text-white text-black font-semibold py-2 px-4 border-2 dark:border-white border-blue rounded-full shadow-sm transition duration-300 ease-in-out flex items-center" data-category="Energy">
<i class="fas fa-solar-panel mr-2 text-xl"></i>
<span>Energy Systems</span>
</a>
<a href="#" class="category-link bg-red-500/50 hover:bg-red-500/80 dark:text-white text-black font-semibold py-2 px-4 border-2 dark:border-white border-blue rounded-full shadow-sm transition duration-300 ease-in-out flex items-center" data-category="Health">
<i class="fas fa-heartbeat mr-2 text-xl"></i>
<span>Appropriate Tech</span>
</a>
</div>
<div class="mb-4">
<input type="text" id="search" placeholder="Search videos..." class="w-full p-2 border rounded dark:bg-gray-700 dark:text-white">
</div>
<div id="mondrian-box" class="relative left-0 right-0 bg-white dark:bg-gray-800 p-4 hidden">
<div id="subcategory-links" class="flex flex-wrap justify-center"></div>
</div>
<div id="categories" class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4"></div>
</div>
<div id="video-detail" class="fixed inset-0 bg-opacity-50 overflow-y-auto h-full w-full hidden">
<div class="relative top-20 mx-auto p-5 border w-11/12 md:w-3/4 lg:w-1/2 shadow-lg rounded-md">
<div>
<button id="close-detail-x" class="absolute top-2 right-2 text-white-600 hover:text-gray-900 dark:text-gray-300 dark:hover:text-white">
<svg class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
</svg>
</button>
<button id="edit-detail" class="absolute top-2 left-2 text-blue-600 hover:text-blue-800 dark:text-blue-400 dark:hover:text-blue-200">
<i class="fas fa-edit h-6 w-6"></i>
</button>
</div>
<div class="curved-line"></div>
<div class="curved-line"></div>
<div class="curved-line"></div>
<div class="curved-line"></div>
<div id="video-content"></div>
<div class="text-center mt-4">
<button id="close-detail" class="px-4 py-2 bg-gray-500 text-white text-base font-medium rounded-md shadow-sm hover:bg-gray-600 focus:outline-none focus:ring-2 focus:ring-gray-300">
Close
</button>
</div>
</div>
</div>
<div id="add-content-modal" class="fixed inset-0 bg-gray-600 bg-opacity-50 overflow-y-auto h-full w-full hidden">
<div class="relative top-20 mx-auto p-5 border w-11/12 md:w-3/4 lg:w-1/2 shadow-lg rounded-md bg-white">
<div class="mt-3 text-center">
<h3 class="text-lg leading-6 font-medium text-gray-900">Add New Content</h3>
<form id="add-content-form" class="mt-2 text-left">
<div class="mb-4">
<label for="content-type" class="block text-gray-700 text-sm font-bold mb-2">Content Type</label>
<select id="content-type" name="content-type" class="shadow border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline">
<option value="video">Video</option>
<option value="suggestion">Suggestion</option>
</select>
</div>
<div class="mb-4">
<label for="title" class="block text-gray-700 text-sm font-bold mb-2">Title</label>
<input type="text" id="title" name="title" class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline" required>
</div>
<div class="mb-4">
<label for="description" class="block text-gray-700 text-sm font-bold mb-2">Description</label>
<textarea id="description" name="description" class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline" rows="3" required></textarea>
</div>
<div id="video-fields" class="mb-4">
<label for="video-url" class="block text-gray-700 text-sm font-bold mb-2">Video URL</label>
<input type="url" id="video-url" name="video-url" class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline">
</div>
<div class="mb-4">
<label for="category" class="block text-gray-700 text-sm font-bold mb-2">Category</label>
<select id="category" name="category" class="shadow border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline" required>
<option value="">Select a category</option>
<option value="Drinking Water">Drinking Water</option>
<option value="Waste Management">Waste Management</option>
<option value="Energy Systems">Energy Systems</option>
<option value="Appropriate Tech">Appropriate Tech</option>
</select>
</div>
<div class="mb-4">
<label for="tags" class="block text-gray-700 text-sm font-bold mb-2">Tags (comma-separated)</label>
<input type="text" id="tags" name="tags" class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline">
</div>
<div class="flex items-center justify-between mt-4">
<button type="submit" class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded focus:outline-none focus:shadow-outline">
Submit
</button>
<button type="button" id="close-modal" class="bg-gray-500 hover:bg-gray-700 text-white font-bold py-2 px-4 rounded focus:outline-none focus:shadow-outline">
Cancel
</button>
</div>
</form>
</div>
</div>
</div>
<footer class="footer-gradient dark:footer-gradient-light text-gray-800 dark:text-gray-200 py-12 mt-12 transition-colors duration-300">
<div class="landscape">
<img src="gyyy5r.webp" alt="Approvideo Sept 2024 - blocky landscape 0">
</div>
<div class="container mx-auto px-4">
<div class="flex flex-wrap justify-between items-start">
<div class="w-full md:w-1/3 mb-8 md:mb-0">
<h3 class="footer-title mb-2 text-3xl font-bold bg-clip-text text-transparent bg-gradient-to-r from-blue-500 to-green-500">ApproVideo</h3>
<p class="footer-subtitle text-lg">Appropriate Technology Videos for the DIY Sector</p>
<div class="mt-4 relative overflow-hidden cursor-pointer" id="mission-reveal">
<p class="text-sm font-semibold">Our Mission (Click to reveal)</p>
<div class="mission-text hidden mt-2 p-4 bg-white dark:bg-gray-800 rounded-lg shadow-lg transform transition-all duration-500 ease-in-out">
<p>To empower individuals and communities with accessible, sustainable technology solutions through educational videos.</p>
</div>
</div>
</div>
<div class="w-full md:w-1/3 mb-8 md:mb-0">
<h4 class="text-xl font-semibold mb-4 text-blue-600 dark:text-blue-400">Quick Links</h4>
<ul class="space-y-2">
<li><a href="https://github.com/yourusername/approtech" class="footer-link hover:text-green-500 transition duration-300 flex items-center"><i class="fab fa-github mr-2"></i>GitHub Repository</a></li>
<li><a href="https://www.gnu.org/licenses/gpl-3.0.en.html" class="footer-link hover:text-green-500 transition duration-300 flex items-center"><i class="fas fa-balance-scale mr-2"></i>GPL v3 License</a></li>
<li><a href="https://scdhub.org" class="footer-link hover:text-green-500 transition duration-300 flex items-center"><i class="fas fa-globe mr-2"></i>SCD Hub Website</a></li>
</ul>
</div>
<div class="w-full md:w-1/3 flex flex-col items-center md:items-end">
<a href="https://scdhub.org/donate" class="bg-gradient-to-r from-blue-500 to-green-500 hover:from-blue-600 hover:to-green-600 text-white font-bold py-3 px-6 rounded-full transition duration-300 mb-4 transform hover:scale-105">
What this is.
</a>
<button href="/suggest" class="share-button bg-gradient-to-r from-purple-500 to-pink-500 hover:from-purple-600 hover:to-pink-600 text-white font-bold py-3 px-6 rounded-full transform hover:scale-105 transition duration-300">
Add Content
</button>
</div>
</div>
<div class="mt-12 pt-8 border-t border-gray-700 dark:border-gray-300 text-center text-sm">
<p>© 2024 ApproVideo. All rights reserved. | <a href="#" class="footer-link hover:text-blue-400 transition duration-300">Privacy Policy</a> | <a href="#" class="footer-link hover:text-blue-400 transition duration-300">Terms of Service</a></p>
<p class="mt-2">A project of SCD Hub 501(c)(3)</p>
</div>
</div>
</footer>
<script>
function toggleSublinks(category) {
const dropUpMenus = document.querySelectorAll('.drop-up-menu');
dropUpMenus.forEach(menu => {
const parentCategory = menu.closest('.group').querySelector('a').getAttribute('data-category');
if (parentCategory === category) {
menu.classList.toggle('hidden');
} else {
menu.classList.add('hidden'); // Hide other menus
}
});
}
function renderStars(rating) {
const fullStars = Math.floor(rating);
const halfStar = rating % 1 >= 0.5 ? 1 : 0;
const emptyStars = 5 - fullStars - halfStar;
return '★'.repeat(fullStars) + (halfStar ? '½' : '') + '☆'.repeat(emptyStars);
}
function setupFloatingIcons() {
const header = document.querySelector('.header');
const icons = document.querySelectorAll('.floating-icon');
icons.forEach((icon, index) => {
icon.style.left = `${Math.random() * 100}%`;
icon.style.top = `${Math.random() * 100}%`;
setTimeout(() => {
icon.classList.add('active');
}, 1400 + (index * 100)); // Staggered delay starting at 1.4 seconds
});
header.addEventListener('mousemove', (e) => {
const { left, top, width, height } = header.getBoundingClientRect();
const x = (e.clientX - left) / width - 0.5;
const y = (e.clientY - top) / height - 0.5;
icons.forEach((icon) => {
const speed = parseFloat(icon.style.getPropertyValue('--i')) * 2;
const rotateX = y * speed;
const rotateY = -x * speed;
const translateZ = Math.abs(x * y) * 50;
icon.style.transform = `perspective(1000px) rotateX(${rotateX}deg) rotateY(${rotateY}deg) translateZ(${translateZ}px)`;
});
});
header.addEventListener('mouseleave', () => {
icons.forEach((icon) => {
icon.style.transform = 'perspective(1000px) rotateX(0deg) rotateY(0deg) translateZ(0)';
});
});
}
function setupVideoDetailListeners() {
document.querySelectorAll('.video-detail-link').forEach(link => {
link.addEventListener('click', function(e) {
e.preventDefault();
const videoId = this.getAttribute('data-id');
const video = window.videoData.find(v => v.id === videoId);
if (video) {
document.getElementById('video-content').innerHTML = renderVideoDetails(video);
document.getElementById('video-detail').classList.remove('hidden');
// Load a new background image each time the modal is opened
document.getElementById('video-detail').style.backgroundImage = `url('https://source.unsplash.com/1600x900/?sky,night,stars&random=${new Date().getTime()}')`;
setupPanelNavigation();
}
});
});
}
function setupPanelNavigation() {
const panels = document.querySelectorAll('.info-panel');
const prevBtn = document.getElementById('prev-panel');
const nextBtn = document.getElementById('next-panel');
let currentPanel = 0;
function updatePanels() {
panels.forEach((panel, index) => {
panel.classList.toggle('active', index === currentPanel);
});
prevBtn.disabled = currentPanel === 0;
nextBtn.disabled = currentPanel === panels.length - 1;
}
prevBtn.addEventListener('click', () => {
if (currentPanel > 0) {
currentPanel--;
updatePanels();
}
});
nextBtn.addEventListener('click', () => {
if (currentPanel < panels.length - 1) {
currentPanel++;
updatePanels();
}
});
updatePanels();
}
function setupEventListeners() {
document.getElementById('search').addEventListener('input', filterAndSortVideos);
document.getElementById('categories').addEventListener('click', handleVideoDetailClick);
document.getElementById('close-detail').addEventListener('click', closeVideoDetail);
document.querySelectorAll('.category-link').forEach(link => {
link.addEventListener('click', handleCategoryClick);
});
// Single event listener on the header for both main categories and dropdown items
document.querySelector('.header').addEventListener('click', (e) => {
const target = e.target.closest('a');
if (target) {
e.preventDefault();
if (target.classList.contains('category-link')) {
const category = target.getAttribute('data-category');
toggleSublinks(category); // Toggle sublinks
} else if (target.classList.contains('drop-up-item')) {
const category = target.getAttribute('data-category');
const tag = target.getAttribute('data-tag');
// Update URL and filter videos
const urlParams = new URLSearchParams(window.location.search);
urlParams.set('category', category);
urlParams.set('tag', tag);
history.pushState(null, '', `?${urlParams.toString()}`);
filterAndSortVideos();
// Hide the dropdown after clicking a sublink
target.closest('.drop-up-menu').classList.add('hidden');
}
let category, tag;
if (target.classList.contains('category-link')) {
category = target.getAttribute('data-category');
} else if (target.classList.contains('drop-up-item')) {
category = target.getAttribute('data-category');
tag = target.getAttribute('data-tag');
}
if (category) {
// Clear the search field
const searchInput = document.getElementById('search');
if (searchInput) {
searchInput.value = '';
}
}
// Update URL and filter videos
const urlParams = new URLSearchParams(window.location.search);
if (tag) {
urlParams.set('tag', tag);
} else {
urlParams.delete('tag');
}
history.pushState(null, '', `?${urlParams.toString()}`);
filterAndSortVideos();
}
});
setupThemeToggle();
// Handle initial page load with URL parameters
filterAndSortVideos();
}
function slugify(text) {
return text.toString().toLowerCase()
.replace(/\s+/g, '-')
.replace(/[^\w\-]+/g, '')
.replace(/\-\-+/g, '-')
.replace(/^-+/, '')
.replace(/-+$/, '');
}
function renderVideo(video) {
const mainCategory = video.categories[0];
const mainTag = video.tags[0];
const detailUrl = `/${slugify(mainCategory)}/${slugify(mainTag)}/${slugify(video.title)}`;
return `
<div class="video-card rounded-lg shadow-md p-4 mb-4">
<h3 class="text-xl font-semibold mb-2">${video.title}</h3>
<div class="aspect-w-16 aspect-h-9 mb-2">
<img src="https://img.youtube.com/vi/${video.youtubeId}/0.jpg" alt="${video.title}" class="w-full h-64 object-cover">
</div>
<p class="mb-2">${video.description}</p>
<div class="flex flex-wrap mb-2">
${video.tags.map(tag => `
<a href="#" class="video-tag tag text-sm font-medium mr-2 mb-2 px-2.5 py-0.5 rounded cursor-pointer bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-300 hover:bg-blue-200 dark:hover:bg-blue-800 transition-colors duration-200" data-tag="${tag}">
${tag}
</a>
`).join('')}
</div>
<div class="text-yellow-400">${renderStars(video.rating)}</div>
<div class="text-sm opacity-75">Date: ${video.date}</div>
<a href="${detailUrl}" class="mt-2 inline-block bg-blue-500 text-white px-4 py-2 rounded hover:bg-blue-600 video-detail-link" data-id="${video.id}">View Details</a>
</div>
`;
}
function setupTagListeners() {
document.querySelectorAll('.video-tag').forEach(tagLink => {
tagLink.addEventListener('click', function(e) {
e.preventDefault();
const tag = this.getAttribute('data-tag');
filterByTag(tag);
});
});
}
function filterByTag(tag) {
const urlParams = new URLSearchParams(window.location.search);
urlParams.set('tag', tag);
history.pushState(null, '', `?${urlParams.toString()}`);
filterAndSortVideos();
}
function renderVideoDetails(video) {
let detailsHTML = `
<h1 class="text-3xl font-bold mb-4 text-orange-700 dark:text-blue-400">${video.title}</h1>
<div class="aspect-w-16 aspect-h-9 mb-4">
<iframe src="https://www.youtube.com/embed/${video.youtubeId}" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen class="w-full h-96"></iframe>
</div>
<p class="mb-4 text-gray-700 dark:text-gray-300">${video.description}</p>
<div class="mb-4">
${video.tags.map(tag => `<span class="tag text-sm font-medium mr-2 px-2.5 py-0.5 rounded cursor-pointer bg-orange-100 text-orange-800 dark:bg-gray-700 dark:text-blue-300">${tag}</span>`).join('')}
</div>
<div class="text-yellow-600 dark:text-yellow-400 mb-2">${renderStars(video.rating)}</div>
<p class="text-sm opacity-75 mb-4 text-gray-600 dark:text-gray-400">Date: ${video.date}</p>
<h2 class="text-2xl font-bold mb-2 text-orange-700 dark:text-blue-400">Materials Needed:</h2>
<ul class="list-disc list-inside mb-4 text-gray-700 dark:text-gray-300">
${video.materials.map(material => `<li>${material}</li>`).join('')}
</ul>
<h2 class="text-2xl font-bold mb-2 text-orange-700 dark:text-blue-400">Steps:</h2>
<ol class="list-decimal list-inside mb-4 text-gray-700 dark:text-gray-300">
${video.steps.map(step => `<li>${step}</li>`).join('')}
</ol>
<h2 class="text-2xl font-bold mb-2 text-orange-700 dark:text-blue-400">Transcript:</h2>
<p class="mb-4 text-gray-700 dark:text-gray-300">${video.transcript}</p>
`;
if (video.panels && video.panels.length > 0) {
detailsHTML += `
<h2 class="text-2xl font-bold mb-2">Additional Information:</h2>
<div class="panel-container">
${video.panels.map((panel, index) => `
<div class="info-panel ${index === 0 ? 'active' : ''}" data-panel-index="${index}">
<h3 class="text-lg font-semibold mb-2">${panel.title}</h3>
<p class="text-sm">${panel.content}</p>
<i class="panel-icon fas fa-${getPanelIcon(panel.title)}"></i>
</div>
`).join('')}
</div>
<div class="panel-nav">
<button id="prev-panel" disabled>Previous</button>
<button id="next-panel" ${video.panels.length > 1 ? '' : 'disabled'}>Next</button>
</div>
`;
}
return detailsHTML;
}
function getPanelIcon(title) {
const iconMap = {
'Temperature Control': 'thermometer-half',
'Moisture Management': 'tint',
'Pile Location': 'map-marker-alt',
'Aeration': 'wind',
'Function of a First Flush Diverter': 'filter',
'Choosing the Right Size': 'ruler',
'Maintenance Tips': 'tools',
'Safety Precautions': 'hard-hat'
};
return iconMap[title] || 'info-circle';
}
function renderCategories(videos) {
const categoriesContainer = document.getElementById('categories');
if (videos.length === 0) {
categoriesContainer.innerHTML = '<p class="text-center text-gray-500">No videos found. Try adjusting your search.</p>';
} else {
categoriesContainer.innerHTML = videos.map(renderVideo).join('');
setupTagListeners(); // Add this line to set up the tag listeners after rendering
}
setupVideoDetailListeners();
}
function filterAndSortVideos() {
const searchTerm = document.getElementById('search').value.toLowerCase();
const urlParams = new URLSearchParams(window.location.search);
const category = urlParams.get('category');
const tag = urlParams.get('tag');
let filteredVideos = window.videoData.filter(video => {
// Check if video matches the category or tag (if specified)
const categoryMatch = !category || video.categories.some(cat => cat.toLowerCase().includes(category.toLowerCase()));
const tagMatch = !tag || video.tags.some(t => t.toLowerCase().includes(tag.toLowerCase()));
// Check if video matches the search term
const searchMatch =
video.title.toLowerCase().includes(searchTerm) ||
video.description.toLowerCase().includes(searchTerm) ||
video.categories.some(cat => cat.toLowerCase().includes(searchTerm)) ||
video.tags.some(t => t.toLowerCase().includes(searchTerm));
// Return true if the video matches the search term AND (matches category OR tag OR neither are specified)
return searchMatch && (categoryMatch || tagMatch || (!category && !tag));
});
// Sort videos by rating (assuming higher rating is better)
filteredVideos.sort((a, b) => b.rating - a.rating);
renderCategories(filteredVideos);
}
function renderCategories(videos) {
const categoriesContainer = document.getElementById('categories');
if (videos.length === 0) {
categoriesContainer.innerHTML = '<p class="text-center text-gray-500">No videos found. Try adjusting your search.</p>';
} else {
categoriesContainer.innerHTML = videos.map(renderVideo).join('');
}
setupVideoDetailListeners();
}
function handleVideoDetailClick(e) {
if (e.target.classList.contains('video-detail-link')) {
e.preventDefault();
const videoId = e.target.getAttribute('data-id');
const video = window.videoData.find(v => v.id === videoId);
if (video) {
document.getElementById('video-content').innerHTML = renderVideoDetails(video);
document.getElementById('video-detail').classList.remove('hidden');
setupPanelNavigation();
}
}
}
function closeVideoDetail() {
document.getElementById('video-detail').classList.add('hidden');
}
function handleCategoryClick(e) {
e.preventDefault();
const category = this.getAttribute('data-category');
history.pushState(null, '', `?category=${category}`);
filterAndSortVideos();
}
function setupThemeToggle() {
const themeToggleBtn = document.getElementById('theme-toggle');
const themeToggleDarkIcon = document.getElementById('theme-toggle-dark-icon');
const themeToggleLightIcon = document.getElementById('theme-toggle-light-icon');
function setTheme(isDark) {
document.body.classList.remove(isDark ? 'light' : 'dark');
document.body.classList.add(isDark ? 'dark' : 'light');
themeToggleDarkIcon.classList.toggle('hidden', !isDark);
themeToggleLightIcon.classList.toggle('hidden', isDark);
// Force a repaint of the video detail overlay if it's open
const videoDetail = document.getElementById('video-detail');
if (!videoDetail.classList.contains('hidden')) {
videoDetail.style.display = 'none';
videoDetail.offsetHeight; // Force a repaint
videoDetail.style.display = '';
}
// Store the user's preference
localStorage.setItem('darkMode', isDark);
}
function toggleTheme() {
const isDark = document.body.classList.contains('dark');
setTheme(!isDark);
}
// Check for saved user preference
const savedDarkMode = localStorage.getItem('darkMode');
if (savedDarkMode !== null) {
setTheme(JSON.parse(savedDarkMode));
} else {
const prefersDarkScheme = window.matchMedia("(prefers-color-scheme: dark)");
setTheme(prefersDarkScheme.matches);
}
themeToggleBtn.addEventListener('click', toggleTheme);
}
document.getElementById('edit-detail').addEventListener('click', function() {
const videoId = this.closest('#video-detail').getAttribute('data-video-id');
console.log('Edit video with ID:', videoId);
// Implement your edit functionality here
});
// Add content button
document.getElementById('add-content').addEventListener('click', function() {
console.log('Add new content');
// Implement your add content functionality here
});
// Initial setup
document.addEventListener('DOMContentLoaded', () => {
const missionReveal = document.getElementById('mission-reveal');
const missionText = missionReveal.querySelector('.mission-text');
const addContentButton = document.getElementById('add-content');
const addContentModal = document.getElementById('add-content-modal');
const closeModalButton = document.getElementById('close-modal');
const addContentForm = document.getElementById('add-content-form');
const contentTypeSelect = document.getElementById('content-type');
const videoFields = document.getElementById('video-fields');
addContentButton.addEventListener('click', () => {
addContentModal.classList.remove('hidden');
});
closeModalButton.addEventListener('click', () => {
addContentModal.classList.add('hidden');
});
contentTypeSelect.addEventListener('change', () => {
if (contentTypeSelect.value === 'video') {
videoFields.style.display = 'block';
} else {
videoFields.style.display = 'none';
}
});
addContentForm.addEventListener('submit', (e) => {
e.preventDefault();
const formData = new FormData(addContentForm);
const data = Object.fromEntries(formData.entries());
// Here you would typically send this data to your server or Supabase
console.log('Form data:', data);
// For demonstration, we'll just log it and close the modal
alert('Content submitted successfully!');
addContentModal.classList.add('hidden');
addContentForm.reset();
});
function closeVideoDetail() {
document.getElementById('video-detail').classList.add('hidden');
}
// Existing close button
document.getElementById('close-detail').addEventListener('click', closeVideoDetail);
// New close button (X)
document.getElementById('close-detail-x').addEventListener('click', closeVideoDetail);
document.body.addEventListener('click', (e) => {
const target = e.target.closest('a');
if (!target) return;
e.preventDefault();
let category, tag;
if (target.closest('.header')) {
// Header links
if (target.classList.contains('drop-up-item')) {
category = target.closest('.group').querySelector('a').getAttribute('data-category');
tag = target.textContent.trim();
} else {
category = target.getAttribute('data-category');
toggleSublinks(category);
return; // Exit early for main category toggles
}
} else if (target.classList.contains('category-link')) {
// Bottom category links
category = target.getAttribute('data-category');
}
if (category) {
const urlParams = new URLSearchParams(window.location.search);
urlParams.set('category', category);
if (tag) {
urlParams.set('tag', tag);
} else {
urlParams.delete('tag');
}
history.pushState(null, '', `?${urlParams.toString()}`);
filterAndSortVideos();
// Hide all dropdowns
document.querySelectorAll('.drop-up-menu').forEach(menu => menu.classList.add('hidden'));
}
});
missionReveal.addEventListener('click', () => {
missionText.classList.toggle('hidden');
missionText.classList.toggle('active');
});
// Hover effect for links
const links = document.querySelectorAll('.footer-link');
links.forEach(link => {
link.addEventListener('mouseenter', () => {
link.style.transform = 'translateX(5px)';
});
link.addEventListener('mouseleave', () => {
link.style.transform = 'translateX(0)';
});