-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
1251 lines (1140 loc) · 49.3 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 lang="en" class="no-js">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Add a title to the page -->
<title>Christian Soldier Martyrs in Late Antiquity</title>
<!-- link to Cormorant Garamond and Albert Sans fonts -->
<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=Albert+Sans:ital,wght@0,100..900;1,100..900&family=Cormorant+Garamond:ital,wght@0,300;0,400;0,500;0,600;0,700;1,300;1,400;1,500;1,600;1,700&display=swap"
rel="stylesheet">
<!-- leaflet css -->
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css"
integrity="sha512-xodZBNTC5n17Xt2atTPuE1HxjVMSvLVW9ocqUKLsCC5CXdbqCmblAshOMAS6/keqq/sMZMZ19scR4PsZChSR7A=="
crossorigin="" />
<!-- for the collapsible sidebar -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.1/css/all.min.css" />
<link rel="stylesheet" href="src/leaflet-sidebar.css" />
<!-- for fullscreen button -->
<link rel="stylesheet" href="src/Control.FullScreen.css" />
<!-- for marker clusters -->
<link rel="stylesheet" href="https://unpkg.com/leaflet.markercluster/dist/MarkerCluster.css" />
<link rel="stylesheet" href="https://unpkg.com/leaflet.markercluster/dist/MarkerCluster.Default.css" />
<!-- custom style here -->
<style type="text/css">
/* Set the page and body parameters */
body,
html {
margin: 0;
padding: 0;
font-family: "Albert Sans", sans-serif;
font-size: 14px;
font-weight: 300;
}
/* Set map parameters */
#map {
position: fixed;
bottom: 0px;
width: 100%;
top: 0px;
}
/* Font styles */
h1 {
color: white;
display: inline-block;
margin-top: 0.5em;
margin-bottom: 0.0em;
margin-left: 0.8em;
margin-right: 0;
font-family: "Albert Sans", sans-serif;
font-weight: 300;
}
/* Define CSS variables for different font sizes */
:root {
--font-size-small: 9px;
/* Font size for small screens */
--font-size-medium: 12px;
/* Font size for medium screens */
--font-size-large: 15px;
/* Font size for large screens */
}
/* Apply default font size */
h1 {
font-size: var(--font-size-medium);
}
/* Adjust font size based on screen width */
/* For screens smaller than 765px, use the small font size */
@media (max-width: 764px) {
h1 {
font-size: var(--font-size-large);
}
}
/* Between 765px and 990px, use the small font size */
@media (min-width: 765px) and (max-width: 989px) {
h1 {
font-size: var(--font-size-small);
}
}
/* For screens larger than 1200px, use the large font size */
@media (min-width: 1200px) {
h1 {
font-size: var(--font-size-large);
}
}
h2 {
font-size: 12px;
color: white;
display: inline-block;
margin-top: 0.25em;
margin-bottom: 0.0em;
margin-left: 1.0em;
margin-right: 0;
font-family: "Albert Sans", sans-serif;
font-weight: 300;
}
h3 {
font-family: "Cormorant Garamond", serif;
font-weight: 400;
font-size: 18px;
/*text-transform: uppercase;*/
/*margin-left: 1.1em;*/
margin-top: 0px;
margin-bottom: 0px;
margin-right: 0px;
}
h4 {
font-family: "Cormorant Garamond", serif;
font-weight: 400;
font-size: 14px;
}
h5 {
font-family: "Cormorant Garamond", serif;
font-weight: 400;
font-size: 18px;
margin: 0px;
/*text-transform: uppercase;*/
}
h6 {
font-family: "Albert Sans", sans-serif;
font-weight: 300;
font-size: 12px;
margin: 0px;
}
h7 {
font-family: "Albert Sans", sans-serif;
font-size: 14px;
/*margin-left: 1.4em;*/
margin-top: 0px;
margin-bottom: 0px;
margin-right: 0px;
}
/* custom sidebar css */
/* sidebar header */
.sidebar-header {
width: 100%;
font-family: "Cormorant Garamond", serif;
font-weight: 400;
font-style: normal;
text-transform: uppercase;
/*box-sizing: border-box; /* Ensure padding and border are included in the width */
overflow: hidden; /* Prevent text overflow if necessary */
/*white-space: nowrap; /* Prevent the header text from wrapping if you want a single line */
}
/* sidebar icon */
i {
color: rgb(0, 0, 0);
}
/* sidebar about heading */
.about {
color: rgb(0, 0, 0);
font-family: "Cormorant Garamond", serif;
font-weight: 400;
font-style: normal;
font-size: 18px;
margin-bottom: 0px;
margin-top: 0px;
margin-left: 0px;
}
/* selection heading */
.choose {
color: rgb(0, 0, 0);
font-family: "Cormorant Garamond", serif;
font-weight: 400;
font-style: normal;
font-size: 18px;
margin-bottom: 0px;
margin-top: 0px;
margin-left: 0px;
}
/* sources header */
.sources {
color: rgb(0, 0, 0);
font-family: "Cormorant Garamond", serif;
font-weight: 400;
font-style: normal;
font-size: 18px;
margin-bottom: 0px;
margin-top: 10px;
margin-left: 0px;
/*margin-left: 1.1em;*/
}
/* map info */
.details {
font-family: "Albert Sans", sans-serif;
font-size: 14px;
font-weight: 300;
margin-bottom: 0px;
margin-top: 0px;
}
.instructions {
font-family: "Albert Sans", sans-serif;
font-size: 14px;
font-weight: 300;
margin-bottom: 0px;
margin-top: 0px;
}
/* source list */
.sourceList {
font-family: "Albert Sans", sans-serif;
font-size: 14px;
font-weight: 300;
margin-bottom: 0px;
margin-top: 0px;
/*margin-left: 1.4em;*/
}
.content {
font-family: "Albert Sans", sans-serif;
font-size: 14px;
font-weight: 300;
margin-bottom: 0px;
margin-top: 0px;
}
.introbreak {
display: block;
margin-bottom: 1em;
}
/* collapsible div css */
.header {
display: flex;
align-items: center;
}
#collapseButton {
background: none;
border: none;
cursor: pointer;
font-size: 1rem;
color: #333;
margin-right: 10px;
/* Add some spacing between the button and the h2 element */
}
#collapseButton .icon {
margin-right: 5px;
}
/* TEMPORAL SLIDER CSS */
/* Set the styles for the temporal slider container */
#temporal-slider-container {
display: flex;
align-items: center;
width: 250px;
/* Increase this value as needed */
height: 40px;
/* Adjust height if necessary */
padding: 5px;
}
/* Set temporal legend styles */
#temporal {
height: 25px;
width: 86px;
background-color: #FFFFFF;
border-radius: 3px;
box-shadow: 0px 0px 0px 2px rgba(0, 0, 0, 0.3);
display: flex;
align-items: center;
}
/* Set the styles for the text span in the temporal legend */
#temporal span {
font-family: 'Montserrat', sans-serif;
font-size: 13px;
/*margin-left: 10px;*/
/* vertically center the text */
line-height: 25px;
/* Add some padding to the left */
padding-left: 10px;
}
/* Set time slider styles */
#slider {
height: 25px;
margin-left: 10px;
background-color: #FFFFFF;
border-radius: 3px;
box-shadow: 0px 0px 0px 2px rgba(0, 0, 0, 0.3);
}
.slider {
-webkit-appearance: none;
width: 154px;
height: 5px;
background: #ddd;
outline: none;
opacity: 0.7;
transition: opacity .2s;
}
.slider:hover {
opacity: 1;
}
/* END TEMPORAL SLIDER CSS */
/* Set up the style for the legend */
.info.legend {
position: absolute;
bottom: 100px;
right: 10px;
background-color: rgba(255, 255, 255, 0.5);
padding: 5px;
font-family: Arial, sans-serif;
}
.info.legend h4 {
margin-top: 0.0em;
margin-bottom: 0.25em;
font-size: 18px;
}
.info.legend i {
margin-right: 5px;
}
</style>
</head>
<body>
<div id="sidebar" class="sidebar collapsed">
<div class="sidebar-tabs">
<ul role="tablist">
<li><a href="#home" role="tab"><i class="fa fa-bars"></i></a></li>
</ul>
</div>
<div class="sidebar-content">
<div class="sidebar-pane" id="home">
<h1 class="sidebar-header">Christian Soldier Martyrs in Late Antiquity<span class="sidebar-close"><i
class="fa fa-caret-left"></i></span></h1><br>
<br>
<div class="header">
<button id="collapseButton"><span class="icon"><i class="fas fa-chevron-up"></i></span></button>
<h2 class="about">About This Project</h2>
</div>
<div id="collapsibleContent">
</b><br>
<h4 class="details">This map, based on the earliest Greek, Latin, Coptic, Syriac, Armenian, and Georgian records of Christian Soldier Martyrs illustrates the locations where their cults spread, and the identified shrine sites, spanning from the second to seventh centuries CE.</h4>
<!--<br>
<h4 class="instructions">Instructions for using the map here.</h4>-->
<br>
<h4 class="content">For more information about this project, please contact <a
href="mailto:[email protected]">Hasan Degerli</a> at the University of Iowa.</h4>
<br><i>
<h4 class="details">Principal Investigator: Hasan Degerli, Ph.D. Candidate, Religious Studies, University of
Iowa</h4>
</i>
<p style="padding-bottom:0px"></p>
</div>
<div id="dropdown-instructions">
<p>
<h2 class="choose">Filter by Martyr:</h2>
</p>
</div>
<form id="map_parameters" name="map_parameters" action="#" accept-charset="utf-8" class="inlineForm">
<select id="name-select" class="div-toggle" data-target=".my-info-1">
<option value="0">No martyr selected</option>
</select>
</form>
<!-- Add a button to trigger the handleButtonClick() function -->
<div id="search-instructions">
<p>
<h2 class="choose">Reset or Zoom Out.</h2>
</p>
</div>
<!-- Wrap the buttons in a container div to control their layout -->
<div class="button-container">
<button id="resetButton">Reset</button>
<button id="zoomOutButton">Zoom Out</button>
</div>
<br>
<div id="sidebar-info" class="my-info-1">
<div id="content-info" class="contentinfo hide"></div>
</div>
<div id="sources">
<h2 class="sources">Sources</h2>
<br><br>
<h4 class="sourceList">Åhlfeldt, Johan. Digital Atlas of the Roman Empire, 2020. https://imperium.ahlfeldt.se.
<br><br>Bryan, Ward-Perkins. “The Cult of Saints in Late Antiquity.” The Cult of Saints, 2021. http://csla.history.ox.ac.uk.
</h4>
</div>
</div>
</div>
</div>
<!-- map -->
<div id="map"></div>
<!-- TEMPORAL SLIDER -->
<!-- Temporal legend and slider container -->
<div id="temporal-slider-container">
<!-- Temporal legend -->
<div id="temporal">
<h5 class="txt-bold"><span id="span"></span></h5>
</div>
<!-- UI Slider -->
<div id="slider">
<input type="range" min="0" max="2024" value="2024" step="1" class="slider" />
</div>
</div>
<!-- END TEMPORAL SLIDER -->
<!-- Create the legend container -->
<div class="info legend">
<h4>Legend</h4>
<i class="fas fa-map-marker-alt" style="color: #4682B4"></i><span> Martyrdom</span><br>
<i class="fas fa-map-marker-alt" style="color: #C41E3A"></i><span> Cult</span><br>
<i class="fas fa-map-marker-alt" style="color: #4CBB17"></i><span> Shrine</span><br>
</div>
<!-- leaflet js -->
<script src="https://unpkg.com/[email protected]/dist/leaflet.js"
integrity="sha512-XQoYMqMTK8LvdxXYG3nZ448hOEQiglfqkJs1NOQV44cWnUrBc8PkAOcXy20w0vlaXaVUearIOBhiXZ5V3ynxwA=="
crossorigin=""></script>
<!-- d3js -->
<script src="https://d3js.org/d3.v4.min.js"></script>
<!-- jQuery -->
<script src="https://code.jquery.com/jquery-3.6.0.min.js"
integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
<!-- chroma -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/chroma-js/1.2.1/chroma.min.js"></script>
<!-- Papaparse for bringing in Google spreadsheet data -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/PapaParse/5.3.0/papaparse.min.js "></script>
<!-- sidebar -->
<script src="src/svg-icon.js"></script>
<script src="src/leaflet-sidebar.js"></script>
<script src="src/leaflet.activearea.js"></script>
<!-- for fullscreen button -->
<script src="src/Control.FullScreen.js"></script>
<!-- for marker clusters -->
<script src="https://unpkg.com/leaflet.markercluster/dist/leaflet.markercluster.js"></script>
<!-- after Leaflet script -->
<script src="src/subgroup.js"></script>
<!-- javascript below -->
<script>
// Initialize the map
const map = L.map('map', {
center: [36.204722, 36.181667],
zoom: 5,
maxZoom: 11,
fullscreenControl: true,
fullscreenControlOptions: {
position: 'topright'
}
});
// add a basemap
const awmc = L.tileLayer('https://cawm.lib.uiowa.edu/tiles/{z}/{x}/{y}.png', {
maxZoom: 11
}).addTo(map);
// define a modern basemap
const modern = L.tileLayer('https://{s}.basemaps.cartocdn.com/rastertiles/voyager/{z}/{x}/{y}{r}.png', {
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors © <a href="https://carto.com/attributions">CARTO</a>',
subdomains: 'abcd',
maxZoom: 11
});
// Add a sidebar to the map
const sidebar = L.control.sidebar("sidebar").addTo(map);
sidebar.open("home");
// Define the sidebar element
const sidebarElement = document.getElementById('sidebar');
// Code to collapse about content
const collapseButton = document.getElementById('collapseButton'); // Define the collapse button
const collapsibleContent = document.getElementById('collapsibleContent'); // Define the collapsible content
// Add a click event listener to the button
collapseButton.addEventListener('click', function () {
// Check if the collapsible content is already open
if (collapsibleContent.style.display === 'none') {
// Show the collapsible content
collapsibleContent.style.display = 'block';
// Change the button icon
collapseButton.innerHTML = '<span class="icon"><i class="fas fa-chevron-up"></i></span>';
} else {
// Hide the collapsible content
collapsibleContent.style.display = 'none';
// Change the button icon
collapseButton.innerHTML = '<span class="icon"><i class="fas fa-chevron-down"></i></span>';
}
});
// Function to disable map zoom
function disableMapZoom() {
map.scrollWheelZoom.disable();
};
// Function to enable map zoom
function enableMapZoom() {
map.scrollWheelZoom.enable();
};
// Add event listener to disable map zoom when mouse is over the sidebar
sidebarElement.addEventListener('mouseover', disableMapZoom);
// Add event listener to enable map zoom when mouse leaves the sidebar
sidebarElement.addEventListener('mouseout', enableMapZoom);
// Listen for fullscreen change event
map.on('enterFullscreen', function () {
// When entering fullscreen, move the sidebar to the map container
map.getContainer().appendChild(sidebarElement);
});
map.on('exitFullscreen', function () {
// When exiting fullscreen, move the sidebar back to its original position
document.body.appendChild(sidebarElement);
});
// Define the Google Sheet URL
const gsheet = 'https://docs.google.com/spreadsheets/d/17D3v-4T7VpP1xEJqsHxzVuQVMDuz83iB0pYMxVXo4n4/export?format=csv&id=17D3v-4T7VpP1xEJqsHxzVuQVMDuz83iB0pYMxVXo4n4&gid=0';
// Load the data asynchronously
d3.queue()
// Load the data
.defer(d3.json, 'data/roads.json')
// Call the drawMap function when the data is loaded
.await(drawMap);
// Function to draw the map
function drawMap(err, roads) {
// Define a geojson object to hold the roads data
const roadsLayer = L.geoJson(roads, {
style: function (feature) {
return {
// give the roads a dark red-orange color
color: '#8B0000',
// make semi-transparent lines
opacity: 0.25,
weight: 1
};
}
}).addTo(map);
// Parse the google sheet data
Papa.parse(gsheet, {
download: true,
header: true,
complete: function (results) {
// Define an empty array to hold the chapter content
let chapterContent = [];
// Define an empty array to hold the martyr names
let names = [];
// Declare a global variable to hold the martyr locations layer
let martyrlocLayer;
// Create the marker cluster layer
let markerClusterLayer = L.markerClusterGroup(),
selectedMartyrs = L.featureGroup.subGroup(markerClusterLayer),// use `L.featureGroup.subGroup(parentGroup)` instead of `L.featureGroup()` or `L.layerGroup()`!
selectedCults = L.featureGroup.subGroup(markerClusterLayer),
selectedShrines = L.featureGroup.subGroup(markerClusterLayer);
// define sidebar info
const info = document.getElementById('content-info');
// Define the name dropdown menu
const nameSelect = document.getElementById('name-select');
// Define an empty array to store the years
const years = [];
// Define an empty geojson object for martyrdom
const martyrdom = {
type: 'FeatureCollection',
features: []
};
// Define an empty geojson object for cult
const cult = {
type: 'FeatureCollection',
features: []
};
// Define an empty geojson object for shrine
const shrine = {
type: 'FeatureCollection',
features: []
};
// Define data
let data = results.data;
// Loop through each row in the data
for (let i = 0; i < data.length; i++) {
// Define variables
let row = data[i];
// Define the martyrdom coordinates
let martyrCoords = row['Coordinate of Martyrdom'];
// Skip the row if the martyrCoords is empty
if (martyrCoords === '') {
continue;
}
// Split the martyrCoords into an array
let martyrCoordsSplit = martyrCoords.split(',');
// Define the martyrLat
let martyrLat = parseFloat(martyrCoordsSplit[0]).toString();
// Define the martyrLng
let martyrLng = parseFloat(martyrCoordsSplit[1]).toString();
// Define a new geojson feature object
const martyrFeature = {
type: 'Feature',
properties: {
name: row['Name'],
location: row['Place of Martyrdom'] + ', ' + row['Region of Martyrdom'],
death_max: row['Death Not After'],
death_min: row['Death Not Before'],
gender: row['Gender'],
language: row['Language'],
pleiades: row['Martyrdom Pleiades Id'],
source: row['The Earliest Source'],
source_date: row['Date of the Source'],
hagiography: row['Hagiography'],
hagiography_date_1: row['Hagiography Date'],
hagiography_2: row['Hagiography #2'],
hagiography_date_2: row['Hagiography #2 Date'],
hagiography_3: row['Hagiography #3'],
hagiography_date_3: row['Hagiography #3 Date'],
homily: row['Homily #1'],
homily_date_1: row['Homily #1 Date'],
homily_2: row['Homily #2'],
homily_date_2: row['Homily #2 Date'],
kind: 'martyr'
},
geometry: {
type: 'Point',
coordinates: [martyrLng, martyrLat]
}
};
// Add the feature to the geojson object
martyrdom.features.push(martyrFeature);
};
/*
for (let i = 0; i < data.length; i++) {
// Define variables
let row = data[i];
// Define the cult coordinates
let cultCoords = row['Coordinate of the Cult 1'];
// Skip the row if the cultCoords is empty
if (cultCoords === '') {
continue;
}
// Split the cultCoords into an array
let cultCoordsSplit = cultCoords.split(',');
// Define the cultLat
let cultLat = parseFloat(cultCoordsSplit[0]).toString();
// Define the cultLng
let cultLng = parseFloat(cultCoordsSplit[1]).toString();
// Define a new geojson feature object
const cultFeature = {
type: 'Feature',
properties: {
name: row['Name'],
location: row['Place of Cult 1'],
death_max: row['Death Not After'],
death_min: row['Death Not Before'],
gender: row['Gender'],
language: row['Language'],
pleiades: row['Cult Pleiades Id'],
kind: 'cult'
},
geometry: {
type: 'Point',
coordinates: [cultLng, cultLat]
}
};
// Add the feature to the geojson object
cult.features.push(cultFeature);
};
*/
// Process each row and add features to the GeoJSON object
data.forEach(row => {
const cultCoords1 = row['Coordinate of the Cult 1'];
const cultCoords2 = row['Coordinate of the Cult 2'];
const cultCoords3 = row['Coordinate of the Cult 3'];
const cultCoords4 = row['Coordinate of the Cult 4'];
const cultCoords5 = row['Coordinate of the Cult 5'];
const cultCoords6 = row['Coordinate of the Cult 6'];
const cultCoords7 = row['Coordinate of the Cult 7'];
const cultFeature1 = createCultFeature(row, cultCoords1, 'Place of Cult 1', 'Cult Pleiades Id');
const cultFeature2 = createCultFeature(row, cultCoords2, 'Place of Cult 1', 'Cult Pleiades Id');
const cultFeature3 = createCultFeature(row, cultCoords3, 'Place of Cult 1', 'Cult Pleiades Id');
const cultFeature4 = createCultFeature(row, cultCoords4, 'Place of Cult 1', 'Cult Pleiades Id');
const cultFeature5 = createCultFeature(row, cultCoords5, 'Place of Cult 1', 'Cult Pleiades Id');
const cultFeature6 = createCultFeature(row, cultCoords6, 'Place of Cult 1', 'Cult Pleiades Id');
const cultFeature7 = createCultFeature(row, cultCoords7, 'Place of Cult 1', 'Cult Pleiades Id');
if (cultFeature1) cult.features.push(cultFeature1);
if (cultFeature2) cult.features.push(cultFeature2);
if (cultFeature3) cult.features.push(cultFeature3);
if (cultFeature4) cult.features.push(cultFeature4);
if (cultFeature5) cult.features.push(cultFeature5);
if (cultFeature6) cult.features.push(cultFeature6);
if (cultFeature7) cult.features.push(cultFeature7);
});
// Process each row and add features to the GeoJSON object
data.forEach(row => {
const shrineCoords1 = row['Shrine 1 Coordinate'];
const shrineCoords2 = row['Shrine 2 Coordinate'];
const shrineCoords3 = row['Shrine 3 Coordinate'];
const shrineCoords4 = row['Shrine 4 Coordinate'];
const shrineCoords5 = row['Shrine 5 Coordinate'];
const shrineCoords6 = row['Shrine 6 Coordinate'];
const shrineFeature1 = createShrineFeature(row, shrineCoords1, 'Shrine 1 Location', 'Shrine 1 Pleiades');
const shrineFeature2 = createShrineFeature(row, shrineCoords2, 'Shrine 2 Location', 'Shrine 2 Pleiades');
const shrineFeature3 = createShrineFeature(row, shrineCoords3, 'Shrine 3 Location', 'Shrine 3 Pleiades');
const shrineFeature4 = createShrineFeature(row, shrineCoords4, 'Shrine 4 Location', 'Shrine 4 Pleiades');
const shrineFeature5 = createShrineFeature(row, shrineCoords5, 'Shrine 5 Location', 'Shrine 5 Pleiades');
const shrineFeature6 = createShrineFeature(row, shrineCoords6, 'Shrine 6 Location', 'Shrine 6 Pleiades');
if (shrineFeature1) shrine.features.push(shrineFeature1);
if (shrineFeature2) shrine.features.push(shrineFeature2);
if (shrineFeature3) shrine.features.push(shrineFeature3);
if (shrineFeature4) shrine.features.push(shrineFeature4);
if (shrineFeature5) shrine.features.push(shrineFeature5);
if (shrineFeature6) shrine.features.push(shrineFeature6);
});
// Define a leaflet layer for the geojson data
const martyrLayer = L.geoJson(martyrdom, {
pointToLayer: function (feature, latlng) {
// Create a blue marker
return L.marker(latlng, {
icon: L.icon({
iconUrl: 'https://raw.githubusercontent.com/pointhi/leaflet-color-markers/master/img/marker-icon-2x-blue.png',
shadowUrl: 'https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.7/images/marker-shadow.png',
iconSize: [25, 41],
iconAnchor: [12, 41],
shadowSize: [41, 41]
})
});
},
onEachFeature: function (feature, layer) {
// Push the name of the martyr to the names array
names.push(feature.properties.name);
// Define minYear of death
let year = parseInt(feature.properties.death_min);
// Push the minimum death year to the years array
years.push(year);
// Add a tooltip to each marker to display the martyrs' names
layer.bindTooltip('<div style="max-width: 250px; width: max-content; white-space: normal;"><h5>' + feature.properties.name + '</h5><hr><h6>' + feature.properties.location + '<br>Martyred: ' + feature.properties.death_min + ' - ' + feature.properties.death_max + ' CE<br>' + feature.properties.language + '</h6>');
// On mouseover, change the marker color
layer.on('mouseover', function (e) {
// Change the marker color
this.setIcon(L.icon({
iconUrl: 'https://raw.githubusercontent.com/pointhi/leaflet-color-markers/master/img/marker-icon-2x-yellow.png',
shadowUrl: 'https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.7/images/marker-shadow.png',
iconSize: [25, 41],
iconAnchor: [12, 41],
shadowSize: [41, 41]
}));
});
// On mouseout, change the marker color back
layer.on('mouseout', function (e) {
// Change the marker color
this.setIcon(L.icon({
iconUrl: 'https://raw.githubusercontent.com/pointhi/leaflet-color-markers/master/img/marker-icon-2x-blue.png',
shadowUrl: 'https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.7/images/marker-shadow.png',
iconSize: [25, 41],
iconAnchor: [12, 41],
shadowSize: [41, 41]
}));
});
// Define the value in the slider
let currentYear = $('.slider').val();
// Add layers to the markerClusterLayer layer
if (year <= currentYear) {
//markerClusterLayer.addLayer(layer);
selectedMartyrs.addLayer(layer);
}
}
});
// Define a leaflet layer for the geojson data
const cultLayer = L.geoJson(cult, {
pointToLayer: function (feature, latlng) {
// Create a red marker
return L.marker(latlng, {
icon: L.icon({
iconUrl: 'https://raw.githubusercontent.com/pointhi/leaflet-color-markers/master/img/marker-icon-2x-red.png',
shadowUrl: 'https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.7/images/marker-shadow.png',
iconSize: [25, 41],
iconAnchor: [12, 41],
shadowSize: [41, 41]
})
});
},
onEachFeature: function (feature, layer) {
// Define minYear of death
let year = parseInt(feature.properties.death_min);
// Add a tooltip to each marker to display the martyrs' names
layer.bindTooltip('<div style="max-width: 250px; width: max-content; white-space: normal;"><h5>' + feature.properties.name + '</h5><hr><h6>' + feature.properties.location + '<br>Martyred: ' + feature.properties.death_min + ' - ' + feature.properties.death_max + ' CE<br>' + feature.properties.language + '</h6>');
// On mouseover, change the marker color
layer.on('mouseover', function (e) {
// Change the marker color
this.setIcon(L.icon({
iconUrl: 'https://raw.githubusercontent.com/pointhi/leaflet-color-markers/master/img/marker-icon-2x-yellow.png',
shadowUrl: 'https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.7/images/marker-shadow.png',
iconSize: [25, 41],
iconAnchor: [12, 41],
shadowSize: [41, 41]
}));
});
// On mouseout, change the marker color back
layer.on('mouseout', function (e) {
// Change the marker color
this.setIcon(L.icon({
iconUrl: 'https://raw.githubusercontent.com/pointhi/leaflet-color-markers/master/img/marker-icon-2x-red.png',
shadowUrl: 'https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.7/images/marker-shadow.png',
iconSize: [25, 41],
iconAnchor: [12, 41],
shadowSize: [41, 41]
}));
});
// Define the value in the slider
let currentYear = $('.slider').val();
// Add layers to the markerClusterLayer layer
if (year <= currentYear) {
//markerClusterLayer.addLayer(layer);
selectedCults.addLayer(layer);
}
}
});
// Define a leaflet layer for the geojson data
const shrineLayer = L.geoJson(shrine, {
pointToLayer: function (feature, latlng) {
// Create a green marker
return L.marker(latlng, {
icon: L.icon({
iconUrl: 'https://raw.githubusercontent.com/pointhi/leaflet-color-markers/master/img/marker-icon-2x-green.png',
shadowUrl: 'https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.7/images/marker-shadow.png',
iconSize: [25, 41],
iconAnchor: [12, 41],
shadowSize: [41, 41]
})
});
},
onEachFeature: function (feature, layer) {
// Define minYear of death
let year = parseInt(feature.properties.death_min);
// Add a tooltip to each marker to display the martyrs' names
layer.bindTooltip('<div style="max-width: 250px; width: max-content; white-space: normal;"><h5>' + feature.properties.name + '</h5><hr><h6>' + feature.properties.location + '<br>Martyred: ' + feature.properties.death_min + ' - ' + feature.properties.death_max + ' CE<br>' + feature.properties.language + '</h6>');
// On mouseover, change the marker color
layer.on('mouseover', function (e) {
// Change the marker color
this.setIcon(L.icon({
iconUrl: 'https://raw.githubusercontent.com/pointhi/leaflet-color-markers/master/img/marker-icon-2x-yellow.png',
shadowUrl: 'https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.7/images/marker-shadow.png',
iconSize: [25, 41],
iconAnchor: [12, 41],
shadowSize: [41, 41]
}));
});
// On mouseout, change the marker color back
layer.on('mouseout', function (e) {
// Change the marker color
this.setIcon(L.icon({
iconUrl: 'https://raw.githubusercontent.com/pointhi/leaflet-color-markers/master/img/marker-icon-2x-green.png',
shadowUrl: 'https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.7/images/marker-shadow.png',
iconSize: [25, 41],
iconAnchor: [12, 41],
shadowSize: [41, 41]
}));
});
// Define the value in the slider
let currentYear = $('.slider').val();
// Add layers to the markerClusterLayer layer
if (year <= currentYear) {
//markerClusterLayer.addLayer(layer);
selectedShrines.addLayer(layer);
}
}
});
/* NEED TO MAKE A COMBINED LAYER FOR MARTYRDOM AND CULT */
// Define a combined layer for martyrdom and cult using L.featureGroup
martyrlocLayer = L.featureGroup([martyrLayer, cultLayer, shrineLayer]);
// Fit the map to the martyrlocLayer layer bounds
map.fitBounds(martyrlocLayer.getBounds());
// Define the zoomOutButton
const zoomOutButton = document.getElementById('zoomOutButton');
// Add a click event listener to the zoomOutButton
zoomOutButton.addEventListener('click', function () {
// Perform the zoom-out operation using fitBounds()
map.fitBounds(martyrlocLayer.getBounds());
});
// Define the resetButton
const resetButton = document.getElementById('resetButton');
// Add a click event listener to the resetButton
resetButton.addEventListener('click', function () {
// Refresh the page
location.reload();
});
// Reorder the names array alphabetically
names.sort();
// Add the names array to the dropdown menu
names.forEach(function (name) {
// Create a new option element
const option = document.createElement('option');
// Set the option value to the name
option.value = name;
// Set the option text to the name
option.text = name;
// Append the option to the nameSelect dropdown menu
nameSelect.appendChild(option);
});
// Listen for a change event on the nameSelect dropdown menu
nameSelect.addEventListener('change', function () {
info.innerHTML = ''; // Clear the content
// Get the selected name
const selectedName = nameSelect.value;
// Clear the markerClusterLayer layer
markerClusterLayer.clearLayers();
// Clear the selectedMartyrs layer
selectedMartyrs.clearLayers();
// Clear the selectedCults layer
selectedCults.clearLayers();
// Clear the selectedShrines layer
selectedShrines.clearLayers();
// Loop through each layer in the martyrlocLayer layer
martyrlocLayer.eachLayer(function (layer) {
// Iterate through each feature in the layer
layer.eachLayer(function (featureLayer) {
// Check if the layer name matches the selected name
if (featureLayer.feature.properties.name === selectedName) {
// Add the layer to the markerClusterLayer layer
markerClusterLayer.addLayer(featureLayer);
// Open the sidebar
sidebar.open('home');
// Call the updateSidebarContent function
updateSidebarContent(featureLayer);
// If the feature is a martyr
if (featureLayer.feature.properties.kind === 'martyr') {
// Add the layer to the selectedMartyrs layer
selectedMartyrs.addLayer(featureLayer);
};
// If the feature is a cult
if (featureLayer.feature.properties.kind === 'cult') {
// Add the layer to the selectedCults layer
selectedCults.addLayer(featureLayer);
};
// If the feature is a shrine
if (featureLayer.feature.properties.kind === 'shrine') {
// Add the layer to the selectedShrines layer
selectedShrines.addLayer(featureLayer);
};
};
});
});
// Call the adjustMapBounds function
adjustMapBounds(map, markerClusterLayer, sidebarElement);
});
// Listen for a window resize event
window.addEventListener('resize', function () {
adjustMapBounds(map, selectedMartyrs, sidebarElement);
});
// Listen for a sidebar opening event
sidebar.on('opening', function (e) {
setTimeout(function () {
adjustMapBounds(map, selectedMartyrs, sidebarElement);
}, 510);
});
// Listen for a sidebar closing event
sidebar.on('closing', function (e) {
setTimeout(function () {
adjustMapBounds(map, selectedMartyrs, sidebarElement);
}, 510);
});
// Get the min and max years
const minYear = d3.min(years);
const maxYear = d3.max(years);