-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcriminal-law.html
1792 lines (1583 loc) · 72.3 KB
/
criminal-law.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>State Regulation of Genetic Privacy and Law Enforcement</title>
<!--<link href="https://fonts.googleapis.com/css?family=Montserrat" rel="stylesheet" type="text/css">-->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Forum&family=Work+Sans:ital,wght@0,100..900;1,100..900&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Libre+Baskerville:wght@400;700&family=Source+Sans+Pro:wght@400;600&display=swap" rel="stylesheet">
<style>
/* Hide scrollbar initially */
.sidebar::-webkit-scrollbar {
display: none;
}
/* Show scrollbar when adjustments are applied */
.sidebar-container.adjusted .sidebar::-webkit-scrollbar {
display: auto;
}
body,
html {
height: 100%;
margin: 0;
font-family: "Libre Baskerville", serif;
}
label {
font-family: "Source Sans Pro", sans-serif;
font-weight: 300;
font-size: 14px;
}
#mapcontainer {
height: 100vh;
width: calc(100vw - 350px);
/* Adjusted width */
position: absolute;
right: 0;
top: 0;
overflow: hidden;
background-color: #f4f4f9;
}
#map {
width: inherit;
height: 100vh;
/* Set initial height */
overflow: hidden;
/* Prevent overflow if needed */
}
.sidebar-container {
display: flex;
flex-direction: column;
width: 350px;
height: 100%;
position: absolute;
left: 0;
top: 0;
background: white;
box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
z-index: 100;
}
.sidebar {
flex: 1;
/* Grow to fill available space */
overflow-y: auto;
/* Enable vertical scrolling */
margin-bottom: 190px;
/* make margin-bottom the same as the height of the legend */
}
.sidebar-header {
padding: 15px 0 15px 15px;
background: #003366;
color: white;
text-align: left;
font-size: 16px;
font-weight: bold;
}
.legend,
.filter-legend {
z-index: 1;
}
p {
padding: 0 15px;
font-size: 14px;
font-family: "Source Sans Pro", sans-serif;
font-weight: 300;
}
.layer-control {
margin-top: 20px;
padding-left: 15px;
}
.layer-control input {
margin-right: 5px;
}
.layer-control button {
margin: 10px;
padding: 5px 10px;
background-color: white;
color: black;
box-shadow: 2px 0 3px rgba(0, 0, 0, 0.5);
border: none;
border-radius: 3px;
cursor: pointer;
}
#compareButton {
/* center the button */
display: block;
margin: 0 auto;
padding: 5px 10px;
background-color: white;
color: black;
box-shadow: 2px 0 3px rgba(0, 0, 0, 0.5);
border: none;
border-radius: 3px;
cursor: pointer;
}
.layer-control button:hover,
#compareButton:hover {
background-color: #f0f0f0;
/* very light gray */
}
.checkbox-group {
padding-left: 20px;
margin-bottom: 10px;
}
#tooltip,
#hovertooltip {
display: none;
/* Initially hidden */
}
.tooltip,
.hovertooltip {
max-width: 350px;
position: absolute;
text-align: left;
padding: 10px;
font: 12px;
font-family: "Libre Baskerville", serif;
background: lightsteelblue;
border: 1px solid #ccc;
border-radius: 4px;
opacity: 0;
transition: opacity 0.2s ease-in-out;
z-index: 1000;
/* Ensure tooltip is above other elements */
pointer-events: auto;
/* Ensure the tooltip captures mouse events */
}
.tooltip.visible,
.hovertooltip.visible {
opacity: 1;
/* Fully visible */
display: block;
/* Use block to show the tooltip */
}
.tooltip.hidden,
.hovertooltip.hidden {
opacity: 0;
/* Hide the tooltip */
pointer-events: none;
/* Disable mouse events when hidden */
}
.tooltip .close {
position: absolute;
top: 5px;
right: 5px;
font-size: 16px;
color: black;
/* Set "X" color to black */
background: transparent;
/* Remove background */
border: none;
/* Remove border */
cursor: pointer;
/* Show pointer cursor on hover */
padding: 0;
/* Remove default padding */
}
.tooltip .close:hover {
color: #333;
/* Darker color on hover for better visibility */
}
.highlighted {
stroke: yellow;
stroke-width: 2px;
}
table {
border-collapse: collapse;
width: 100%;
}
th,
td {
border: 1px solid black;
padding: 8px;
text-align: left;
font-family: "Source Sans Pro", sans-serif;
font-weight: 300;
font-size: 13px;
}
.collapsible-header-overview,
.collapsible-header-provisions,
.collapsible-header-comparison,
.collapsible-header-regulation,
.collapsible-header-laws {
cursor: pointer;
}
.arrow-icon {
display: inline-block;
width: 20px;
text-align: center;
}
.collapsible-content-overview,
.collapsible-content-laws {
display: none;
}
.collapsible-content-overview.show,
.collapsible-content-laws.show {
display: block;
}
.collapsible-content-provisions,
.collapsible-content-comparison,
.collapsible-content-regulation {
display: none;
}
/* Modal CSS */
/* Style for the modal background */
.modal {
display: none;
position: fixed;
z-index: 1;
left: 0;
top: 0;
width: 100%;
height: 100%;
overflow: auto;
background-color: rgba(0, 0, 0, 0.5);
}
/* Style for the modal content box */
.modal-content {
background-color: #fefefe;
margin: 15% auto;
padding-top: 0px;
padding-left: 20px;
padding-bottom: 10px;
padding-right: 20px;
border: 1px solid #888;
width: 80%;
max-width: 500px;
border-radius: 5px;
}
/* Style for the close button */
.close {
color: #aaa;
float: right;
font-size: 28px;
font-weight: bold;
}
.close:hover,
.close:focus {
color: black;
text-decoration: none;
cursor: pointer;
}
/* Style for the table inside the modal */
#stateCompTable {
width: 100%;
border-collapse: collapse;
}
#typeHead,
#firstStateHead,
#secondStateHead,
#Life,
#Disability,
#LTC,
#firstStateLife,
#secondStateLife,
#firstStateDisability,
#secondStateDisability,
#fistStateLTC,
#secondStateLTC {
padding: 8px;
text-align: left;
}
#typeHead,
#firstStateHead,
#secondStateHead {
background-color: #f2f2f2;
}
/* Style for the dropdown container */
.dropdown-container {
display: flex;
justify-content: center;
gap: 10px;
margin-bottom: 20px;
}
#titlebar {
text-align: center;
padding-top: 0px;
border-radius: 5px;
/*box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);*/
}
h1 {
margin: 0;
padding: 10px;
padding-bottom: 13px;
color: black;
font-size: 24px;
font-weight: bold;
}
h4 {
font-size: 14px;
}
.centered-text {
max-width: 636px;
/* Sets the maximum width */
margin: 0 auto;
/* Centers the paragraph itself under the h1 */
text-align: left;
/* Left-aligns the text within the paragraph */
}
/* Bottom right text */
.bottom-right {
position: absolute;
bottom: 10px;
/* Distance from the bottom */
right: 10px;
/* Distance from the right */
font-style: italic;
/* To maintain the italic style */
}
/* Bulleted List */
ul {
list-style-type: disc;
/* Ensure the bullets are shown */
padding-left: 10px;
/* Add a small amount of padding to make space for the bullet */
margin-left: 0;
/* Remove default left margin */
}
li {
text-align: left;
/* Align text to the left */
margin: 0;
/* Remove extra margin from the list item */
padding-left: 0;
/* Reset any padding from the list items */
}
li::marker {
margin-right: 10px;
/* Adds a slight space after the bullet */
}
</style>
</head>
<body>
<!--A container to hold the sidebar content-->
<div class="sidebar-container">
<div class="sidebar" id="sidebar">
<div class="sidebar-header">State Regulation of Genetic Privacy<br>and Law Enforcement</div>
<div class="sidebar-content">
<div class="collapsible-overview">
<div class="collapsible-header-overview">
<h4 style="padding: 0 15px;"><span class="arrow-icon">▼</span> <!-- Down-facing arrow icon -->How to Use</h4>
</div>
<div class="collapsible-content-overview show">
<p>To filter the map, select your desired combination of genetic privacy regulations. You will notice the map change based on your combination of radio button and checkbox inputs. The scrollable list of linked regulations will also change according to your selections. Press the reset button to return to the general coverage map.</p>
</div>
</div>
<!-- Filter Map by Regulation Type -->
<div class="collapsible-regulation">
<div class="collapsible-header-regulation">
<h4 style="padding: 0 15px;"><span class="arrow-icon">►</span> <!-- Right-facing arrow icon -->Filter Map by Regulation Type</h4>
</div>
<div class="collapsible-content-regulation">
<div class="layer-control">
<div>
<input type="radio" id="companiesLayerToggle" name="layer" value="companies">
<label for="companiesLayerToggle">Regulation of Consumer Genetics Platforms</label>
<div id="companiesLayerOptions" class="checkbox-group" style="display: none; font-family: Source Sans Pro, sans-serif; font-weight: 300; font-size: 13px;">
<input type="checkbox" id="exante" name="exante" value="exante">
<label for="exante">Ex-Ante Supervision of FGG</label>
<br>
<input type="checkbox" id="individual" name="individual" value="individual">
<label for="individual">Control Over Own Genetic Data</label>
<br>
<input type="checkbox" id="thirdparty" name="thirdparty" value="thirdparty">
<label for="thirdparty">Non-Suspect Third Party Protections</label>
<br>
<input type="checkbox" id="fgg" name="fgg" value="fgg">
<label for="fgg">Ensures FGG to Prove Culpability</label>
<br>
<input type="checkbox" id="consequences" name="consequences" value="consequences">
<label for="consequences">Consequences for Violations</label>
<br>
<input type="checkbox" id="reporting" name="reporting" value="reporting">
<label for="reporting">Annual Public Reporting and Review</label>
</div>
</div>
<div>
<input type="radio" id="lawEnforcementLayerToggle" name="layer" value="lawEnforcement">
<label for="lawEnforcementLayerToggle">Regulation of Law Enforcement</label>
<!-- This checkbox is not needed
<div id="lawEnforcementLayerOptions" class="checkbox-group" style="display: none; font-family: Source Sans Pro, sans-serif; font-weight: 300; font-size: 13px;">
<input type="checkbox" id="regulation" name="regulation" value="regulation">
<label for="regulation">Direct Regulation of Law Enforcement</label>
</div> -->
</div>
<!--<button id="filterButton">Filter</button>-->
<button id="resetButton">Reset</button>
</div>
</div>
</div>
<!-- Filter Map by Regulation Type END -->
<!-- STATE LAW COMPARISON START -->
<div class="collapsible-comparison">
<div class="collapsible-header-comparison">
<h4 style="padding: 0 15px;"><span class="arrow-icon">►</span> <!-- Right-facing arrow icon -->Compare State Laws</h4>
</div>
<div class="collapsible-content-comparison">
<p>To compare the legal coverage between two states, select the two states you want to compare from the dropdown menus. Click the "Compare" button and a table will display showing the key legal differences.</p>
<!-- Dropdown menus for selecting states -->
<div class="dropdown-container">
<select id="firstStateDropdown">
<!-- Populate with US states -->
</select>
<select id="secondStateDropdown">
<!-- Populate with US states -->
</select>
</div>
<!-- Trigger/Open The Modal -->
<button id="compareButton">Compare</button>
</div>
</div>
<!-- The Modal -->
<div id="myModal" class="modal">
<div class="modal-content">
<span class="close">×</span>
<h2>State Comparison</h2>
<table id="stateCompTable">
<thead>
<tr>
<th id="typeHead">Type</th>
<th id="firstStateHead">None selected</th>
<th id="secondStateHead">None selected</th>
</tr>
</thead>
<tbody>
<tr>
<td id="exante">Ex-Ante Supervision</td>
<td id="firstStateExante"></td>
<td id="secondStateExante"></td>
</tr>
<tr>
<td id="individual">Individual Control</td>
<td id="firstStateIndividual"></td>
<td id="secondStateIndividual"></td>
</tr>
<tr>
<td id="thirdparty">Third Party Protections</td>
<td id="firstStateThirdparty"></td>
<td id="secondStateThirdparty"></td>
</tr>
<tr>
<td id="fgg">FGG Ensured</td>
<td id="firstStateFgg"></td>
<td id="secondStateFgg"></td>
</tr>
<tr>
<td id="consequences">Violation Consequences</td>
<td id="firstStateConsequences"></td>
<td id="secondStateConsequences"></td>
</tr>
<tr>
<td id="reporting">Reporting/Review</td>
<td id="firstStateReporting"></td>
<td id="secondStateReporting"></td>
</tr>
<tr>
<td id="regulation">Law Enforcement Regulation</td>
<td id="firstStateRegulation"></td>
<td id="secondStateRegulation"></td>
</tr>
</tbody>
</table>
</div>
</div>
<!-- STATE LAW COMPARISON END -->
<div class="collapsible-laws">
<div class="collapsible-header-laws">
<h4 style="padding: 0 15px;"><span class="arrow-icon">▼</span> <!-- Down-facing arrow icon -->Read the State-by-State Laws</h4>
</div>
<div class="collapsible-content-laws show">
<div id="stateDetails" style="padding: 15px;"></div>
</div>
</div>
</div>
</div>
<div id="legend" style="position: absolute; left: 20px; bottom: 20px; background-color: white; padding: 10px; border-radius: 5px; box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);">
<h4 style="margin-top: 0; margin-bottom: 5px;">Existence of Legal Coverage</h4>
<div>
<!-- Display "patterns/lines-d-02.png" for the case of "Companies" coverage-->
<div style="display: flex; align-items: center; font-family: Source Sans Pro, sans-serif; font-weight: 300; font-size: 13px;">
<span style="display: inline-block; width: 20px; height: 20px; background-color: rgb(173, 216, 230); background-image: url('patterns/lines-d-02.png'); background-size: 20px 20px; background-repeat: repeat; margin-right: 5px;"></span> Regulates Companies
</div>
<!-- Display "patterns/lines-d-05.png" for the case of "Law Enforcement" coverage-->
<div style="display: flex; align-items: center; font-family: Source Sans Pro, sans-serif; font-weight: 300; font-size: 13px;">
<span style="display: inline-block; width: 20px; height: 20px; background-color: rgb(173, 216, 230); background-image: url('patterns/lines-d-05.png'); background-size: 20px 20px; background-repeat: repeat; margin-right: 5px;"></span> Regulates Law Enforcement
</div>
<!-- Display "lightblue" for the case of coverage-->
<!--<div style="display: flex; align-items: center; font-family: Source Sans Pro, sans-serif; font-weight: 300; font-size: 13px;">
<span style="display: inline-block; width: 20px; height: 20px; background-color: lightblue; margin-right: 5px;"></span> Present
</div>-->
<!-- Display "gray" for the case of no coverage-->
<div style="display: flex; align-items: center; font-family: Source Sans Pro, sans-serif; font-weight: 300; font-size: 13px;">
<span style="display: inline-block; width: 20px; height: 20px; background-color: rgb(251,247,245); margin-right: 5px;"></span> Absent
</div>
</div>
</div>
<div id="platform-legend" style="position: absolute; left: 20px; bottom: 20px; background-color: white; padding: 10px; border-radius: 5px; box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);">
<h4 style="margin-top: 0; margin-bottom: 5px;">Existence of Legal Coverage</h4>
<div>
<div style="display: flex; align-items: center; margin-bottom: 0px;">
<div style="width: 20px; height: 20px; background-color: #D0F4FC; margin-right: 10px;"></div>
<span style="font-family: Source Sans Pro, sans-serif; font-weight: 300; font-size: 13px;">1 category covered</span>
</div>
<div style="display: flex; align-items: center; margin-bottom: 0px;">
<div style="width: 20px; height: 20px; background-color: #70D9ED; margin-right: 10px;"></div>
<span style="font-family: Source Sans Pro, sans-serif; font-weight: 300; font-size: 13px;">2</span>
</div>
<div style="display: flex; align-items: center; margin-bottom: 0px;">
<div style="width: 20px; height: 20px; background-color: #08BCDC; margin-right: 10px;"></div>
<span style="font-family: Source Sans Pro, sans-serif; font-weight: 300; font-size: 13px;">3</span>
</div>
<div style="display: flex; align-items: center; margin-bottom: 0px;">
<div style="width: 20px; height: 20px; background-color: #085997; margin-right: 10px;"></div>
<span style="font-family: Source Sans Pro, sans-serif; font-weight: 300; font-size: 13px;">4</span>
</div>
<div style="display: flex; align-items: center; margin-bottom: 0px;">
<div style="width: 20px; height: 20px; background-color: #08377F; margin-right: 10px;"></div>
<span style="font-family: Source Sans Pro, sans-serif; font-weight: 300; font-size: 13px;">5</span>
</div>
<div style="display: flex; align-items: center; margin-bottom: 0px;">
<div style="width: 20px; height: 20px; background-color: #08045C; margin-right: 10px;"></div>
<span style="font-family: Source Sans Pro, sans-serif; font-weight: 300; font-size: 13px;">6 categories covered</span>
</div>
</div>
</div>
<div id="enforcement-legend" style="position: absolute; left: 20px; bottom: 20px; background-color: white; padding: 10px; border-radius: 5px; box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);">
<h4 style="margin-top: 0; margin-bottom: 5px;">Existence of Legal Coverage</h4>
<div>
<!-- Display "lightblue" for the case of coverage-->
<div style="display: flex; align-items: center; font-family: Source Sans Pro, sans-serif; font-weight: 300; font-size: 13px;">
<span style="display: inline-block; width: 20px; height: 20px; background-color: lightblue; margin-right: 5px;"></span> Present
</div>
<!-- Display "gray" for the case of no coverage-->
<div style="display: flex; align-items: center; font-family: Source Sans Pro, sans-serif; font-weight: 300; font-size: 13px;">
<span style="display: inline-block; width: 20px; height: 20px; background-color: rgb(251,247,245); margin-right: 5px;"></span> Absent
</div>
</div>
</div>
</div>
<div id="mapcontainer">
<!--A container in the middle of the page to hold the map title-->
<div id="titlebar">
<h1 class="dynamictitle">State Regulation of Genetic Privacy and Law Enforcement</h1>
<!--
<p class="centered-text">The United States Genetic Information Nondiscrimination Act (GINA) prevents health insurers and employers from engaging in genetic discrimination. However, the federal law does not cover life, long-term care, and disability insurers. These insurances are regulated at the state level. There is a range of different types of laws that states have adopted in this area. This map charts the different categories of laws in place across the states.</p>
-->
</div>
<div id="map">
</div>
<p class="bottom-right"><i>Data current as of October 2024</i></p>
</div>
<div class="tooltip" id="tooltip"></div>
<div class="hovertooltip" id="hovertooltip"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/7.9.0/d3.min.js" integrity="sha512-vc58qvvBdrDR4etbxMdlTt4GBQk1qjvyORR2nrsPsFPyrs+/u5c3+1Ct6upOgdZoIl7eq6k3a1UPDSNAQi/32A==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://unpkg.com/[email protected]/dist/topojson.js"></script>
<script>
// Adjust the map height on load
window.onload = function() {
const titlebarHeight = document.getElementById('titlebar').offsetHeight;
document.getElementById('map').style.height = `calc(100vh - ${titlebarHeight}px)`;
};
// Adjust the map height on window resize
window.onresize = function() {
const titlebarHeight = document.getElementById('titlebar').offsetHeight;
document.getElementById('map').style.height = `calc(100vh - ${titlebarHeight}px)`;
};
// Hide the filter legends by default
document.getElementById('platform-legend').style.display = 'none';
document.getElementById('enforcement-legend').style.display = 'none';
// Hide all checkbox groups by default
document.querySelectorAll('.checkbox-group').forEach(group => {
group.style.display = 'none';
});
// Show the corresponding checkbox group when a radio button is clicked
document.querySelectorAll('input[name="layer"]').forEach(radio => {
radio.addEventListener('change', () => {
document.querySelectorAll('.checkbox-group').forEach(group => {
group.style.display = 'none';
});
const selectedLayer = radio.value;
const checkboxGroup = document.getElementById(selectedLayer + 'LayerOptions');
if (checkboxGroup) {
checkboxGroup.style.display = 'block';
}
});
});
// Ensure radio buttons are unchecked on page reload
document.addEventListener('DOMContentLoaded', () => {
document.querySelectorAll('input[type="radio"]').forEach(radio => {
radio.checked = false;
});
});
// Ensure that all checkbox inputs are unchecked on page reload
document.addEventListener('DOMContentLoaded', () => {
document.querySelectorAll('input[type="checkbox"]').forEach(checkbox => {
checkbox.checked = false;
});
});
// Event listener for the "Reset" button
document.getElementById('resetButton').addEventListener('click', function() {
// Reload the page
location.reload();
});
// Whenever a radio button is clicked, uncheck all checkboxes
document.querySelectorAll('input[name="layer"]').forEach(radio => {
radio.addEventListener('change', () => {
document.querySelectorAll('input[type="checkbox"]').forEach(checkbox => {
checkbox.checked = false;
});
});
});
// Get the height of the titlebar div
const titlebarHeight = document.getElementById('titlebar').offsetHeight;
// Define the width and height for the SVG
const width = window.innerWidth * 0.75;
const height = window.innerHeight;
// Create the SVG
const svg = d3.select("#map")
.append("svg")
.attr("width", "100%")
.attr("height", "100%")
.attr("viewBox", `0 0 ${width} ${height}`); // Optional: Use viewBox to control scaling
// Define the projection
const projection = d3.geoAlbersUsa()
.translate([width / 2, (height / 2)])
.scale(1000)
// Define the path
const path = d3.geoPath(projection);
// Create a tooltip
const tooltip = d3.select("#tooltip");
// Create a hovertooltip
const hovertooltip = d3.select("#hovertooltip");
// Universal groupings based on radio group
// Define the array of companies values
const companiesValues = ['exante', 'individual', 'thirdparty', 'fgg', 'consequences', 'reporting'];
// Define the array of law enforcement values
const lawEnforcementValues = ['regulation'];
// Load the data
Promise.all([
d3.csv("data/IGG_laws.csv"),
d3.json("data/states-10m.json")
]).then(makeMap).catch(error => console.error('Error loading data:', error));
// Define an empty object to store the state groups
let stateGroups = {};
// Define the function to make the map
function makeMap([dnaLaw, states]) {
// Store the data in a global variable
stateGroups = {
coverageGroup: svg.append("g").attr("id", "coverageLayer"),
filterGroup: svg.append("g").attr("id", "filterLayer"),
};
// Define the pattern and add it to the SVG
svg.append("defs")
.append("pattern")
.attr("id", "crosshatch-pattern-right")
.attr("patternUnits", "userSpaceOnUse")
.attr("width", 15)
.attr("height", 15)
.append("image")
.attr("href", "patterns/lines-d-02.png") // Make sure the path is correct
.attr("x", 0)
.attr("y", 0)
.attr("width", 15)
.attr("height", 15);
// Define the pattern and add it to the SVG
svg.append("defs")
.append("pattern")
.attr("id", "crosshatch-pattern-left")
.attr("patternUnits", "userSpaceOnUse")
.attr("width", 15)
.attr("height", 15)
.append("image")
.attr("href", "patterns/lines-d-05.png") // Make sure the path is correct
.attr("x", 0)
.attr("y", 0)
.attr("width", 15)
.attr("height", 15);
// Define the pattern and add it to the SVG
svg.append("defs")
.append("pattern")
.attr("id", "crosshatch-pattern-cross")
.attr("patternUnits", "userSpaceOnUse")
.attr("width", 15)
.attr("height", 15)
.append("image")
.attr("href", "patterns/lines-d-25.png") // Make sure the path is correct
.attr("x", 0)
.attr("y", 0)
.attr("width", 15)
.attr("height", 15);
// Define the zoom behavior
const zoom = d3.zoom().scaleExtent([0, 8]).on("zoom", zoomed);
// Call the zoom behavior on the SVG
svg.call(zoom);
// Define the zoomed function
function zoomed(event) {
svg.selectAll("g").attr("transform", event.transform);
}
// Get the bounds of the map
const bounds = path.bounds(topojson.feature(states, states.objects.states));
// Calculate the initial scale
const initialScale = Math.min(width / (bounds[1][0] - bounds[0][0]), height / (bounds[1][1] - bounds[0][1])) * 0.9;
// Call the zoom behavior on the SVG
svg.call(zoom.transform, d3.zoomIdentity.translate(width / 2, height / 2).scale(initialScale).translate(-width / 2, -height / 2));
// Group the data by state to map the coverage
const groupedData = groupAndCountEntriesForStates(dnaLaw);
// Draw the initial map
drawCoverageLayer(stateGroups.coverageGroup, states, groupedData);
// Populate the sidebar with all state details
populateStateDetails(groupedData);
// Define an empty array to store the filtered data
let filteredData = [];
// Listen for a click on a radio button
document.querySelectorAll('input[name="layer"]').forEach(radio => {
radio.addEventListener('click', function() {
// Remove the legend
document.getElementById('legend').style.display = 'none';
// Define an empty array to store the sidebar filters
let sidebarFilters = [];
// Clear the filteredData array
filteredData.length = 0;
// If the radio button value is 'companies', for every value in the companiesValues array, if any groupedData[value] is true, return the groupedData object in a new array
if (radio.value === 'companies') {
// Show the platform-legend
document.getElementById('platform-legend').style.display = 'block';
// Hide the enforcement-legend
document.getElementById('enforcement-legend').style.display = 'none';
// Change the map title
document.querySelector('.dynamictitle').textContent = 'State Laws Regulating Consumer Genetics Platforms';
// For every value in the companiesValues array...
companiesValues.forEach(value => {
// For every object in the groupedData array...
groupedData.forEach(data => {
// If any data[value] is true...
if (data[value]) {
// Add each data object to the filteredData array, but do not push duplicates
if (!filteredData.includes(data)) {
filteredData.push(data);
}
}
});
});
sidebarFilters = companiesValues;
} // If the radio button value is 'lawEnforcement', for every value in the lawEnforcementValues array, if any groupedData[value] is true, return the groupedData object in a new array
else if (radio.value === 'lawEnforcement') {
// Show the enforcement-legend
document.getElementById('enforcement-legend').style.display = 'block';
// Hide the platform-legend
document.getElementById('platform-legend').style.display = 'none';
// Change the map title
document.querySelector('.dynamictitle').textContent = 'State Laws Regulating Law Enforcement Directly';
// For every value in the lawEnforcementValues array...
lawEnforcementValues.forEach(value => {
// For every object in the groupedData array...
groupedData.forEach(data => {
// If any data[value] is true...
if (data[value]) {
// Add each data object to the filteredData array, but do not push duplicates
if (!filteredData.includes(data)) {
filteredData.push(data);
}
}
});
});
sidebarFilters = lawEnforcementValues;
}
// Now feed the filteredData array to a drawFilteredLayer function
drawFilteredLayer(stateGroups.filterGroup, states, filteredData, companiesValues);
// Call the populateStateDetails function to update the sidebar
populateStateDetails(filteredData, sidebarFilters);
});
});
// Listen for a click on a checkbox
document.querySelectorAll('input[type="checkbox"]').forEach(checkbox => {
checkbox.addEventListener('click', function() {
// Clear the filteredData array
filteredData.length = 0;
// Make an array of the checked checkboxes
const checkedCheckboxes = Array.from(document.querySelectorAll('input[type="checkbox"]:checked')).map(checkbox => checkbox.value);
// Also log the radio button value
const checkedRadio = document.querySelector('input[name="layer"]:checked').value;
// If checkedCheckboxes is empty...
if (checkedCheckboxes.length === 0) {
// For every value in the companiesValues array...
companiesValues.forEach(value => {
// For every object in the groupedData array...
groupedData.forEach(data => {
// If any data[value] is true...
if (data[value]) {
// Add each data object to the filteredData array, but do not push duplicates
if (!filteredData.includes(data)) {
filteredData.push(data);
}
}
});
});
} else if (checkedRadio === 'companies') {
const filteredStateData = groupedData.filter(d => {
return checkedCheckboxes.every(checkbox => {
return d[checkbox];
});
});
// Push each object in filteredStateData to the filteredData array
filteredStateData.forEach(data => {
filteredData.push(data);
});
};
// Now feed the filteredData array to a drawFilteredLayer function
drawFilteredLayer(stateGroups.filterGroup, states, filteredData, checkedCheckboxes);
// Call the populateStateDetails function to update the sidebar
populateStateDetails(filteredData, checkedCheckboxes);
});
});
// STATE LAW COMPARISON START
// List of US states
const compStates = [
"None selected", "Alabama", "Alaska", "Arizona", "Arkansas", "California", "Colorado", "Connecticut",
"Delaware", "Florida", "Georgia", "Hawaii", "Idaho", "Illinois", "Indiana", "Iowa",
"Kansas", "Kentucky", "Louisiana", "Maine", "Maryland", "Massachusetts", "Michigan",
"Minnesota", "Mississippi", "Missouri", "Montana", "Nebraska", "Nevada", "New Hampshire",
"New Jersey", "New Mexico", "New York", "North Carolina", "North Dakota", "Ohio",
"Oklahoma", "Oregon", "Pennsylvania", "Rhode Island", "South Carolina", "South Dakota",
"Tennessee", "Texas", "Utah", "Vermont", "Virginia", "Washington", "West Virginia",
"Wisconsin", "Wyoming"
];
// Populate the dropdown menus
const firstStateDropdown = document.getElementById('firstStateDropdown');
const secondStateDropdown = document.getElementById('secondStateDropdown');
compStates.forEach(state => {
const option1 = document.createElement('option');
option1.value = state;
option1.textContent = state;
firstStateDropdown.appendChild(option1);
const option2 = document.createElement('option');
option2.value = state;
option2.textContent = state;
secondStateDropdown.appendChild(option2);
});
// Get the modal
const modal = document.getElementById("myModal");
// Get the button that opens the modal
const btn = document.getElementById("compareButton");
// Get the <span> element that closes the modal
const span = document.getElementsByClassName("close")[0];
// When the user clicks on <span> (x), close the modal
span.onclick = function() {
modal.style.display = "none";
}
// When the user clicks anywhere outside of the modal, close it
window.onclick = function(event) {
if (event.target == modal) {
modal.style.display = "none";
}
}
// Update the table headers when a state is selected
firstStateDropdown.onchange = function() {
document.getElementById('firstStateHead').textContent = firstStateDropdown.value;
}
secondStateDropdown.onchange = function() {
// Prevent the user from selecting the same state in both dropdowns
if (firstStateDropdown.value === secondStateDropdown.value) {
alert('Please select two different states to compare.');
secondStateDropdown.value = 'None selected';
}
document.getElementById('secondStateHead').textContent = secondStateDropdown.value;
}
// When the user clicks the button, open the modal
btn.onclick = function() {
// Clear all the cells in the table
document.getElementById('firstStateExante').textContent = '';
document.getElementById('firstStateIndividual').textContent = '';
document.getElementById('firstStateThirdparty').textContent = '';
document.getElementById('firstStateFgg').textContent = '';
document.getElementById('firstStateConsequences').textContent = '';
document.getElementById('firstStateReporting').textContent = '';