diff --git a/route.js b/route.js index f694576..1ea94fc 100644 --- a/route.js +++ b/route.js @@ -231,7 +231,20 @@ function onItineraries(data) { nextDepartureTimeP.appendChild(departureTimePre) var departure = new Date(nextTrain.plannedDeparture) 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) { var departurePlatformP = document.createElement('p') trainDiv.append(departurePlatformP) diff --git a/sw.js b/sw.js index 181625a..f99277b 100755 --- a/sw.js +++ b/sw.js @@ -1,4 +1,4 @@ -const VERSION = 'v19' +const VERSION = 'v20' const CACHE_FIRST = [ // Root