-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
887 lines (713 loc) · 39.7 KB
/
index.html
File metadata and controls
887 lines (713 loc) · 39.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
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Avian Elegance Landing • Natura11y</title>
<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=DM+Serif+Display:ital@0;1&family=Lato:ital,wght@0,400;0,900;1,400;1,900&display=swap" rel="stylesheet">
<!-- Natura11y Icons -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/natura11y-icons@v2/dist/natura11y-icons.min.css">
<!-- Natura11y Stylesheet -->
<link rel="stylesheet" href="../../../../dist/natura11y.css">
<!-- Custom Stylesheet -->
<link rel="stylesheet" href="./style.css">
</head>
<body class="box-shadow-3">
<div class='skip-links'>
<a href="#main" data-i18n="skip-main">
Jump to main content
</a>
<a href="#global-footer" data-i18n="skip-footer">
Jump to website footer
</a>
</div>
<header>
<div class="main-menu--stack--lg drop-shadow-1">
<div class="main-menu__logo">
<a href="#1" title="Home" data-logo="brand">
<!-- Placeholder logo, replace the following <svg> tag with your own -->
<svg xmlns="http://www.w3.org/2000/svg" width="126" height="34" viewBox="0 0 126 34" role="img" aria-label="Placeholder Logo">
<g>
<polygon points="8 25 8 1 0 1 0 33 3 33 8 33 16 33 16 25 8 25"/>
<path d="M35,0A17,17,0,1,0,52,17,17,17,0,0,0,35,0Zm0,26a9,9,0,1,1,9-9A9,9,0,0,1,35,26Z"/>
<path d="M109,0a17,17,0,1,0,17,17A17,17,0,0,0,109,0Zm0,26a9,9,0,1,1,9-9A9,9,0,0,1,109,26Z"/>
<path d="M88.95,16H72v6h7.4824a9,9,0,1,1,0-10H88.25A17.0052,17.0052,0,1,0,89,17C89,16.6624,88.9689,16.3327,88.95,16Z"/>
</g>
</svg>
</a>
</div>
<div class="main-menu__toggle">
<button
class="mobile-menu-toggle button button--icon-only"
aria-label="Menu"
data-toggle="collapse"
aria-controls="main-menu"
aria-expanded="false">
<span class="icon icon-menu"></span>
</button>
</div>
<form class="main-menu__search" role="search" id="search" data-focus-first>
<div class="form-entry form-entry--search">
<div class="form-entry__field">
<span class="form-entry__field__input">
<input
type="search"
name="global-search"
aria-label="Search"
id="search-input" />
<button
type="button"
class="button button--icon-only"
data-search-clear
aria-label="Clear search"
aria-controls="search-input"
>
<span class="icon icon-clear" aria-hidden="true"></span>
</button>
<button
class="button button--icon-only theme-dark"
aria-label="Search"
type="submit">
<span class="icon icon-search" aria-hidden="true"></span>
</button>
</span>
</div>
</div>
</form>
<div class="main-menu__actions">
<button
class="button theme-primary"
data-modal="open"
aria-controls="language-modal"
>
<span class="icon icon-language" aria-hidden="true"></span>
<span data-lang-label>English</span>
</button>
</div>
<nav class="main-menu__nav" id="main-menu" aria-label="Main Menu">
<ul>
<li>
<div class="dropdown-link-split">
<a href="#1" class="text" data-i18n="nav-discover">Discover</a>
<button
data-toggle="dropdown"
aria-controls="dropdown-1"
aria-expanded="false"
data-hover="true"
></button>
</div>
<div class="mega-menu--lg box-shadow-1--lg padding-4" id="dropdown-1">
<div class="grid grid--column-2 grid--column-4--lg gap-4 font-size-md">
<nav>
<p>
<strong data-i18n="mega-birds-of-prey">Birds of Prey</strong>
</p>
<ul class="nav">
<li>
<a href="#1" data-i18n="mega-falcons">Falcons</a>
</li>
<li>
<a href="#1" data-i18n="mega-eagles">Eagles</a>
</li>
<li>
<a href="#1" data-i18n="mega-hawks">Hawks</a>
</li>
<li>
<a href="#1" data-i18n="mega-owls">Owls</a>
</li>
</ul>
</nav>
<nav>
<p>
<strong data-i18n="mega-waterfowl">Waterfowl</strong>
</p>
<ul class="nav">
<li>
<a href="#1" data-i18n="mega-herons">Herons</a>
</li>
<li>
<a href="#1" data-i18n="mega-egrets">Egrets</a>
</li>
<li>
<a href="#1" data-i18n="mega-kingfishers">Kingfishers</a>
</li>
<li>
<a href="#1" data-i18n="mega-pelicans">Pelicans</a>
</li>
</ul>
</nav>
<nav>
<p>
<strong data-i18n="mega-songbirds">Songbirds</strong>
</p>
<ul class="nav">
<li>
<a href="#1" data-i18n="mega-warblers">Warblers</a>
</li>
<li>
<a href="#1" data-i18n="mega-thrushes">Thrushes</a>
</li>
<li>
<a href="#1" data-i18n="mega-finches">Finches</a>
</li>
<li>
<a href="#1" data-i18n="mega-sparrows">Sparrows</a>
</li>
</ul>
</nav>
<nav>
<p>
<strong data-i18n="mega-tropical">Tropical</strong>
</p>
<ul class="nav">
<li>
<a href="#1" data-i18n="mega-parrots">Parrots</a>
</li>
<li>
<a href="#1" data-i18n="mega-toucans">Toucans</a>
</li>
<li>
<a href="#1" data-i18n="mega-macaws">Macaws</a>
</li>
<li>
<a href="#1" data-i18n="mega-hummingbirds">Hummingbirds</a>
</li>
</ul>
</nav>
</div>
</div>
</li>
<li>
<a href="#1" data-i18n="nav-species">
Species
</a>
</li>
<li>
<a href="#1" data-i18n="nav-habitats">
Habitats
</a>
</li>
<li>
<a href="#1" data-i18n="nav-conservation">
Conservation
</a>
</li>
<li>
<a href="#1" data-i18n="nav-gallery">
Gallery
</a>
</li>
</ul>
</nav>
</div>
</header>
<main id="skip-header-target">
<section class="backdrop backdrop--stack--lg theme-dark" id="introduction">
<div class="backdrop__media position-relative">
<img class="opacity-50--lg gradient-mask-bottom" src="./images/daniil-komov-oC4QFTsi6Rg-unsplash.jpg" alt="Placeholder" />
<div class="backdrop__media__credit margin-1">
<p>Photo by <a href="https://unsplash.com/@dkomov7" target="_blank">Daniil Komov</a> on Unsplash</p>
</div>
</div>
<div class="backdrop__cover">
<div class="container medium text-align-center padding-y-4">
<h1 class="banner-headline text-shadow--lg margin-bottom-4 text-shadow" data-i18n="hero-heading">
Birds Play a Vital Role in Healthy Ecosystems
</h1>
<a class="button button--has-icon theme-primary box-shadow-1--lg" href="#1">
<span class="button__text" data-i18n="hero-cta">Explore Birds</span>
<span class="icon icon-arrow-right"></span>
</a>
</div>
</div>
</section>
<section class="theme-dark overflow-hidden">
<div class="margin-y-6">
<h2 class="screen-reader-only">
Vel Facilisis Volutpat
</h2>
<div class="container narrow wide--lg">
<div class="grid grid--column-2--lg gap-2">
<div class="backdrop backdrop--fixed theme-dark aspect-ratio-1x1 border-radius-2">
<div class="backdrop__media">
<img src="./images/ray-hennessy-8YcUN7F_-6c-unsplash-01.jpg" alt="Placeholder" />
<div class="backdrop__media__credit margin-1">
<p>
Photo by <a href="https://unsplash.com/@rayhennessy" target="_blank">Ray Hennessy</a> on Unsplash
</p>
</div>
</div>
</div>
<div class="backdrop backdrop--fixed theme-dark aspect-ratio-1x1 border-radius-2">
<div class="backdrop__media">
<img class="opacity-30" src="./images/ray-hennessy-8YcUN7F_-6c-unsplash-02.jpg" alt="Placeholder" />
</div>
<div class="backdrop__cover">
<div class="container narrow margin-y-4">
<div class="text-shadow margin-bottom-3">
<h2 data-i18n="section2-heading">
Natural Beauty
</h2>
<p data-i18n="section2-body">
Birds are one of the most diverse and fascinating life forms on the planet. Their plumage, songs, and behaviors fill us with wonder and connect us to the natural world.
</p>
</div>
<a href="#1" class="button button--has-icon theme-canvas">
<span class="button__text" data-i18n="section2-cta">Become a Birder</span>
<span class="icon icon-arrow-right"></span>
</a>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<section class="theme-primary overflow-hidden padding-y-6">
<div class="container narrow wide--lg">
<div class="grid grid--column-2--lg gap-5 align-items-center">
<div>
<p class="font-size-md text-transform-uppercase margin-bottom-0">
<strong data-i18n="section3-eyebrow">
The Avian World
</strong>
</p>
<h2 class="banner-headline" data-i18n="section3-heading">
Every species tells a unique story.
</h2>
<p data-i18n="section3-body">
From tropical rainforests to arctic tundra, birds inhabit every corner of our planet, adapting to the most extreme environments with breathtaking grace.
</p>
<a class="button button--has-icon theme-canvas" href="#1">
<span class="button__text" data-i18n="section3-cta">View Gallery</span>
<span class="icon icon-arrow-right"></span>
</a>
</div>
<div class="grid grid--column-2 gap-2">
<a class="backdrop backdrop--fixed grid__rowspan-2 border-radius-2" href="#1">
<div class="backdrop__media">
<img src="./images/hans-veth-vyQgv-eURTU-unsplash.jpg" alt="Placeholder" />
</div>
<div class="backdrop__cover justify-content-end">
<div class="container margin-y-2">
<p class="padding-x-2 padding-y-1 theme-light border-radius-1 font-size-sm">
Photo by
<span class="text-decoration-underline">
Hans Veth
</span>
on Unsplash
</p>
</div>
</div>
</a>
<a class="backdrop border-radius-2" href="https://unsplash.com/@tracminhvu" target="_blank">
<div class="backdrop__media">
<img src="./images/trac-vu-KvmW-LLy2m0-unsplash.jpg" alt="Placeholder" />
</div>
<div class="backdrop__cover justify-content-end">
<div class="container margin-y-2">
<p class="padding-x-2 padding-y-1 theme-light border-radius-1 font-size-sm">
Photo by
<span class="text-decoration-underline">
Trac Vu
</span>
on Unsplash
</p>
</div>
</div>
</a>
<a class="backdrop border-radius-2" href="https://unsplash.com/@sree97" target="_blank">
<div class="backdrop__media">
<img class="opacity-80" src="./images/sreenivas-a1f-hNNoMGg-unsplash.jpg" alt="Placeholder" />
</div>
<div class="backdrop__cover justify-content-end">
<div class="container margin-y-2">
<p class="padding-x-2 padding-y-1 theme-light border-radius-1 font-size-sm">
Photo by
<span class="text-decoration-underline">
Sreenivas
</span>
on Unsplash
</p>
</div>
</div>
</a>
</div>
</div>
</div>
</section>
<section class="theme-light padding-y-5">
<div class="container narrow medium--lg margin-bottom-4 text-align-center">
<h2 data-i18n="cards-heading">
Featured Bird Species
</h2>
<p class="font-size-lg" data-i18n="cards-intro">
Explore a selection of remarkable birds from around the world. Each species displays unique behaviors, colors, and adaptations.
</p>
</div>
<div class="container narrow wide--lg">
<div class="grid grid--column-2--md grid--column-4--lg gap-2 align-items-center">
<div class="card theme-canvas border-radius-2 font-size-md">
<img src="./images/zdenek-machacek-IJboLCiDwKY-unsplash.jpg" alt="Bald Eagle" />
<div class="card__body">
<h2 class="h6 text-color-primary" data-i18n="card1-title">
Bald Eagle
</h2>
<p data-i18n="card1-body">
The bald eagle is one of North America's most iconic birds of prey. With a wingspan that can exceed seven feet, these powerful hunters are known for their keen eyesight and impressive fishing skills.
</p>
</div>
<div class="card__foot font-size-sm text-color-link">
<a class="button button--disperse theme-dark" href="#1">
<span class="button__text" data-i18n="card1-cta">View Bald Eagle Profile</span>
<span class="icon icon-arrow-right"></span>
</a>
</div>
</div>
<div class="card theme-canvas border-radius-2 font-size-md">
<img src="./images/zdenek-machacek-pNIIgkWtjf8-unsplash.jpg" alt="Hummingbird" />
<div class="card__body">
<h2 class="h6 text-color-primary" data-i18n="card2-title">
Hummingbird
</h2>
<p data-i18n="card2-body">
Hummingbirds are among the smallest birds in the world and are famous for their ability to hover in place. Their wings can beat more than fifty times per second as they feed on nectar from flowers.
</p>
</div>
<div class="card__foot font-size-sm text-color-link">
<a class="button button--disperse theme-dark" href="#1">
<span class="button__text" data-i18n="card2-cta">Learn About Hummingbirds</span>
<span class="icon icon-arrow-right"></span>
</a>
</div>
</div>
<div class="card theme-canvas border-radius-2 font-size-md">
<img src="./images/wynand-van-poortvliet-4AmyOdXZAQc-unsplash.jpg" alt="Atlantic Puffin" />
<div class="card__body">
<h2 class="h6 text-color-primary" data-i18n="card3-title">
Atlantic Puffin
</h2>
<p data-i18n="card3-body">
Often called the "clown of the sea," the Atlantic puffin nests along rocky coastlines and spends most of its life on the open ocean. Its colorful bill becomes especially vibrant during the breeding season.
</p>
</div>
<div class="card__foot font-size-sm text-color-link">
<a class="button button--disperse theme-dark" href="#1">
<span class="button__text" data-i18n="card3-cta">View Atlantic Puffin</span>
<span class="icon icon-arrow-right"></span>
</a>
</div>
</div>
<div class="card theme-canvas border-radius-2 font-size-md">
<img src="./images/ray-hennessy-BR2rEWcQQJQ-unsplash.jpg" alt="Sandpiper" />
<div class="card__body">
<h2 class="h6 text-color-primary" data-i18n="card4-title">
Sandpiper
</h2>
<p data-i18n="card4-body">
Sandpipers are small shorebirds commonly seen running along beaches and tidal flats. They feed on insects, crustaceans, and other small organisms found in wet sand and shallow water.
</p>
</div>
<div class="card__foot font-size-sm text-color-link">
<a class="button button--disperse theme-dark" href="#1">
<span class="button__text" data-i18n="card4-cta">Learn About Sandpipers</span>
<span class="icon icon-arrow-right"></span>
</a>
</div>
</div>
</div>
</div>
</section>
</main>
<footer class="theme-dark font-size-sm" id="global-footer">
<h2 class="screen-reader-only">
Page Footer
</h2>
<div class="container narrow wide--lg padding-y-4">
<div class="grid grid--column-4--md gap-3">
<nav>
<p><strong data-i18n="footer-nav1-heading">Explore</strong></p>
<ul class="nav">
<li>
<a href="#1" data-i18n="footer-all-species">All Species</a>
</li>
<li>
<a href="#1" data-i18n="footer-photo-gallery">Photo Gallery</a>
</li>
<li>
<a href="#1" data-i18n="footer-field-guides">Field Guides</a>
</li>
</ul>
</nav>
<nav>
<p><strong data-i18n="footer-nav2-heading">Resources</strong></p>
<ul class="nav">
<li>
<a href="#1" data-i18n="footer-research-papers">Research Papers</a>
</li>
<li>
<a href="#1" data-i18n="footer-volunteer">Volunteer</a>
</li>
<li>
<a href="#1" data-i18n="footer-donate">Donate</a>
</li>
</ul>
</nav>
<nav>
<p><strong data-i18n="footer-nav3-heading">Community</strong></p>
<ul class="nav">
<li>
<a href="#1" data-i18n="footer-forum">Forum</a>
</li>
<li>
<a href="#1" data-i18n="footer-events">Events</a>
</li>
<li>
<a href="#1" data-i18n="footer-newsletter">Newsletter</a>
</li>
</ul>
</nav>
<div>
<a class="margin-bottom-3" href="#1" title="Home" data-logo="brand">
<!-- Placeholder logo, replace the following <svg> tag with your own -->
<svg xmlns="http://www.w3.org/2000/svg" width="126" height="34" viewBox="0 0 126 34">
<g>
<polygon points="8 25 8 1 0 1 0 33 3 33 8 33 16 33 16 25 8 25"/>
<path d="M35,0A17,17,0,1,0,52,17,17,17,0,0,0,35,0Zm0,26a9,9,0,1,1,9-9A9,9,0,0,1,35,26Z"/>
<path d="M109,0a17,17,0,1,0,17,17A17,17,0,0,0,109,0Zm0,26a9,9,0,1,1,9-9A9,9,0,0,1,109,26Z"/>
<path d="M88.95,16H72v6h7.4824a9,9,0,1,1,0-10H88.25A17.0052,17.0052,0,1,0,89,17C89,16.6624,88.9689,16.3327,88.95,16Z"/>
</g>
</svg>
</a>
<p class="width-75" data-i18n="footer-description">
Dedicated to the conservation and appreciation of birds in their natural habitats around the world.
</p>
</div>
</div>
</div>
<hr />
<div class="container narrow wide--lg padding-y-2 font-size-sm">
<div class="display-flex justify-content-between">
<span data-i18n="footer-copyright">
© Copyright 2024. All rights reserved.
</span>
<a href="#" data-scroll="top" data-i18n="footer-back-to-top">
Back to Top
</a>
</div>
</div>
</footer>
<!-- Language Modal -->
<div
class="modal padding-2"
id="language-modal"
data-modal-close-outside="true"
>
<div
class="modal__content theme-dark narrow border-radius-2 box-shadow-3"
role="dialog"
aria-labelledby="language-modal-title"
>
<header class="modal__content__head border-bottom">
<h2 class="h5" id="language-modal-title" data-i18n="lang-modal-title">
Select Language
</h2>
<button
class="button button--icon-only"
data-modal-close
aria-label="Close"
>
<span class="icon icon-close" aria-hidden="true"></span>
</button>
</header>
<main class="modal__content__body" id="language-modal-content">
<form id="language-form">
<fieldset>
<legend class="screen-reader-only">
Select your language
</legend>
<div class="form-entry__option">
<div class="form-entry__option__radio">
<label>
<input
type="radio"
name="language"
id="lang-en"
value="en"
checked>
<span class="option__label">
English
<span class="font-size-sm opacity-70">
English
</span>
</span>
</label>
</div>
<div class="form-entry__option__radio">
<label>
<input
type="radio"
name="language"
id="lang-es"
value="es">
<span class="option__label">
Español
<span class="font-size-sm opacity-70">
Spanish
</span>
</span>
</label>
</div>
<div class="form-entry__option__radio">
<label>
<input
type="radio"
name="language"
id="lang-zh"
value="zh-CN">
<span class="option__label">
简体中文
<span class="font-size-sm opacity-70">
Chinese (Simplified)
</span>
</span>
</label>
</div>
<div class="form-entry__option__radio">
<label>
<input
type="radio"
name="language"
id="lang-ru"
value="ru">
<span class="option__label">
Русский
<span class="font-size-sm opacity-70">
Russian
</span>
</span>
</label>
</div>
<div class="form-entry__option__radio">
<label>
<input
type="radio"
name="language"
id="lang-ur"
value="ur">
<span class="option__label">
<span dir="rtl">اردو</span>
<span class="font-size-sm opacity-70">
Urdu
</span>
</span>
</label>
</div>
</div>
</fieldset>
</form>
</main>
<footer class="modal__content__foot border-top">
<button
type="button"
class="button theme-primary width-100"
id="language-confirm"
data-i18n="lang-confirm"
>
Apply Language
</button>
</footer>
</div>
</div>
<!-- Natura11y Javascript -->
<script src="../../../../dist/natura11y.js"></script>
<!-- i18n Language Switcher -->
<script>
(() => {
'use strict';
const LANG_MAP = new Map([
['en', { label: 'English', dir: 'ltr', lang: 'en' }],
['es', { label: 'Español', dir: 'ltr', lang: 'es' }],
['zh-CN', { label: '简体中文', dir: 'ltr', lang: 'zh-Hans' }],
['ru', { label: 'Русский', dir: 'ltr', lang: 'ru' }],
['ur', { label: 'اردو', dir: 'rtl', lang: 'ur' }],
]);
// Cache for loaded language data
const langCache = new Map();
const applyStrings = (strings) => {
for (const [key, value] of Object.entries(strings)) {
document.querySelectorAll(`[data-i18n="${key}"]`).forEach(el => {
el.textContent = value;
});
}
};
const applyLanguage = (langCode, strings) => {
const meta = LANG_MAP.get(langCode) ?? LANG_MAP.get('en');
currentLang = langCode;
// Update html element attributes
document.documentElement.lang = meta.lang;
document.documentElement.dir = meta.dir;
// Update all language label buttons
document.querySelectorAll('[data-lang-label]').forEach(el => {
el.textContent = meta.label;
el.setAttribute('lang', meta.lang);
el.setAttribute('dir', meta.dir);
});
// Swap all data-i18n text
applyStrings(strings);
// Persist selection
try { localStorage.setItem('preferred-lang', langCode); } catch (_) {}
};
const loadLanguage = async (langCode) => {
if (langCache.has(langCode)) {
return langCache.get(langCode);
}
const res = await fetch(`lang/${langCode}.json`);
if (!res.ok) throw new Error(`Failed to load lang/${langCode}.json`);
const strings = await res.json();
langCache.set(langCode, strings);
return strings;
};
const switchLanguage = async (langCode) => {
try {
const strings = await loadLanguage(langCode);
applyLanguage(langCode, strings);
} catch (err) {
console.warn('[i18n]', err);
}
};
let currentLang = 'en';
// Sync radios to the currently active language (called on modal open)
const syncRadios = () => {
const radio = document.querySelector(`[name="language"][value="${currentLang}"]`);
if (radio) radio.checked = true;
};
// Apply on confirm — radios are free to browse without side effects
document.querySelector('#language-confirm').addEventListener('click', async () => {
const selected = document.querySelector('[name="language"]:checked')?.value;
if (selected) await switchLanguage(selected);
document.querySelector('#language-modal [data-modal-close]')?.click();
});
// Reset radio if user dismisses without confirming
document.querySelectorAll('[aria-controls="language-modal"]').forEach(btn => {
btn.addEventListener('click', syncRadios);
});
// Restore saved preference on load
const init = async () => {
const saved = (() => {
try { return localStorage.getItem('preferred-lang'); } catch (_) { return null; }
})();
if (saved && LANG_MAP.has(saved)) {
currentLang = saved;
const radio = document.querySelector(`[name="language"][value="${saved}"]`);
if (radio) radio.checked = true;
if (saved !== 'en') await switchLanguage(saved);
}
};
init();
})();
</script>
</body>
</html>