gtfs-to-html 2.11.5 → 2.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app/index.js +46 -37
- package/dist/app/index.js.map +1 -1
- package/dist/bin/gtfs-to-html.js +62 -16
- package/dist/bin/gtfs-to-html.js.map +1 -1
- package/dist/index.js +62 -16
- package/dist/index.js.map +1 -1
- package/package.json +11 -8
- package/views/default/css/overview_styles.css +5 -5
- package/views/default/css/timetable_styles.css +26 -14
- package/views/default/formatting_functions.pug +1 -1
- package/views/default/js/system-map.js +143 -92
- package/views/default/js/timetable-alerts.js +68 -50
- package/views/default/js/timetable-map.js +264 -164
- package/views/default/js/timetable-menu.js +64 -40
- package/views/default/overview.pug +1 -1
- package/views/default/overview_full.pug +4 -6
- package/views/default/timetable_continuation_as.pug +1 -1
- package/views/default/timetable_continuation_from.pug +1 -1
- package/views/default/timetable_horizontal.pug +2 -2
- package/views/default/timetable_hourly.pug +1 -1
- package/views/default/timetable_map.pug +1 -1
- package/views/default/timetable_menu.pug +4 -4
- package/views/default/timetable_note_symbol.pug +1 -1
- package/views/default/timetable_stop_name.pug +1 -1
- package/views/default/timetable_stoptime.pug +7 -7
- package/views/default/timetable_vertical.pug +3 -3
- package/views/default/timetablepage.pug +8 -8
- package/views/default/timetablepage_full.pug +2 -4
|
@@ -1,62 +1,86 @@
|
|
|
1
|
-
/* global
|
|
2
|
-
/* eslint no-unused-vars: "off" */
|
|
1
|
+
/* global toggleMap */
|
|
3
2
|
|
|
4
3
|
function showSelectedTimetable() {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
const timetables = document.querySelectorAll('.timetable');
|
|
5
|
+
|
|
6
|
+
if (timetables.length === 1) {
|
|
7
|
+
showTimetable(timetables[0].dataset.timetableId);
|
|
8
|
+
return;
|
|
8
9
|
}
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
document
|
|
12
|
+
.querySelectorAll('#day_list_selector input[name="dayList"]')
|
|
13
|
+
.forEach((element) => {
|
|
14
|
+
const label = element.closest('label');
|
|
15
|
+
if (label) {
|
|
16
|
+
label.classList.toggle('btn-active', element.checked);
|
|
17
|
+
label.classList.toggle('btn-inactive', !element.checked);
|
|
18
|
+
}
|
|
19
|
+
});
|
|
18
20
|
|
|
19
|
-
|
|
20
|
-
(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
.
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
);
|
|
21
|
+
document
|
|
22
|
+
.querySelectorAll('#direction_name_selector input[name="directionId"]')
|
|
23
|
+
.forEach((element) => {
|
|
24
|
+
const label = element.closest('label');
|
|
25
|
+
if (label) {
|
|
26
|
+
label.classList.toggle('btn-active', element.checked);
|
|
27
|
+
label.classList.toggle('btn-inactive', !element.checked);
|
|
28
|
+
}
|
|
29
|
+
});
|
|
29
30
|
|
|
30
|
-
const
|
|
31
|
+
const dayListInput = document.querySelector(
|
|
31
32
|
'#day_list_selector input[name="dayList"]:checked',
|
|
32
|
-
)
|
|
33
|
+
);
|
|
34
|
+
const dayList = dayListInput ? dayListInput.value : null;
|
|
33
35
|
|
|
34
|
-
const
|
|
36
|
+
const directionIdInput = document.querySelector(
|
|
35
37
|
'#direction_name_selector input[name="directionId"]:checked',
|
|
36
|
-
)
|
|
38
|
+
);
|
|
39
|
+
const directionId = directionIdInput ? directionIdInput.value : null;
|
|
37
40
|
|
|
38
|
-
|
|
41
|
+
timetables.forEach((timetable) => {
|
|
42
|
+
timetable.style.display = 'none';
|
|
43
|
+
});
|
|
39
44
|
|
|
40
|
-
const
|
|
45
|
+
const selectedTimetable = document.querySelector(
|
|
41
46
|
`.timetable[data-day-list="${dayList}"][data-direction-id="${directionId}"]`,
|
|
42
|
-
)
|
|
47
|
+
);
|
|
43
48
|
|
|
44
|
-
|
|
49
|
+
if (selectedTimetable) {
|
|
50
|
+
const id = selectedTimetable.dataset.timetableId;
|
|
51
|
+
showTimetable(id);
|
|
52
|
+
}
|
|
45
53
|
}
|
|
46
54
|
|
|
47
55
|
function showTimetable(id) {
|
|
48
|
-
|
|
49
|
-
|
|
56
|
+
const timetable = document.querySelector(
|
|
57
|
+
`.timetable[data-timetable-id="${id}"]`,
|
|
58
|
+
);
|
|
59
|
+
if (timetable) {
|
|
60
|
+
timetable.style.display = 'block';
|
|
61
|
+
}
|
|
62
|
+
// Check if toggleMap is defined
|
|
63
|
+
if (typeof toggleMap === 'function') {
|
|
64
|
+
toggleMap(id);
|
|
65
|
+
}
|
|
50
66
|
}
|
|
51
67
|
|
|
52
|
-
|
|
68
|
+
document.addEventListener('DOMContentLoaded', () => {
|
|
53
69
|
showSelectedTimetable();
|
|
54
70
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
71
|
+
document
|
|
72
|
+
.querySelectorAll('#day_list_selector input[name="dayList"]')
|
|
73
|
+
.forEach((input) => {
|
|
74
|
+
input.addEventListener('change', () => {
|
|
75
|
+
showSelectedTimetable();
|
|
76
|
+
});
|
|
77
|
+
});
|
|
58
78
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
79
|
+
document
|
|
80
|
+
.querySelectorAll('#direction_name_selector input[name="directionId"]')
|
|
81
|
+
.forEach((input) => {
|
|
82
|
+
input.addEventListener('change', () => {
|
|
83
|
+
showSelectedTimetable();
|
|
84
|
+
});
|
|
85
|
+
});
|
|
62
86
|
});
|
|
@@ -10,7 +10,7 @@ include formatting_functions.pug
|
|
|
10
10
|
each timetablePage in sortTimetablePages(timetablePageGroup.timetablePages)
|
|
11
11
|
if config.allowEmptyTimetables || timetablePage.consolidatedTimetables.length > 0
|
|
12
12
|
- const timetableRoutes = _.uniqBy(_.flatMap(timetablePage.consolidatedTimetables, timetable => timetable.routes), 'route_id')
|
|
13
|
-
a.timetable-page-link(href
|
|
13
|
+
a.timetable-page-link(href=timetablePage.relativePath data-route-ids=timetableRoutes.map((route) => route.route_id).join(','))
|
|
14
14
|
each route in timetableRoutes
|
|
15
15
|
.route-color-swatch-large(style=`background-color: ${formatRouteColor(route)}; color: ${formatRouteTextColor(route)};`)= route.route_short_name || ''
|
|
16
16
|
div
|
|
@@ -4,13 +4,11 @@ block content
|
|
|
4
4
|
|
|
5
5
|
block extraHeader
|
|
6
6
|
if config.showMap
|
|
7
|
-
script(src
|
|
8
|
-
script(src
|
|
9
|
-
script(src="https://unpkg.com/maplibre-gl@^5.7.0/dist/maplibre-gl.js")
|
|
10
|
-
script(src="https://unpkg.com/@maplibre/maplibre-gl-geocoder@1.9.0/dist/maplibre-gl-geocoder.js")
|
|
7
|
+
script(src=`${config.assetPath}js/maplibre-gl.js`)
|
|
8
|
+
script(src=`${config.assetPath}js/maplibre-gl-geocoder.js`)
|
|
11
9
|
script(src=`${config.assetPath}js/system-map.js`)
|
|
12
10
|
|
|
13
|
-
link(href
|
|
14
|
-
link(href
|
|
11
|
+
link(href=`${config.assetPath}css/maplibre-gl.css` rel="stylesheet")
|
|
12
|
+
link(href=`${config.assetPath}css/maplibre-gl-geocoder.css` rel="stylesheet")
|
|
15
13
|
|
|
16
14
|
link(rel="stylesheet" href=`${config.assetPath}css/overview_styles.css`)
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
td.run-footer(style=routeColorCss)
|
|
3
3
|
if trip.continues_as_route
|
|
4
4
|
if trip.continues_as_route.route.route_url
|
|
5
|
-
a.continues-as-route(href
|
|
5
|
+
a.continues-as-route(href=trip.continues_as_route.route.route_url style=routeColorCss data-trip-id=trip.continues_as_route.trip_id)= trip.continues_as_route.route.route_short_name
|
|
6
6
|
else
|
|
7
7
|
.continues-as-route(data-trip-id=trip.continues_as_route.trip_id)= trip.continues_as_route.route.route_short_name
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
td.run-footer(style=routeColorCss)
|
|
3
3
|
if trip.continues_from_route
|
|
4
4
|
if trip.continues_from_route.route.route_url
|
|
5
|
-
a.continues-from-route(href
|
|
5
|
+
a.continues-from-route(href=trip.continues_from_route.route.route_url style=routeColorCss data-trip-id=trip.continues_from_route.trip_id)= trip.continues_from_route.route.route_short_name
|
|
6
6
|
else
|
|
7
7
|
.continues-from-route(data-trip-id=trip.continues_from_route.trip_id)= trip.continues_from_route.route.route_short_name
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
colgroup
|
|
5
5
|
col
|
|
6
6
|
each trip, idx in timetable.orderedTrips
|
|
7
|
-
col(
|
|
7
|
+
col(class=`run_${idx} ${(trip.trip_short_name) ? 'trip_short_name_' + trip.trip_short_name : ''}` data-trip-id=trip.trip_id)
|
|
8
8
|
thead
|
|
9
9
|
tr
|
|
10
10
|
th.stop-header(scope="col") Stop
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
th(scope="row" colspan=`${stop.trips.length + 1}`)= stop.stop_city
|
|
30
30
|
- previousCity = stop.stop_city
|
|
31
31
|
|
|
32
|
-
tr.stop-row(
|
|
32
|
+
tr.stop-row(data-stop-id=stop.stop_id data-is-timepoint=stop.is_timepoint.toString())
|
|
33
33
|
th.stop-name-container(scope="row")
|
|
34
34
|
include timetable_stop_name.pug
|
|
35
35
|
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
th(scope="row" colspan="2")= stop.stop_city
|
|
18
18
|
- previousCity = stop.stop_city
|
|
19
19
|
|
|
20
|
-
tr.stop-row(
|
|
20
|
+
tr.stop-row(data-stop-id=stop.stop_id)
|
|
21
21
|
th.stop-name-container(scope="row")
|
|
22
22
|
include timetable_stop_name.pug
|
|
23
23
|
|
|
@@ -5,7 +5,7 @@ if timetablePage.consolidatedTimetables.length > 1
|
|
|
5
5
|
- const showDayList = timetablePageHasDifferentDays(timetablePage);
|
|
6
6
|
each timetable in timetablePage.consolidatedTimetables
|
|
7
7
|
li
|
|
8
|
-
a(href
|
|
8
|
+
a(href=`#${cssEscape(`timetable_id_${timetable.timetable_id}`)}`)
|
|
9
9
|
if showTimetableLabel
|
|
10
10
|
span= timetable.timetable_label
|
|
11
11
|
if showTimetableLabel && showDayList
|
|
@@ -27,7 +27,7 @@ if timetablePage.consolidatedTimetables.length > 1
|
|
|
27
27
|
div
|
|
28
28
|
h3= dayList
|
|
29
29
|
each timetable in group
|
|
30
|
-
a.btn-
|
|
30
|
+
a.btn-active(href=`#${cssEscape(`timetable_id_${timetable.timetable_id}`)}`)= timetable.timetable_label
|
|
31
31
|
|
|
32
32
|
if config.menuType === 'radio'
|
|
33
33
|
.timetable-radio-menu
|
|
@@ -36,13 +36,13 @@ if timetablePage.consolidatedTimetables.length > 1
|
|
|
36
36
|
#direction_name_selector
|
|
37
37
|
h3 Service Direction
|
|
38
38
|
each timetable, idx in uniqueDirectionTimetables
|
|
39
|
-
label(class=idx === 0 ? 'btn-
|
|
39
|
+
label(class=idx === 0 ? 'btn-active' : 'btn-inactive')
|
|
40
40
|
input.hidden(type="radio" name="directionId" autocomplete="off" value=timetable.direction_id checked=(idx === 0))
|
|
41
41
|
span= timetable.direction_name || timetable.timetable_label
|
|
42
42
|
div(hidden=timetablePage.dayLists.length <= 1)
|
|
43
43
|
#day_list_selector
|
|
44
44
|
h3 Day of Week
|
|
45
45
|
each dayList, idx in timetablePage.dayLists
|
|
46
|
-
label(class=idx === 0 ? 'btn-
|
|
46
|
+
label(class=idx === 0 ? 'btn-active' : 'btn-inactive')
|
|
47
47
|
input.hidden(type="radio" name="dayList" autocomplete="off" value=dayList checked=(idx === 0))
|
|
48
48
|
span= dayList
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
a(href
|
|
1
|
+
a(href=`#${cssEscape(`note-${timetable.timetable_id}-${note.note_id}`)}` data-note-id=note.note_id).symbol
|
|
2
2
|
if timetable.routes.length <= 1 && timetable.orientation === 'vertical'
|
|
3
3
|
span= note.symbol
|
|
4
4
|
else
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
- const stopName = `${stop.stop_name}${stop.type === 'arrival' ? ' (Arrival)' : stop.type === 'departure' ? ' (Departure)' : ''}`;
|
|
2
2
|
|
|
3
3
|
if config.linkStopUrls && stop.stop_url
|
|
4
|
-
a.stop-name(href
|
|
4
|
+
a.stop-name(href=stop.stop_url)= stopName
|
|
5
5
|
each note in getNotesForStop(timetable.notes, stop)
|
|
6
6
|
include timetable_note_symbol.pug
|
|
7
7
|
else
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
td.stop-time(class
|
|
1
|
+
td.stop-time(class=stoptime.classes.join(' '))
|
|
2
2
|
if config.showStoptimesForRequestStops || (!stoptime.requestDropoff && !stoptime.requestPickup)
|
|
3
3
|
span.stop-time-text!= stoptime.formatted_time
|
|
4
4
|
if stoptime.skipped && timetable.noServiceSymbol !== null
|
|
5
|
-
a(href
|
|
5
|
+
a(href=`#${cssEscape(`note-${timetable.timetable_id}-no-service`)}`).symbol= timetable.noServiceSymbol
|
|
6
6
|
if stoptime.interpolated && timetable.interpolatedStopSymbol !== null
|
|
7
|
-
a(href
|
|
7
|
+
a(href=`#${cssEscape(`note-${timetable.timetable_id}-interpolated-stop`)}`).symbol= timetable.interpolatedStopSymbol
|
|
8
8
|
if stoptime.requestPickup && timetable.requestPickupSymbol !== null
|
|
9
|
-
a(href
|
|
9
|
+
a(href=`#${cssEscape(`note-${timetable.timetable_id}-request-pickup`)}`).symbol= timetable.requestPickupSymbol
|
|
10
10
|
if stoptime.noPickup && timetable.noPickupSymbol !== null
|
|
11
|
-
a(href
|
|
11
|
+
a(href=`#${cssEscape(`note-${timetable.timetable_id}-no-pickup`)}`).symbol= timetable.noPickupSymbol
|
|
12
12
|
if stoptime.requestDropoff && timetable.requestDropoffSymbol !== null
|
|
13
|
-
a(href
|
|
13
|
+
a(href=`#${cssEscape(`note-${timetable.timetable_id}-request-dropoff`)}`).symbol= timetable.requestDropoffSymbol
|
|
14
14
|
if stoptime.noDropoff && timetable.noDropoffSymbol !== null
|
|
15
|
-
a(href
|
|
15
|
+
a(href=`#${cssEscape(`note-${timetable.timetable_id}-no-dropoff`)}`).symbol= timetable.noDropoffSymbol
|
|
16
16
|
each note in getNotesForStoptime(timetable.notes, stoptime)
|
|
17
17
|
include timetable_note_symbol.pug
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
if timetable.has_continues_from_route
|
|
16
16
|
col
|
|
17
17
|
each stop, idx in timetable.stops
|
|
18
|
-
col(
|
|
18
|
+
col(class=`stop-${idx}` data-stop-id=stop.stop_id data-is-timepoint=stop.is_timepoint.toString())
|
|
19
19
|
if timetable.has_continues_as_route
|
|
20
20
|
col
|
|
21
21
|
thead
|
|
@@ -45,12 +45,12 @@
|
|
|
45
45
|
if timetable.has_continues_from_route
|
|
46
46
|
td
|
|
47
47
|
|
|
48
|
-
td.trip-frequency(colspan
|
|
48
|
+
td.trip-frequency(colspan=columnCount)!= formatFrequencyWarning(timetable.frequencies)
|
|
49
49
|
|
|
50
50
|
if timetable.has_continues_as_route
|
|
51
51
|
td
|
|
52
52
|
each trip, idx in timetable.orderedTrips
|
|
53
|
-
tr.trip-row(id
|
|
53
|
+
tr.trip-row(data-trip-id=trip.trip_id)
|
|
54
54
|
if timetableHasTripNotes || timetable.routes.length > 1
|
|
55
55
|
td.trip-notes
|
|
56
56
|
.trip-name= formatTripName(trip, idx, timetable)
|
|
@@ -21,7 +21,7 @@ include formatting_functions.pug
|
|
|
21
21
|
| There are no service alerts at this time.
|
|
22
22
|
|
|
23
23
|
each timetable in timetablePage.consolidatedTimetables
|
|
24
|
-
.timetable(id
|
|
24
|
+
.timetable(id=cssEscape(`timetable_id_${timetable.timetable_id}`) data-day-list=timetable.dayList data-direction-name=timetable.direction_name || timetable.timetable_label data-timetable-id=timetable.timetable_id data-direction-id=timetable.direction_id data-route-id=timetable.route_ids.join('_'))
|
|
25
25
|
if config.showRouteTitle
|
|
26
26
|
.timetable-label
|
|
27
27
|
h2= `${timetable.timetable_label} | ${timetable.dayListLong}`
|
|
@@ -43,19 +43,19 @@ include formatting_functions.pug
|
|
|
43
43
|
if hasNotesOrNotices(timetable)
|
|
44
44
|
.notes
|
|
45
45
|
if timetable.requestPickupSymbolUsed
|
|
46
|
-
.note(id
|
|
46
|
+
.note(id=cssEscape(`note-${timetable.timetable_id}-request-pickup`))= `${config.requestPickupSymbol} = ${config.requestPickupText}`
|
|
47
47
|
if timetable.noPickupSymbolUsed
|
|
48
|
-
.note(id
|
|
48
|
+
.note(id=cssEscape(`note-${timetable.timetable_id}-no-pickup`))= `${config.noPickupSymbol} = ${config.noPickupText}`
|
|
49
49
|
if timetable.requestDropoffSymbolUsed
|
|
50
|
-
.note(id
|
|
50
|
+
.note(id=cssEscape(`note-${timetable.timetable_id}-request-dropoff`))= `${config.requestDropoffSymbol} = ${config.requestDropoffText}`
|
|
51
51
|
if timetable.noDropoffSymbolUsed
|
|
52
|
-
.note(id
|
|
52
|
+
.note(id=cssEscape(`note-${timetable.timetable_id}-no-dropoff`))= `${config.noDropoffSymbol} = ${config.noDropoffText}`
|
|
53
53
|
if timetable.noServiceSymbolUsed
|
|
54
|
-
.note(id
|
|
54
|
+
.note(id=cssEscape(`note-${timetable.timetable_id}-no-service`))= `${config.noServiceSymbol} = ${config.noServiceText}`
|
|
55
55
|
if timetable.interpolatedStopSymbolUsed
|
|
56
|
-
.note(id
|
|
56
|
+
.note(id=cssEscape(`note-${timetable.timetable_id}-interpolated-stop`))= `${config.interpolatedStopSymbol} = ${config.interpolatedStopText}`
|
|
57
57
|
each note in _.uniqBy(timetable.notes, 'note_id')
|
|
58
|
-
.note(id
|
|
58
|
+
.note(id=cssEscape(`note-${timetable.timetable_id}-${note.note_id}`))
|
|
59
59
|
span= note.symbol
|
|
60
60
|
span =
|
|
61
61
|
span!= md(note.note)
|
|
@@ -3,8 +3,6 @@ block content
|
|
|
3
3
|
include timetablepage.pug
|
|
4
4
|
|
|
5
5
|
block extraHeader
|
|
6
|
-
script(src="https://unpkg.com/jquery@3.7.1/dist/jquery.min.js" crossorigin="anonymous")
|
|
7
|
-
|
|
8
6
|
if config.menuType === 'radio'
|
|
9
7
|
script(src=`${config.assetPath}js/timetable-menu.js`)
|
|
10
8
|
|
|
@@ -13,8 +11,8 @@ block extraHeader
|
|
|
13
11
|
script(src=`${config.assetPath}js/gtfs-realtime.browser.proto.js`)
|
|
14
12
|
|
|
15
13
|
if config.showMap
|
|
16
|
-
link(href
|
|
17
|
-
script(src
|
|
14
|
+
link(href=`${config.assetPath}css/maplibre-gl.css` rel="stylesheet")
|
|
15
|
+
script(src=`${config.assetPath}js/maplibre-gl.js`)
|
|
18
16
|
script(src=`${config.assetPath}js/timetable-map.js`)
|
|
19
17
|
|
|
20
18
|
if config.hasGtfsRealtimeAlerts
|