|
|
@ -231,7 +231,20 @@ function onItineraries(data) { |
|
|
|
nextDepartureTimeP.appendChild(departureTimePre) |
|
|
|
nextDepartureTimeP.appendChild(departureTimePre) |
|
|
|
var departure = new Date(nextTrain.plannedDeparture) |
|
|
|
var departure = new Date(nextTrain.plannedDeparture) |
|
|
|
departureTimePre.textContent = departure.toLocaleTimeString([], { 'hour': '2-digit', 'minute': '2-digit' }) |
|
|
|
departureTimePre.textContent = departure.toLocaleTimeString([], { 'hour': '2-digit', 'minute': '2-digit' }) |
|
|
|
|
|
|
|
if (nextTrain.departureDelay) { |
|
|
|
|
|
|
|
departureTimePre.classList.add('original') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var departureDelayPre = document.createElement('pre') |
|
|
|
|
|
|
|
nextDepartureTimeP.append(departureDelayPre) |
|
|
|
|
|
|
|
departureDelayPre.append(nextTrain.departureDelay > 0 ? '+' : '-', Math.floor(Math.abs(nextTrain.departureDelay) / 60).toString()) |
|
|
|
|
|
|
|
departureDelayPre.classList.add('delay', nextTrain.departureDelay > 0 ? 'late' : 'early') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var actualDeparturePre = document.createElement('pre') |
|
|
|
|
|
|
|
nextDepartureTimeP.append(actualDeparturePre) |
|
|
|
|
|
|
|
actualDeparturePre.textContent = new Date(nextTrain.departure).toLocaleTimeString([], { 'hour': '2-digit', 'minute': '2-digit' }) |
|
|
|
|
|
|
|
actualDeparturePre.classList.add('actual-time', nextTrain.departureDelay > 0 ? 'late' : 'early') |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (nextTrain.departurePlatform || nextTrain.plannedDeparturePlatform) { |
|
|
|
if (nextTrain.departurePlatform || nextTrain.plannedDeparturePlatform) { |
|
|
|
var departurePlatformP = document.createElement('p') |
|
|
|
var departurePlatformP = document.createElement('p') |
|
|
|
trainDiv.append(departurePlatformP) |
|
|
|
trainDiv.append(departurePlatformP) |
|
|
|