Browse Source

Fix bug: departure delay when changing not shown

master
Kenneth Bruen 1 year ago
parent
commit
ffc439c020
Signed by: kbruen
GPG Key ID: C1980A470C3EE5B1
  1. 15
      route.js
  2. 2
      sw.js

15
route.js

@ -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)

2
sw.js

@ -1,4 +1,4 @@
const VERSION = 'v19' const VERSION = 'v20'
const CACHE_FIRST = [ const CACHE_FIRST = [
// Root // Root

Loading…
Cancel
Save