forked from SteveCline/samba
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
894 lines (874 loc) · 32.8 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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>SAMBA Trails</title>
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />
<meta name="description" content="Susquehanna Area Mountain Biking Association's Trails Map." />
<meta name="keywords" content="SAMBA, Susquehanna Area Mountain Biking Association, Harrisburg Mountain Bike Trails, Harrisburg Trails, Mountain Bike Trails, PA Mountain Bike Trails, Lancaster Mountain Bike Trails" />
<meta name="author" content="Susquehanna Area Mountain Biking Association" />
<meta property="og:image" content="https://sambatrails.bike/assets/social.png">
<meta property="og:image:width" content="1024">
<meta property="og:image:height" content="512">
<link rel="shortcut icon" href="assets/favicon.ico" type="image/x-icon">
<link href="https://api.mapbox.com/mapbox-gl-js/v1.9.1/mapbox-gl.css" rel="stylesheet" />
<style>
body { margin: 0; padding: 0; font-family: Arial,sans-serif; }
h1 { font-weight: normal; font-size: 24px; }
a {
color: #fff;
}
#map { position: absolute; top: 46px; bottom: 0; width: 100%; }
#banner {
position: relative;
height:46px;
background-color:#111;
box-shadow: 0 1px 2px rgba(0,0,0,0.3);
z-index: 1;
}
#menu-icon {
position: absolute;
top: 12px;
right: 12px;
cursor: pointer;
}
.burger-line-1, .burger-line-2, .burger-line-3 {
width: 28px;
height: 4px;
background-color: #f47b20;
border-radius: 4px;
transition: 0.3s;
}
.burger-line-1 {
margin-top: 0;
}
.burger-line-2, .burger-line-3 {
margin-top: 5px;
}
.bar-swap .burger-line-1 {
transform: rotate(-45deg) translate(-6.25px, 6.25px);
}
.bar-swap .burger-line-2 {
opacity: 0;
}
.bar-swap .burger-line-3 {
transform: rotate(45deg) translate(-6.25px, -6.25px);
}
#menu {
position: fixed;
background: #111;
color: #fff;
border-top: 2px solid #f47b20;
padding: 0 12px;
z-index: 3;
left: 0;
right: 0;
top: 46px;
height: 0;
overflow: auto;
opacity: 0;
transition: all 0.3s ease-in-out;
}
#menu.show {
opacity: 1;
height: calc(100% - 48px);
}
@media only screen and (min-width: 1000px) {
#menu {
width: 400px;
left: auto;
}
}
#info-container {
position: fixed;
background: #111;
color: #fff;
padding: 0 12px;
z-index: 3;
left: 0;
right: 0;
bottom: 0;
height: 0;
opacity: 0.3;
overflow: hidden;
transition: all 0.3s ease-in-out;
}
#info-container.show {
opacity: 1;
height: 174px;
}
#info-container-title {
font-size: 22px;
margin-top: 10px;
}
#graph {
width:100%;
height:100px;
}
#graph-details {
position: absolute;
font-size: 26px;
color: #f47b20;
top: 6px;
right: 12px;
cursor: pointer;
}
.graph-line {
stroke: #78866b;
stroke-width: 2;
fill: rgba(120, 134, 107,0.4);
stroke-linejoin: round;
}
.graph-label {
fill: #fff;
font-size: 11px;
font-style: italic;
}
.accordion {
margin-bottom: 12px;
}
.grid-container {
display: grid;
grid-template-columns: auto max-content;
}
.grid-item {
background: rgba(120, 134, 107,0.4);
padding: 12px;
cursor: pointer;
font-size: 16px;
transition: all 0.3s ease-in-out;
}
.grid-item:hover {
background: rgba(120, 134, 107,0.6);
}
.grid-content {
border-left: 2px solid rgba(120, 134, 107,0.4);
border-right: 2px solid rgba(120, 134, 107,0.4);
border-bottom: 2px solid rgba(120, 134, 107,0.4);
font-size: 14px;
padding: 12px;
display: none;
}
.grid-content.show {
display: block;
}
.go {
color: #f47b20;
}
.imba-logo {
display: block;
margin-left: auto;
margin-right: auto;
width: 156px;
margin-bottom: 30px;
}
.event-container {
margin-bottom: 12px;
}
.date-time {
font-style: italic;
font-size: 0.8em;
color: #f47b20;
}
.pushpin {
height: 34px;
cursor: pointer;
margin-right: 12px;
}
.mapboxgl-ctrl button:not(:disabled):hover{
border-radius: 50%;
}
.mapboxgl-ctrl-group {
border-radius: 50%;
}
.mapboxgl-ctrl-group button {
width: 33px;
height: 33px;
}
.mapboxgl-ctrl button.mapboxgl-ctrl-compass .mapboxgl-ctrl-icon {
background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 29 29' xmlns='http://www.w3.org/2000/svg' fill='%23f00'%3E%3Cpath d='M10.5 14l4-8 4 8h-8z'/%3E%3Cpath d='M10.5 16l4 8 4-8h-8z' fill='%23ccc'/%3E%3C/svg%3E");
}
</style>
</head>
<body>
<header id="banner">
<a href="http://sambabiker.com/samba/"><img src="assets/logo.svg" style="height:38px;border:0;margin-top:4px;margin-left:4px;"></a>
<div style="color:#fff;position:absolute;display:inline-block;font-size:40px;padding:2px 10px;">Trails</div>
<div id="menu-icon">
<div class="burger-line-1"></div>
<div class="burger-line-2"></div>
<div class="burger-line-3"></div>
</div>
</header>
<div id="menu">
<h1>Trail Systems</h1>
<div class="accordion">
<div class="grid-container">
<div class="grid-item head">
Hershey Medical Center Trails
</div>
<div class="grid-item go">
Go <svg height="12" width="8"><polyline points="2,2 6,6 2,10" stroke="#f47b20" stroke-width="2" fill="none" stroke-linecap="round" /></svg>
</div>
</div>
<div class="grid-content">
This partnership with Penn State University at the Milton S. Hershey Medical Center is 10 miles of mountain bike trails with options for users of all skill levels. The trails can be accessed locally using the Eshenour Memorial bike path. The trail system is divided into east and west sides. The unique terrain is generally rocky and rugged and while the east side offers more open, flowing trails, the west side is more technical and challenging.
</div>
</div>
<div class="accordion">
<div class="grid-container">
<div class="grid-item head">
Rattling Creek Trail System
</div>
<div class="grid-item go">
Go <svg height="12" width="8"><polyline points="2,2 6,6 2,10" stroke="#f47b20" stroke-width="2" fill="none" stroke-linecap="round" /></svg>
</div>
</div>
<div class="grid-content">
The Rattling Creek trail network, awarded IMBA Epic staus in 2012, covers over 20+ miles of rocky challenging classic east coast singletrack terrain, as well as miles of tamer snowmobile trails and gravel forest roads. The trail network encompasses trails on the Weiser State Forest Haldeman Tract and on Lykens Borough property. This trail system has no cell phone coverage. Please remember to always wear fluorescent orange during hunting season. Hunting is permitted 7 days a week during hunting seasons.
</div>
</div>
<div class="accordion">
<div class="grid-container">
<div class="grid-item head">
Parkway Trail System
</div>
<div class="grid-item go">
Go <svg height="12" width="8"><polyline points="2,2 6,6 2,10" stroke="#f47b20" stroke-width="2" fill="none" stroke-linecap="round" /></svg>
</div>
</div>
<div class="grid-content">
Located along Harrisburg's Capital Area Greenbelt are 8.5 miles of twisty and unqiue mountain bike trails. Expect short steep climbs and descents, log piles, and other interesting features to challenge your skills. It is broken into three sections, Cameron Parkway, Dock Woods, and Paxtang Parkway.
</div>
</div>
<div class="accordion">
<div class="grid-container">
<div class="grid-item head">
Swatara State Park
</div>
<div class="grid-item go">
Go <svg height="12" width="8"><polyline points="2,2 6,6 2,10" stroke="#f47b20" stroke-width="2" fill="none" stroke-linecap="round" /></svg>
</div>
</div>
<div class="grid-content">
At over 8 miles, Swatara State Park's mountain bike trails are a system of 6 looped trails that twist through the woods and hills and are generally considered a good place for introductory skills. These trails are no longer offically maintained by SAMBA.
</div>
</div>
<div class="accordion">
<div class="grid-container">
<div class="grid-item head">
Governor Dick
</div>
<div class="grid-item go">
Go <svg height="12" width="8"><polyline points="2,2 6,6 2,10" stroke="#f47b20" stroke-width="2" fill="none" stroke-linecap="round" /></svg>
</div>
</div>
<div class="grid-content">
Officially named the "Clarence Schock Memorial Park at Governor Dick", the park is located in Mount Gretna. The park offers 10 miles of trail open to bikes. Signs are clearly marked to indicate which trails are open to bikes and which are not.
</div>
</div>
<div class="accordion">
<div class="grid-container">
<div class="grid-item head">
Camp Mack
</div>
<div class="grid-item go">
Go <svg height="12" width="8"><polyline points="2,2 6,6 2,10" stroke="#f47b20" stroke-width="2" fill="none" stroke-linecap="round" /></svg>
</div>
</div>
<div class="grid-content">
Totaling 16 miles of trails and forest roads, the J. Edward Mack Scout Reservation is a private property owned and operated by the <a href="http://padutchbsa.org/">PA Dutch Council of the Boy Scouts of America</a>. SAMBA maintains a volunteer trail stewardship agreement with the PA Dutch Council to allow for mountain biking on this 1000+ acre property. It will be closed to mountain biking during the hunting season.
</div>
</div>
<div class="accordion">
<div class="grid-container">
<div class="grid-item head">
Ephrata Bike Park at Heatherwood
</div>
<div class="grid-item go">
Go <svg height="12" width="8"><polyline points="2,2 6,6 2,10" stroke="#f47b20" stroke-width="2" fill="none" stroke-linecap="round" /></svg>
</div>
</div>
<div class="grid-content">
This bike park is a partnership between SAMBA, Ephrata Borough, Mainspring of Ephrata, Green Mountain Cyclery, and local brewers at St Boniface Craft Brewing, Black Forest Brewing, and Pour Man Brewing Company. The park consists of a beginner trail and intermediate trail totaling 1.5 miles, a pump track, balance bike track for the little ones, two bridges, dirt jumps, and three skills areas.
</div>
</div>
<div class="accordion">
<div class="grid-container">
<div class="grid-item head">
Coleman Park Bicycle Playground
</div>
<div class="grid-item go">
Go <svg height="12" width="8"><polyline points="2,2 6,6 2,10" stroke="#f47b20" stroke-width="2" fill="none" stroke-linecap="round" /></svg>
</div>
</div>
<div class="grid-content">
The Coleman Park Bicycle Playground is a partnership between SAMBA, Lebanon City, Lebanon Valley Bicycle Coalition, and the Community Health Council of Lebanon County. The park consists of a pump track, a jump track, and a balance bike track for the little ones.
</div>
</div>
<div class="accordion">
<div class="grid-container">
<div class="grid-item head">
Mechanicsburg Trails & Trees
</div>
<div class="grid-item go">
Go <svg height="12" width="8"><polyline points="2,2 6,6 2,10" stroke="#f47b20" stroke-width="2" fill="none" stroke-linecap="round" /></svg>
</div>
</div>
<div class="grid-content">
Mechanicsburg Trails & Trees Environmental Center features just over a mile of bike trails near the Mechanicsburg Middle School.
</div>
</div>
<div class="accordion">
<div class="grid-container">
<div class="grid-item head">
Mechanicsburg Loop
</div>
<div class="grid-item go">
Go <svg height="12" width="8"><polyline points="2,2 6,6 2,10" stroke="#f47b20" stroke-width="2" fill="none" stroke-linecap="round" /></svg>
</div>
</div>
<div class="grid-content">
The Mechanicsburg Area Senior High School (MASH) mountain bike trail loop is just over a half mile long and used by the school's team.
</div>
</div>
<h1>Sponsors</h1>
<div id="sponsor-list"></div>
<h1>Mission</h1>
<p>Susquehanna Area Mountain Bike Association's mission is to advocate for mountain bike trail access by creating positive relationships and partnerships with area land owners and organizations. We provide information, education and support to Central Pennsylvania mountain bike riders.</p>
<p style="text-align: center;margin: 32px 0;"><a href="https://sambabiker.com/donate/" style="text-decoration:none;color:#f47b20;border:2px solid #f47b20;padding:12px;">Donate to SAMBA</a></p>
<p style="text-align: center;">Chapter of</p>
<a href="https://www.imba.com/"><img src="assets/imbalogo.png" class="imba-logo"></a>
</div>
<div id="info-container">
<span id="graph-details">×</span>
<div id="info-container-title"></div>
<div id="graph"></div>
</div>
<div id="map"></div>
<script src="https://api.mapbox.com/mapbox-gl-js/v1.9.1/mapbox-gl.js"></script>
<script src="assets/turf.js"></script>
<script src="assets/chart.js"></script>
<script src="assets/data.js"></script>
<script>
var menu = document.querySelector("#menu");
var menuIcon = document.querySelector("#menu-icon");
menuIcon.addEventListener("click", function(e){
menuClose();
removeStuff();
});
var infoContainer = document.querySelector("#info-container");
var infoContainerTitle = document.querySelector("#info-container-title");
var eventListContainer = document.querySelector("#event-schedule");
function removeStuff(){
infoContainer.classList.remove("show");
map.setFilter("trails-layer-highlight", ["==","OBJECTID", ""]);
var a = {"type": "Feature","geometry": {"type": "Point","coordinates": [0,-90]}};
map.getSource("start-pnt-source").setData(a);
map.getSource("end-pnt-source").setData(a);
}
function menuClose(){
menuIcon.classList.toggle("bar-swap");
menu.classList.toggle("show");
var c = document.querySelectorAll(".grid-content");
for (var i = 0; i < c.length; i++){
c[i].classList.remove("show");
}
}
var head = document.querySelectorAll(".head");
for (var i = 0; i < head.length; i++){
head[i].addEventListener("click",function(e){
e.target.parentElement.nextElementSibling.classList.toggle("show");
});
}
var map = new mapboxgl.Map({
container: "map",
style: "mapbox://styles/stevec/ck8s5iuc4127n1inzsogz17b3",
bounds: [[-76.117582,40.587861],[-76.954153,40.150705]],
dragRotate: false,
boxZoom: false,
accessToken: "pk.eyJ1Ijoic3RldmVjIiwiYSI6ImNrYXp0cmZiMzAxd3UycXF0ZWh5MWtmdXkifQ.zm5r3rXG0royydqKMkQm-g",
hash: true,
minZoom: 7,
attributionControl: false
});
map.addControl(new mapboxgl.GeolocateControl({positionOptions: {enableHighAccuracy: true},trackUserLocation: true}), "top-left");
map.addControl(new mapboxgl.NavigationControl({showZoom:false}),"top-left");
map.on("load", function() {
map.addSource("trails-source", {
"type": "geojson",
"data": trailsData
});
map.addSource("polygon-source", {
"type": "geojson",
"data": polyData
});
map.addLayer({
"id": "polygon-layer",
"type": "fill",
"source": "polygon-source",
"minzoom": 14.5,
"paint": {
"fill-color": "#f1c40f",
"fill-opacity": 0.6,
}
});
map.addSource("restricted-source", {
"type": "geojson",
"data": restrictedData
});
map.addLayer({
"id": "restricted-layer",
"type": "fill",
"source": "restricted-source",
"minzoom": 12,
"paint": {
"fill-color": "#f47b20",
"fill-opacity": 0.4,
}
});
map.addLayer({
"id": "trails-layer-select",
"type": "line",
"source": "trails-source",
"paint": {
"line-width": 16,
"line-opacity": 0
}
});
map.addLayer({
"id": "trails-layer-highlight",
"type": "line",
"source": "trails-source",
"layout": {
"line-join": "round",
},
"paint": {
"line-width": 10,
"line-color": "#f47b20",
"line-opacity": 0.8
},
"filter": ["==","TR_NAME", ""]
});
map.addLayer({
"id": "trails-layer",
"type": "line",
"source": "trails-source",
"paint": {
"line-width": 3,
"line-color": ["match",["get", "DIFFICULTY"],["Advanced"],"#111",["Intermediate"],"#06c",["Beginner"],"#199119",["Other"],"#8e44ad",["Closed"],"#ff0000","#ccc"]
},
"layout": {
"line-join": "round",
}
});
map.addLayer({
"id": "trails-labels",
"type": "symbol",
"source": "trails-source",
"minzoom": 12.5,
"layout": {
"symbol-placement": "line",
"text-field": ["get", "TR_NAME"],
"text-size": 11
},
"paint": {
"text-halo-color": "#fff",
"text-halo-width": 2,
"text-color": ["match",["get", "DIFFICULTY"],["Advanced"],"#111",["Intermediate"],"#06c",["Beginner"],"#199119",["Other"],"#8e44ad",["Closed"],"#ff0000","#ccc"]
}
});
map.addLayer({
"id": "restricted-text-layer",
"type": "symbol",
"source": "restricted-source",
"minzoom": 13,
"layout": {
"text-field": ["get", "NAME"],
"text-font": ["Source Sans Pro SemiBold","Source Sans Pro Regular"],
"text-size": 11,
},
"paint": {
"text-color": "#fff",
"text-halo-color": "#f47b20",
"text-halo-width": 2
}
});
//------------
/*map.addSource("hunting-source", {
"type": "geojson",
"data": {"type":"FeatureCollection","features":[{"type":"Feature","geometry":{"type":"Point","coordinates":[-76.334904,40.254443]}}]}
});
map.addLayer({
"id": "hunting-notice",
"type": "symbol",
"source": "hunting-source",
"minzoom": 12,
"layout": {
"text-field": "Closed to All Public Use\nOctober 1, 2022 - January 16, 2023\nMonday - Saturday\nand Sunday November 13th, 20th and 27th",
"text-font": ["Source Sans Pro SemiBold","Source Sans Pro Regular"],
"text-size": 11,
},
"paint": {
"text-color": "#000",
"text-halo-color": "#fff",
"text-halo-width": 2
}
});*/
//------------
map.addSource("pax-source", {
"type": "geojson",
"data": {"type":"FeatureCollection","features":[{"type":"Feature","geometry":{"type":"Point","coordinates":[-76.831915,40.256211]}}]}
});
map.addLayer({
"id": "pax-icon-layer",
"type": "symbol",
"source": "pax-source",
"minzoom": 13,
"layout": {
"icon-image": "bicycle-15",
"icon-allow-overlap": true
},
"paint": {
"icon-color": "#f47b20"
}
});
map.addLayer({
"id": "pax-text-layer",
"type": "symbol",
"source": "pax-source",
"minzoom": 13,
"layout": {
"text-field": "Paxtang Park",
"text-font": ["Source Sans Pro SemiBold","Source Sans Pro Regular"],
"text-size": 11,
"text-offset": [0,-1.3],
"text-optional": true
},
"paint": {
"text-color": "#f47b20",
"text-halo-color": "#fff",
"text-halo-width": 2
}
});
map.addSource("coleman-source", {
"type": "geojson",
"data": {"type":"FeatureCollection","features":[{"type":"Feature","geometry":{"type":"Point","coordinates":[-76.442441,40.349718]}}]}
});
map.addLayer({
"id": "coleman-icon-layer",
"type": "symbol",
"source": "coleman-source",
"layout": {
"icon-image": "bicycle-15",
"icon-allow-overlap": true
},
"paint": {
"icon-color": "#f47b20"
}
});
map.addLayer({
"id": "coleman-text-layer",
"type": "symbol",
"source": "coleman-source",
"layout": {
"text-field": "Coleman Park",
"text-font": ["Source Sans Pro SemiBold","Source Sans Pro Regular"],
"text-size": 11,
"text-offset": [0,-1.3],
"text-optional": true
},
"paint": {
"text-color": "#f47b20",
"text-halo-color": "#fff",
"text-halo-width": 2
}
});
//SPONSOR
map.addSource("sponsor-source", {
"type": "geojson",
"data": sponsorsData
});
map.addLayer({
"id": "sponsor-layer",
"type": "circle",
"source": "sponsor-source",
"paint": {
"circle-radius": 4.5,
"circle-color": "#f47b20",
"circle-stroke-color": "#fff",
"circle-stroke-width": 1
}
});
map.addLayer({
"id": "sponsor-text-layer",
"type": "symbol",
"source": "sponsor-source",
"minzoom": 12.5,
"layout": {
"text-field": ["get", "NAME"],
"text-font": ["Source Sans Pro SemiBold","Source Sans Pro Regular"],
"text-size": 11,
"text-offset": [0,-1.3],
"text-optional": true
},
"paint": {
"text-color": "#f47b20",
"text-halo-color": "#fff",
"text-halo-width": 2
}
});
map.addSource("dero-source", {
"type": "geojson",
"data": deroData
});
map.addLayer({
"id": "dero-icon-layer",
"type": "symbol",
"source": "dero-source",
"minzoom": 14.5,
"layout": {
"icon-image": "hardware-15",
"icon-allow-overlap": true
}
});
map.addLayer({
"id": "dero-text-layer",
"type": "symbol",
"source": "dero-source",
"minzoom": 15.5,
"layout": {
"text-field": "Bike Repair",
"text-font": ["Source Sans Pro SemiBold","Source Sans Pro Regular"],
"text-size": 11,
"text-offset": [0,-1.3],
"text-optional": true
},
"paint": {
"text-color": "#f47b20",
"text-halo-color": "#fff",
"text-halo-width": 2
}
});
map.addSource("parking-source",{
"type": "geojson",
"data": parkingData
});
map.addLayer({
"id": "parking-layer",
"type": "circle",
"source": "parking-source",
"minzoom": 12,
"paint": {
"circle-radius": 7,
"circle-color": "#38f",
"circle-stroke-color": "#fff",
"circle-stroke-width": 1
}
});
map.addLayer({
"id": "parking-labels",
"type": "symbol",
"source": "parking-source",
"minzoom": 12,
"layout": {
"text-field": "P",
"text-size": 12,
"text-justify": "center",
"icon-allow-overlap": true,
"text-font": ["Open Sans Bold","Open Sans Regular","Arial Unicode MS Bold","Arial Unicode MS Regular"]
},
"paint": {
"text-color": "#fff"
}
});
map.addSource("start-pnt-source", {
"type": "geojson",
"data": null
});
map.addLayer({
"id": "start-layer",
"type": "circle",
"source": "start-pnt-source",
"paint": {
"circle-radius": 5,
"circle-color": "green",
"circle-stroke-color": "#fff",
"circle-stroke-width": 2
}
});
map.addSource("end-pnt-source", {
"type": "geojson",
"data": null
});
map.addLayer({
"id": "end-layer",
"type": "circle",
"source": "end-pnt-source",
"paint": {
"circle-radius": 5,
"circle-color": "red",
"circle-stroke-color": "#fff",
"circle-stroke-width": 2
}
});
map.addSource("locator-source",{
"type": "geojson",
"data": null
});
map.addLayer({
"id": "locator-layer",
"type": "circle",
"source": "locator-source",
"paint": {
"circle-radius": 5,
"circle-color": "#38f",
"circle-stroke-color": "#fff",
"circle-stroke-width": 2
}
});
map.on("mouseenter", "trails-layer-select", function(e) {
map.getCanvas().style.cursor = "pointer";
});
map.on("mouseleave", "trails-layer-select", function(e) {
map.getCanvas().style.cursor = "";
});
map.on("click", function(e) {
removeStuff();
});
map.on("click", "trails-layer-select", function(e) {
var p = e.features[0].properties;
infoContainerTitle.innerHTML = getIcon(p.DIFFICULTY) + " " + p.TR_NAME + "<br><span style='font-size:16px;'>" + p.DIFFICULTY + " Trail - " + p.LEN + " miles</span>";
infoContainer.classList.add("show");
var features = trailsData.features;
var len = features.length
for (var i = 0; i < len; i++){
if (features[i].properties.OBJECTID === p.OBJECTID){
selectedTrailFeatureNumb = i;
var coordsArray = features[i].geometry.coordinates;
var startPoint = coordsArray[0];
var endPoint = coordsArray[coordsArray.length - 1];
map.getSource("start-pnt-source").setData({"type": "Feature","geometry": {"type": "Point","coordinates": startPoint}});
map.getSource("end-pnt-source").setData({"type": "Feature","geometry": {"type": "Point","coordinates": endPoint}});
createSvgLine(coordsArray);
break;
}
}
menuIcon.classList.remove("bar-swap");
menu.classList.remove("show");
map.setFilter("trails-layer-highlight", ["==","OBJECTID", p.OBJECTID]);
});
});
function getIcon(d){
var svgBeginner = '<svg height="20" width="20"><circle cx="10" cy="10" r="8" stroke="#fff" stroke-width="2" fill="#199119"/></svg>';
var svgInt = '<svg width="20" height="20"><rect x="2" y="2" width="16" height="16" style="fill:#06c;stroke-width:2;stroke:#fff" /></svg>';
var svgAdv = '<svg height="20" width="20"><polygon points="10,2 16,10 10,18 4,10" style="fill:#000;stroke:#fff;stroke-width:2" /></svg>';
var svgClosed = '<svg height="20" width="20"><polygon points="7,2 13,2 18,7 18,13 13,18 7,18 2,13 2,7" style="fill:#ff0000;stroke:#fff;stroke-width:2" /></svg>';
var svgOther = '<svg height="20" width="20"><polygon points="10,3 18,18 2,18" style="fill:#8e44ad;stroke:#fff;stroke-width:2" /></svg>';
var svgIcon = null;
switch(d){
case "Advanced": svgIcon = svgAdv;
break;
case "Intermediate": svgIcon = svgInt;
break;
case "Beginner": svgIcon = svgBeginner;
break;
case "Other": svgIcon = svgOther;
break;
case "Closed": svgIcon = svgClosed;
break;
default: svgIcon = null;
}
return svgIcon;
}
var bboxes = [
[[-76.6652,40.26289],[-76.6846,40.2546]], //HMC
[[-76.675283,40.556883],[-76.789441,40.5028]], //Rattling
[[-76.829649,40.274728],[-76.860611,40.241239]], //Parkway
[[-76.527182,40.499576],[-76.54499,40.485485]], //Swatara
[[-76.430502,40.261758],[-76.467095,40.232087]], //Gov Dick
[[-76.302786,40.263615],[-76.33813,40.237631]], //Camp Mack
[[-76.182844,40.174234],[-76.19124,40.169668]], //Ephrata
[[-76.435228,40.353086],[-76.450355,40.34753]], //Coleman Park
[[-76.995128,40.186151],[-76.998821,40.183393]], //Trails and Trees
[[-77.016461,40.202788],[-77.019392,40.201449]] //MASH
];
var goButtons = document.querySelectorAll(".grid-item.go");
goButtons.forEach(function(item,index){
goButtons[index].addEventListener("click",function(){
menuClose();
map.fitBounds(bboxes[index]);
});
});
var sponsorList = document.querySelector("#sponsor-list");
sponsorsData.features.forEach(function(item,index){
var d = document.createElement("div");
d.style.marginBottom = "10px";
var name = sponsorsData.features[index].properties.NAME;
var link = sponsorsData.features[index].properties.URL;
var loc = sponsorsData.features[index].geometry.coordinates;
var len = sponsorsData.features.length - 1;
if (index != len){
if (index > 0) {
var pushpin = document.createElement("img");
pushpin.src = "assets/marker.svg";
pushpin.style.height = "22px";
pushpin.style.marginRight = "12px";
pushpin.style.verticalAlign = "middle";
pushpin.style.cursor = "pointer";
pushpin.addEventListener("click",function(){
menuClose();
map.flyTo({center: loc, zoom: 14.4});
});
d.appendChild(pushpin);
}
else {
var svg = '<svg height="22" width="22" style="margin-right:12px;vertical-align:middle;"><polygon points="11,0 19,22 0,7 22,7 3,22" style="fill:#f47b20;"/></svg>';
d.innerHTML = svg;
}
var aTag = document.createElement("a");
aTag.href = link;
aTag.innerText = name;
d.appendChild(aTag);
}
sponsorList.appendChild(d);
});
/*
function cleanDate(date){
var options = {weekday: "long", year: "numeric", month: "long", day: "numeric"};
return date.toLocaleDateString(undefined, options) + " at " + date.toLocaleTimeString("en-US", {timeStyle: "short"});
}
function createEventItem(item){
var event = document.createElement("div");
event.classList.add("event-container");
var date = new Date(item.start_time);
event.innerHTML = "<a target='_blank' href='https://www.facebook.com/events/" + item.id + "'>" + item.name + "</a><br><span class='date-time'>" + cleanDate(date) + "</span>";
eventListContainer.append(event);
}
function getFacebookEvents(){
var timeStamp = Math.round((new Date()).getTime() / 1000);
var token = "EAANcW2CaS44BAGQKUhCxIY7tDkZAUxTDYPHABFQuT2xSWQJEqqylPuZAplZAgWbwKUlB8v7N2Lu6LKLCCkON6w7ZC5VvcRfdkHVCHZBkSznbGsIaVcpPGEfSdOZBG5HDhbT8KmQIMMCgemb2cw10o9St9OonY7hZC7k9d0ASZB1U383wu1r99uDSsUlh8oLHcOZBGZCZCn2m7BXoaz184TZB0klFaGSaN9cHLUfLXCWlEKrZCTXla92A0hiUQ";
var url = "https://graph.facebook.com/452608435516843/events?fields=name,start_time&access_token=" + token + "&since=" + timeStamp;
fetch(url)
.then(function(response){
return response.json();
})
.then(function(data){
var events = data.data.reverse();
events.forEach(function(item){
createEventItem(item);
});
})
.catch(function(error){
console.log(error);
var p = document.createElement("p");
p.style.color = "#f47b20";
p.innerText = "Events not available";
eventListContainer.append(p);
});
}
getFacebookEvents();
*/
</script>
</body>
</html>