|
|
|
@ -81,6 +81,19 @@ function onItineraries(data) {
|
|
|
|
|
departureTimeP.appendChild(departureTimePre) |
|
|
|
|
var departure = new Date(train.plannedDeparture) |
|
|
|
|
departureTimePre.textContent = departure.toLocaleTimeString([], { 'hour': '2-digit', 'minute': '2-digit' }) |
|
|
|
|
if (train.departureDelay) { |
|
|
|
|
departureTimePre.classList.add('original') |
|
|
|
|
|
|
|
|
|
var departureDelayPre = document.createElement('pre') |
|
|
|
|
departureTimeP.append(departureDelayPre) |
|
|
|
|
departureDelayPre.append(train.departureDelay > 0 ? '+' : '-', Math.floor(Math.abs(train.departureDelay) / 60).toString()) |
|
|
|
|
departureDelayPre.classList.add('delay', train.departureDelay > 0 ? 'late' : 'early') |
|
|
|
|
|
|
|
|
|
var actualDeparturePre = document.createElement('pre') |
|
|
|
|
departureTimeP.append(actualDeparturePre) |
|
|
|
|
actualDeparturePre.textContent = new Date(train.departure).toLocaleTimeString([], { 'hour': '2-digit', 'minute': '2-digit' }) |
|
|
|
|
actualDeparturePre.classList.add('actual-time', train.departureDelay > 0 ? 'late' : 'early') |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
var departureHeading = document.createElement('h3') |
|
|
|
|
trainDiv.appendChild(departureHeading) |
|
|
|
@ -167,6 +180,19 @@ function onItineraries(data) {
|
|
|
|
|
arrivalTimeP.appendChild(arrivalTimePre) |
|
|
|
|
var arrival = new Date(train.plannedArrival) |
|
|
|
|
arrivalTimePre.textContent = arrival.toLocaleTimeString([], { 'hour': '2-digit', 'minute': '2-digit' }) |
|
|
|
|
if (train.arrivalDelay) { |
|
|
|
|
arrivalTimePre.classList.add('original') |
|
|
|
|
|
|
|
|
|
var arrivalDelayPre = document.createElement('pre') |
|
|
|
|
arrivalTimeP.append(arrivalDelayPre) |
|
|
|
|
arrivalDelayPre.append(train.arrivalDelay > 0 ? '+' : '-', Math.floor(Math.abs(train.arrivalDelay) / 60).toString()) |
|
|
|
|
arrivalDelayPre.classList.add('delay', train.arrivalDelay > 0 ? 'late' : 'early') |
|
|
|
|
|
|
|
|
|
var actualArrivalPre = document.createElement('pre') |
|
|
|
|
arrivalTimeP.append(actualArrivalPre) |
|
|
|
|
actualArrivalPre.textContent = new Date(train.arrival).toLocaleTimeString([], { 'hour': '2-digit', 'minute': '2-digit' }) |
|
|
|
|
actualArrivalPre.classList.add('actual-time', train.arrivalDelay > 0 ? 'late' : 'early') |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
var arrivalHeading = document.createElement('h3') |
|
|
|
|
trainDiv.appendChild(arrivalHeading) |
|
|
|
|