-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.cfm
1413 lines (1141 loc) · 49.7 KB
/
index.cfm
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
<cfsetting showdebugoutput="false">
<cfset opType="LRT Schedule" />
<cfif isDefined('url.fromStop')><cfset opType="Bus Stop Schedule" />
<cfelseif isDefined('url.rid')><cfset opType="Bus Routes" />
</cfif>
<cfset PageTitle="#opType#">
<cfset PageTitleHead="#opType#" />
<!--- Toggle Dark Mode --->
<cfif isDefined('url.dark')>
<cfif url.dark IS 1>
<cfcookie name="LRT_DARK" value="true" expires="never" />
<cfelseif url.dark IS 0>
<cfcookie name="LRT_DARK" value="false" expires="never" />
</cfif>
</cfif>
<cfif cgi.SCRIPT_NAME contains "EXEC(" OR cgi.PATH_INFO contains "EXEC(" OR cgi.QUERY_STRING contains "EXEC("><cfabort></cfif>
<!--- Actual HTML Page Begins --->
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="x-ua-compatible" content="IE=Edge" />
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0" />
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<!--- Geo calculation stuff --->
<script defer src="latlon-spherical.min.js"></script>
<script defer src="dms.min.js"></script>
<script src="/Javascript/selectize/dist/js/standalone/selectize.min.js"></script>
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
<link rel="icon" type="image/png" href="/favicon.png" />
<link rel="apple-touch-icon" sizes="180x180" href="touch-icon-iphone-retina.png" />
<link rel="apple-touch-icon" sizes="167x167" href="touch-icon-ipad-retina.png" />
<!--- Custom Stylesheet for www2.epl.ca --->
<link rel="stylesheet" href="/w2.css" type="text/css"/>
<title><cfoutput>#PageTitleHead#</cfoutput></title>
<style>
body {
font-family: "Open Sans",sans-serif;
background-color: #cccac8;
margin:5px;
}
</style>
</head>
<body class="<cfif isDefined('cookie.lrt_dark') and cookie.lrt_dark IS true>darkMode</cfif>">
<div class="container clearfix">
<!--- If a sidebar is defined, it will be inserted here --->
<div class="page w2Contents">
<!-- Page contents go below here -->
<link href="/Javascript/selectize/dist/css/selectize.css" type="text/css" rel="stylesheet" />
<div class="pageTitle">
<a href="https://www.epl.ca"><svg id="eplLogo" width="143" height="38" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" preserveAspectRatio="xMinYMin">
<path id="eplWordmark" d="m64.75716,24.93909c0.113,2.558 1.363,3.723 3.608,3.723c1.62,0 2.927,-0.994 3.182,-1.904l3.552,0c-1.14,3.467 -3.557,4.945 -6.88,4.945c-4.63,0 -7.5,-3.185 -7.5,-7.73c0,-4.403 3.04,-7.756 7.5,-7.756c5,0 7.415,4.21 7.13,8.728l-10.589,0l-0.003,-0.006zm6.566,-2.55c-0.37,-2.046 -1.25,-3.126 -3.21,-3.126c-2.558,0 -3.296,1.99 -3.354,3.13l6.564,0l0,-0.004zm6.42,-5.767l3.835,0l0,1.874l0.057,0c0.966,-1.563 2.557,-2.273 4.375,-2.273c4.603,0 6.678,3.728 6.678,7.9c0,3.92 -2.16,7.59 -6.45,7.59c-1.762,0 -3.438,-0.77 -4.404,-2.216l-0.052,0l0,6.99l-4.035,0l0,-19.871l-0.004,0.006zm10.91,7.386c0,-2.33 -0.938,-4.745 -3.524,-4.745c-2.642,0 -3.494,2.36 -3.494,4.75s0.91,4.66 3.523,4.66c2.643,0 3.495,-2.273 3.495,-4.66l0,-0.005zm6.562,-12.986l4.034,0l0,20.287l-4.034,0l0,-20.293l0,0.006zm7.386,15.913l4.46,0l0,4.375l-4.46,0l0,-4.375zm17.73,-5.143c-0.257,-1.647 -1.31,-2.53 -2.984,-2.53c-2.585,0 -3.438,2.615 -3.438,4.774c0,2.103 0.824,4.632 3.353,4.632c1.87,0 2.95,-1.193 3.21,-2.982l3.89,0c-0.51,3.892 -3.21,6.023 -7.076,6.023c-4.432,0 -7.416,-3.127 -7.416,-7.53c0,-4.575 2.73,-7.956 7.5,-7.956c3.467,0 6.65,1.82 6.905,5.57l-3.95,0l0.006,-0.001zm6.135,-0.653c0.227,-3.78 3.608,-4.916 6.903,-4.916c2.928,0 6.45,0.658 6.45,4.18l0,7.646c0,1.335 0.143,2.67 0.512,3.267l-4.09,0c-0.143,-0.454 -0.257,-0.936 -0.285,-1.42c-1.278,1.335 -3.154,1.82 -4.944,1.82c-2.79,0 -5,-1.394 -5,-4.406c0,-3.324 2.5,-4.12 5,-4.46c2.47,-0.37 4.77,-0.284 4.77,-1.933c0,-1.733 -1.195,-1.99 -2.615,-1.99c-1.536,0 -2.53,0.627 -2.673,2.22l-4.034,0l0.006,-0.008zm9.32,2.983c-0.683,0.596 -2.104,0.624 -3.354,0.852c-1.256,0.257 -2.39,0.683 -2.39,2.16c0,1.505 1.163,1.875 2.47,1.875c3.154,0 3.27,-2.5 3.27,-3.38l0,-1.513l0.004,0.006z" />
<path d="m12.82716,1.75409l7.322,0l0,29.534l-7.327,0l0.005,-29.534z" fill="#7AC143"/>
<path d="m23.84816,1.75409l7.323,0l0,29.534l-7.32,0l-0.003,-29.534z" fill="#E50E63"/>
<path d="m34.87016,1.75409l7.32,0l0,29.534l-7.32,0l0,-29.534z" fill="#7D4199"/>
<path d="m45.89216,1.75409l7.322,0l0,29.534l-7.322,0l0,-29.534z" fill="#009DDC"/>
<path d="m1.80516,1.75409l7.322,0l0,29.534l-7.322,0l0,-29.534z" fill="#FDBB30"/>
</svg></a>
<cfoutput><span class="nowrap">#PageTitle#</span></cfoutput></div>
<style>
body {
color: #3f4344;
}
select {
/*-webkit-appearance:none;*/
padding:4px 6px; /* Needed for mobile safari to make the dropdowns not too tiny */
}
.pageTitle {
}
#eplLogo {
/*float:left;*/
margin-right:8px;
height:100%;
vertical-align:bottom;
}
#eplWordmark {
fill:#004B8D;
}
.darkMode #eplWordmark {
fill:white;
}
/* Style to handle selectize dropdowns */
.w2Form .selectizeLabel * {
float:none;
}
.selectizeLabel {
min-height:30px;
}
.selectizeLabel .selectize-input {
font-size:16px;
font-weight:normal;
}
.selectize-dropdown, .selectize-input, .selectize-input input {
font-size:14px;
font-weight:normal;
}
.selectize-dropdown [data-selectable] .highlight {
background: rgba(255, 255, 50, 0.3);
}
.selectize-control.multi .selectize-input > div {
border-radius:4px;
border:1px solid #AAA;
}
.selectize-control.multi .selectize-input > div.active {
background-color:#DDD;
color:black;
border-width:1px;
border-color:#999;
}
.selectize-dropdown-content .selected {
/*background-color:inherit;*/
text-decoration:none;
color:inherit;
box-shadow:none;
-webkit-box-shadow:none;
}
.w2Form input,
.w2Form button,
.w2Form textarea,
.w2Form select {
font-size: 16px;
border:1px solid #555;
}
.w2Form>label+label,
.w2Form>label+.formItem,
.w2Form>.formItem+.formItem,
.w2Form>.formItem+label,
.sectionContents>label+label {
padding-top: 0px;
}
#swapButtonLabel {
margin-top:20px;
}
input[type="button"], button {
border: solid 1px black;
border-radius:5px;
background-image:linear-gradient(to bottom, rgba(255,255,255,1) 0%,rgba(220,220,220,1) 100%);
}
.pageTitle {
font-size:24px;
}
.w2Form label, .w2Form .formItem {
/*line-height:2.5em;*/
}
.w2Form label {
overflow:auto;
}
.w2Form label.selectizeLabel {
overflow:visible;
/*display:block;*/
}
.leg {
margin-bottom:1px;
}
.leg .smaller {
font-size:18px;
}
.trainsFromTo {
margin:8px 0px 6px 0px;
font-size:18px;
text-align:center;
}
.tripTime {
margin-top:2px;
font-weight:normal;
font-size:17px;
}
div#timeLabel {
padding-top:5px;
}
#timeLabelText, #departLabelText {
text-align: left;
margin-top:5px;
color:black;
text-decoration: none;
}
a {
text-decoration: underline;
color:#0A2D75;
}
#nowLink, #nearestLink {
font-size:13px;
text-decoration: underline;
color:#0A2D75;
font-weight:normal;
<cfif (isDefined('url.time') AND len(url.time))
OR (isDefined('url.dow') AND len(url.dow))>
display:inline;
<cfelse>
display:none;
</cfif>
}
#nearestLink {
display:none;
}
.departures {
margin-top:20px;
max-width:400px;
}
.departures table {
margin:0;
font-size:17px;
width:400px;
}
.altColors tr {
background-color: #fff;
}
.altColors tr:nth-child(4n+3){
background-color:rgb(236, 236, 236);
}
.altColors tr:nth-child(4n+2){
background-color:rgb(255, 255, 255);
}
.altColors tr:nth-child(4n+4){
background-color:rgb(236, 236, 236);
}
.departures table thead th {
padding:3px 3px;
font-size:15px;
/*color:#555;*/
/*opacity:0.5;*/
/*font-weight:normal;*/
background-color: rgb(236, 236, 236);
}
.departures table td {
font-size:17px;
}
.nowrap {
white-space:nowrap;
}
#swapFromTo, #swapRouteFromTo {
font-size:13px;
padding:1px 2px 2px 2px;
}
#swapRouteFromTo {
text-align: center;
float:none;
margin:0 auto;
}
#nightModeLink {
text-align:center;
font-size:13px;
margin:15px;
}
#nightModeLink a {
color:#555;
text-decoration: none;
}
@media (max-width: 450px) {
#nearestLink {
display:inline;
margin-left:6px;
}
.pageTitle {
text-align: center;
}
.departures table {
width:100%;
}
#swapFromTo, #swapRouteFromTo {
width:50%;
padding:1px 10px 2px 10px;
}
#swapButtonLabel {
display:flex;
justify-content:center;
margin-bottom:8px;
}
label#toLabel,
div#timeLabel {
padding-top:0;
}
div#timeLabel {
display:flex;
justify-content:space-between;
}
#timeGroup {
width:auto;
}
}
.arrivalTime, .aT,
.countdown, .cD {
min-width:80px;
white-space:nowrap;
}
.arrivalTime, .aT {
font-weight:bold;
}
.trainName, .tN {
}
.due {
color:green;
font-weight:bold;
}
.gone {
color:#770000;
font-weight:bold;
}
#geoIcon {
width:13px;
height:12px;
}
#geoIcon path {
fill:#0A2D75;
}
tr.destRow, tr.dR {
display:none;
}
table td.destArrival,
table td.dA {
opacity:0.75;
font-size:15px;
text-align: center;
padding-bottom:8px;
padding-top:2px;
}
.opMode {
margin-top:5px;
display:flex;
justify-content:space-around;
max-width:400px;
flex-wrap:wrap;
}
.opMode a, .opMode span {
white-space:nowrap;
padding:4px 5px;
text-decoration: none;
}
.selectedMode {
text-decoration: none;
color:black;
background-color:rgba(0,0,0,.1);
border-radius:4px;
}
/* Dark Mode styles for Night */
body.darkMode {
background-color:#222;
color:#ccc;
}
.darkMode .selectedMode {
color:rgb(193, 211, 250);
background-color:rgba(255,255,255,.1);
}
.darkMode .pageTitle,
.darkMode #nowLink,
.darkMode #nearestLink {
color:rgb(126, 164, 241);
}
.darkMode a {
color:rgb(126, 164, 241);
}
.darkMode .w2Contents {
background-color:#111;
}
.darkMode #timeLabelText,
.darkMode #departLabelText {
color:#ccc;
}
.darkMode .altRow {
background-color: rgb(40, 40, 40);
}
.darkMode .departures table thead th {
/*color:#888;*/
background-color:rgb(40, 40, 40);
}
.darkMode .altColors tr {
background-color: #000;
}
.darkMode .altColors tr:nth-child(4n+3){
background-color:rgb(40, 40, 40);
}
.darkMode .altColors tr:nth-child(even){
/*background-color:rgb(40, 40, 40);*/
}
.darkMode .altColors tr:nth-child(4n+2){
background-color:rgb(0, 0, 0);
}
.darkMode .altColors tr:nth-child(4n+4){
background-color:rgb(40, 40, 40);
}
.darkMode .w2Form input,
.darkMode .w2Form button,
.darkMode .w2Form textarea,
.darkMode .w2Form select {
border:1px solid #888;
}
.darkMode select {
/*-webkit-appearance:none;*/
padding:4px 6px; /* Needed for mobile safari to make the dropdowns not too tiny */
color:white;
background-color:black;
background-image:linear-gradient(to bottom, rgba(100,100,100,0.45) 0%,rgba(0,0,0,0) 100%);
}
.darkMode .selectize-input {
background-color:black;
background-image:linear-gradient(to bottom, rgba(100,100,100,0.45) 0%,rgba(0,0,0,0) 100%);
border:1px solid #888;
}
.darkMode .selectize-control.single .selectize-input.input-active {
background: black;
}
.darkMode .selectize-dropdown {
color:white;
background-color:black;
border-color: #888;
}
.darkMode .selectize-dropdown, .darkMode .selectize-input, .darkMode .selectize-input input {
color:white;
}
.darkMode .selectize-dropdown .active {
background-color:#555;
color: white;
}
.darkMode .selectize-control.multi .selectize-input > div {
background-color:#111;
color:white;
border-color:#333;
}
.darkMode .selectize-control.multi .selectize-input > div.active {
background-color:#555;
color:white;
border-color:#777;
}
.darkMode .selectize-control.multi .selectize-input > div.active.selected {
color:white;
}
.darkMode .selectize-dropdown-content .selected {
background-color:black;
}
.darkMode .selectize-dropdown-content .selected.active {
background-color:#555;
}
.darkMode input,
.darkMode button {
background-color:black;
color:#ddd;
}
.darkMode input[type="button"],
.darkMode button {
background-image:linear-gradient(to bottom, rgba(100,100,100,0.45) 0%,rgba(0,0,0,0) 100%);
}
.darkMode .due {
color:#00A000;
}
.darkMode .gone {
color:#CC0000;
}
.darkMode #geoIcon path {
fill:rgb(126, 164, 241);
}
.darkMode .debug {
border:1px solid gray;
border-collapse:collapse;
}
.darkMode .debug td {
border:1px solid gray;
}
.darkMode .dowCell {
padding:0 2px!important;
text-align: center;
}
/* End darkMode styles */
</style>
<!--- The most basic operation of this app will let you select a source and destination station
and a Day and Time and it will show you the next times a train will stop there --->
<cfparam name="url.from" default="1">
<cfparam name="url.to" default="15">
<cfquery name="Stations" dbtype="ODBC" datasource="SecureSource">
SELECT * FROM vsd.EZLRTStations
ORDER BY CostFromOrigin
</cfquery>
<form class="w2Form" id="fromToForm">
<cfif isDefined('url.fromStop')>
<!--- 6500 stops! --->
<cfquery name="Stops" dbtype="ODBC" datasource="SecureSource">
SELECT * FROM vsd.ETS_stops
</cfquery>
<!--- This makes for a massive 6500 item select --->
<label for="fromStop" id="fromStopLabel" class="selectizeLabel"><a href="javascript:void(0);" id="departLabelText" title="Click to sort stops based on your location">Bus Stops <svg id="geoIcon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 960"><path d="M500 258.6l-490 245 9.6 1.2c5.2.5 107 8.2 226 16.8 133 9.8 217.5 16.5 218.8 18 1.2 1.2 8.3 87 18 219.6 8.5 119.7 16.4 221.3 17 226 1.3 7.7 6.3-1.8 246-482 135-269.4 245-490 244.6-489.7l-490 245z" /></svg><span id="nearestLink">Set Nearest Four Stops</span></a>
<select name="fromStop" id="fromStop" class="selectizeField" multiple="multiple">
<cfoutput query="Stops">
<option value="#stop_id#" <cfif listContains(url.fromStop, stop_id)>selected</cfif>>#stop_id# #stop_name#</option>
</cfoutput>
</select>
</label>
<!--- If url.rid is specified, we show the interface for selecting a route --->
<cfelseif isDefined('url.rid')>
<cfquery name="Routes" dbtype="ODBC" datasource="SecureSource">
SELECT * FROM vsd.ETS_routes ORDER BY route_id
</cfquery>
<!--- This makes for a massive 6500 item select --->
<label for="rid" id="ridLabel" class="selectizeLabel">Bus Route
<select name="rid" id="rid" class="selectizeField">
<option></option>
<cfoutput query="Routes">
<option value="#route_id#" <cfif url.rid IS route_id>selected</cfif>>#route_id# #route_long_name#</option>
</cfoutput>
</select>
</label>
<label for="routeFrom" id="routeFromLabel" class="selectizeLabel">Departing From
<select name="routeFrom" id="routeFrom" class="selectizeField">
</select>
</label>
<label for="swapRouteFromTo" id="swapButtonLabel">
<button type="button" id="swapRouteFromTo">↑ swap ↓</button>
</label>
<label for="routeTo" id="routeToLabel" class="selectizeLabel">Travelling To
<select name="routeTo" id="routeTo" class="selectizeField">
</select>
</label>
<cfelse>
<label for="from" style="margin-bottom:0;"><a href="javascript:void(0);" id="departLabelText" title="Click to set based on your location">Departing From <svg id="geoIcon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 960"><path d="M500 258.6l-490 245 9.6 1.2c5.2.5 107 8.2 226 16.8 133 9.8 217.5 16.5 218.8 18 1.2 1.2 8.3 87 18 219.6 8.5 119.7 16.4 221.3 17 226 1.3 7.7 6.3-1.8 246-482 135-269.4 245-490 244.6-489.7l-490 245z" /></svg><span id="nearestLink">Set Nearest</span></a>
<select name="from" id="from">
<cfoutput query="Stations">
<option value="#StationID#" <cfif isDefined('url.from') AND url.from IS StationID>selected</cfif>>#StationName#</option>
</cfoutput>
</select>
</label>
<label for="swap" id="swapButtonLabel">
<button type="button" id="swapFromTo">↑ swap ↓</button>
</label>
<label for="to" id="toLabel">Travelling To
<select name="to" id="to">
<cfoutput query="Stations">
<option value="#StationID#" <cfif isDefined('url.to') AND url.to IS StationID>selected<cfelseif NOT isDefined('url.to') AND StationID IS 15>selected</cfif>>#StationName#</option>
</cfoutput>
</select>
</label>
</cfif><!---if not in bus stop mode --->
<div class="formItem" id="timeLabel"><a href="javascript:void(0);" id="timeLabelText">Time <span id="nowLink">Reset</span></a>
<span class="formGroup" id="timeGroup">
<select name="time" id="time" style="width:calc(50% - 15px);margin-right:10px">
<option value="">Now</option>
<!--- <option value="1:00" <cfif isDefined('url.time') AND url.time IS "1:00">selected</cfif>>1:00 AM</option> --->
<cfloop from="5" to="23" index="hour"><cfoutput>
<option value="#hour#:00" <cfif isDefined('url.time') AND url.time IS "#hour#:00">selected</cfif>>#timeFormat(hour&":00", "h:mm tt")#</option>
</cfoutput></cfloop>
<!--- This special option ensures we are using the same day to prevent ambiguity --->
<option value="23:59" <cfif isDefined('url.time') AND url.time IS "23:59">selected</cfif>>11:59 PM</option>
</select>
<select name="dow" id="dow" style="width:50%">
<option value="">Today</option>
<cfloop from="1" to="7" index="day"><cfoutput>
<option value="#Left(DayOfWeekAsString(day),3)#" <cfif isDefined('url.dow') AND url.dow IS Left(DayOfWeekAsString(day),3)>selected</cfif>>#DayOfWeekAsString(day)#</option>
</cfoutput></cfloop>
</select>
</span><!--.formGroup-->
</div><!--timeLabel-->
<label class="formSubmit" style="display:none;">
<input type="submit" value="Show Departure Times" />
</label>
</form>
<div class="departures" id="departures">
<!--- this is where the tables will go --->
<cfif isDefined('url.fromStop')>
<cfinclude template="stopTimesGTFS.cfm" />
<cfelseif isDefined('url.rid')>
<cfinclude template="departureTimesRoutesGTFS.cfm" />
<cfelse>
<cfinclude template="departureTimesGTFS.cfm" />
</cfif>
</div><!--departures-->
<p style="font-size:13px;color:#555;"><b>Note:</b> Times may vary by 2 minutes.</p>
<div class="opMode">
<cfoutput>
<cfif NOT isDefined('url.fromStop') AND NOT isDefined('url.rid')>
<span class="selectedMode" href="?">LRT Schedule</span>
<cfelse>
<a href="?">LRT Schedule</a>
</cfif>
<cfif isDefined('url.fromStop')>
<span class="selectedMode">Bus Stop Times</span>
<cfelse>
<a href="?fromStop">Bus Stop Times</a>
</cfif>
<cfif isDefined('url.rid')>
<span class="selectedMode">Bus Routes</span>
<cfelse>
<a href="?rid">Bus Routes</a>
</cfif>
</cfoutput>
</div>
<div class="opMode">
<p id="nightModeLink">
<cfif isDefined('cookie.lrt_dark') AND cookie.lrt_dark IS true>
<a href="javascript:void(0);">☀ Day Mode</a>
<cfelse>
<a href="javascript:void(0);">🌜 Night Mode</a>
</cfif>
</p>
</div>
<!-- Page contents go above here -->
</div><!--.page .w2Contents-->
</div><!--.container .clearfix-->
<script>
// loads new departure times via ajax
function refreshDepartureTimes() {
var fromVal = $('#from').val();
var toVal = $('#to').val();
var timeVal = $('#time').val();
var dowVal = $('#dow').val();
if (dowVal.length > 0 || timeVal.length > 0) $('#nowLink').show();
else $('#nowLink').hide();
$.get('departureTimesGTFS.cfm', {from:fromVal, to:toVal, time:timeVal, dow:dowVal<cfif isDefined('url.destTime')>, destTime:true</cfif>}).done(function(data) {
$('#departures').html(data);
// update page URL so that you get the same data if you hit refresh
window.history.pushState("", "LRT Schedule", "?from="+fromVal+"&to="+toVal+"&time="+timeVal+"&dow="+dowVal<cfif isDefined('url.destTime')>+"&destTime"</cfif>);
// Refresh the arrival times so they don't go blank for a couple seconds
updateArrivalTimes();
bindShowArrival();
});
}
// loads new bus stop times via ajax
function refreshStopTimes() {
var fromStop = $('#fromStop').val();
var timeVal = $('#time').val();
var dowVal = $('#dow').val();
if (dowVal.length > 0 || timeVal.length > 0) $('#nowLink').show();
else $('#nowLink').hide();
$.ajax('stopTimesGTFS.cfm', { data:{fromStop:fromStop, time:timeVal, dow:dowVal}, traditional:true}).done(function(data) {
$('#departures').html(data);
// update page URL so that you get the same data if you hit refresh
window.history.pushState("", "Bus Stop Schedule", "?fromStop="+fromStop+"&time="+timeVal+"&dow="+dowVal);
// Refresh the arrival times so they don't go blank for a couple seconds
updateArrivalTimes();
// bindShowArrival();
});
}
//signals brand new load... feels like a crappy hack
var newLoad = true;
// Updates the dropdowns for from/to stops for a route
function refreshRouteStops() {
$.get('routeStops.cfm', {rid:$('#rid').val()}).done(function(data) {
// remove existing options
// $('#routeFrom, #routeTo').html('');
routeFromSelectize.clearOptions();
routeToSelectize.clearOptions();
routeFromSelectize.addOption(data);
routeToSelectize.addOption(data);
// $('#routeFrom, #routeTo').append('<option></option>');
//Loop through data field and add an option for each
// $.each(data.DATA, function(i, value) {
// $('#routeFrom, #routeTo').append('<option value="'+data.DATA[i][0]+'">'+data.DATA[i][0]+' '+data.DATA[i][1]+'</option>');
// });
// $('#routeFrom').selectize({highlight:false});
if (newLoad) {
<cfif isDefined('url.routeFrom') AND isNumeric(url.routeFrom)>
routeFromSelectize.addItem(<cfoutput>#url.routeFrom#</cfoutput>,true);
</cfif>
<cfif isDefined('url.routeTo') AND isNumeric(url.routeTo)>
routeToSelectize.addItem(<cfoutput>#url.routeTo#</cfoutput>,true);
refreshRouteToStops(<cfoutput>#url.routeTo#</cfoutput>);
<cfelse>
refreshRouteToStops();
</cfif>
newLoad=false;
// I think I just need to do this on page load...
refreshRouteDepartureTimes();
}
});
}
function refreshRouteToStops(stopId) {
var routeFrom = $('#routeFrom').val();
$.get('routeStops.cfm', {rid:$('#rid').val(), routeFrom:routeFrom}).done(function(data) {
routeToSelectize.clearOptions();
routeToSelectize.addOption(data);
if (stopId) {
routeToSelectize.addItem(stopId);
}
});
}
// loads new route stops into routeFrom/routeTo dropdowns when route is changed
$('#rid').change(function() {
refreshRouteStops();
});
$('#routeFrom').change(function(){
refreshRouteToStops();
});
$('#routeFrom, #routeTo').change(function(){
refreshRouteDepartureTimes();
});
// loads new departure times via ajax
function refreshRouteDepartureTimes() {
var fromVal = $('#routeFrom').val();
var toVal = $('#routeTo').val();
var timeVal = $('#time').val();
var dowVal = $('#dow').val();
var rid = $('#rid').val();
if (dowVal.length > 0 || timeVal.length > 0) $('#nowLink').show();
else $('#nowLink').hide();
$.get('departureTimesRoutesGTFS.cfm', {rid:rid, from:fromVal, to:toVal, time:timeVal, dow:dowVal<cfif isDefined('url.destTime')>, destTime:true</cfif>}).done(function(data) {
$('#departures').html(data);
// update page URL so that you get the same data if you hit refresh
window.history.pushState("", "Bus Route Schedule", "?rid="+rid+"&routeFrom="+fromVal+"&routeTo="+toVal+"&time="+timeVal+"&dow="+dowVal<cfif isDefined('url.destTime')>+"&destTime"</cfif>);
// Refresh the arrival times so they don't go blank for a couple seconds
updateArrivalTimes();
bindShowArrival();
});
}
$('#from, #to').change(function(){
refreshDepartureTimes();
});
$('#fromStop').change(function(){
refreshStopTimes();
});
<cfif isDefined('url.fromStop')>
$('#time, #dow').change(function(){
refreshStopTimes();
});
<cfelseif isDefined('url.rid')>
$('#time, #dow').change(function(){
refreshRouteDepartureTimes();
});
<cfelse>
$('#time, #dow').change(function(){
refreshDepartureTimes();
});
</cfif>
$('#swapFromTo').click(function(){
var fromVal = $('#from').val();
var toVal = $('#to').val();
$('#to').val(fromVal);
$('#from').val(toVal);
refreshDepartureTimes();
});
$('#timeLabelText').click(function(){
$('#time').val('');
$('#dow').val('').trigger('change');
});
function updateArrivalTimes() {
$('.aT').each(function() {
var thisTime = $(this).html();
//Here are a bunch of hacks to get Safari to create a valid date
var thisDate = $(this).attr('data-datetime').replace('-', '/');
thisDate = thisDate.replace('-', '/');
thisDate = thisDate.replace('.0', '');
var date1 = new Date(thisDate);
var dateNow = new Date();
var day = 1;
var secondsToDeparture = (date1-dateNow)/1000;
// Now insert the seconds into the other field
var timeString = Math.floor(secondsToDeparture/60) + " min"
// if (Math.floor(secondsToDeparture/60) != 1) timeString+="s";
// Handle time over an hour
if (secondsToDeparture/60 > 60) {
var hoursToDeparture = Math.floor(secondsToDeparture/60/60)
timeString = hoursToDeparture + "hr";
// if (hoursToDeparture > 1) {
// timeString += "s";
// }
timeString += " "+Math.floor((secondsToDeparture%3600)/60) + "min";
}
if (secondsToDeparture < 60) timeString = '<span class="due">Arriving</span>';
if (secondsToDeparture < -60) timeString = '<span class="gone">Departed</span>';
// Don't bother showing the timeString if we're not looking at the current day, since it's pretty irrelevant
// and likely to just be wrong anyways.
// if ($('#dow').val().length > 0) timeString = "";
// $(this).next().html(secondsToDeparture);
$(this).next().html(timeString);
});
}
// Show some kind of countdown - minutes and seconds until arrival
updateArrivalTimes();
setInterval(function(){updateArrivalTimes();}, 2000);
// Create JS object of station coords with coldfusion query loop
var stationCoords = [
<cfset c=0><cfoutput query="Stations">
<cfif c>,</cfif>{id:#StationID#<cfloop list="#coordinates#" index="i">, <cfif c++ MOD 2 IS 0>lat<cfelse>lon</cfif>:#trim(i)#</cfloop>}
</cfoutput>];
<!--- Include a table of bus stop coordinates if relevant --->
<cfif isDefined('url.fromStop')>
var $fromStopselect;
var selectize;
var stopCoords = [
<cfoutput query="Stops">
<cfif CurrentRow GT 1>,</cfif>{id:#stop_id#, lat:#trim(stop_lat)#, lon:#trim(stop_lon)#}
</cfoutput>];
$(document).ready(function() {