Fix bug: departure delay when changing not shown
This commit is contained in:
		
							parent
							
								
									347df88226
								
							
						
					
					
						commit
						ffc439c020
					
				
					 2 changed files with 15 additions and 2 deletions
				
			
		
							
								
								
									
										15
									
								
								route.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
									
										
									
									
									
								
							
							
						
						
									
										2
									
								
								sw.js
									
										
									
									
									
								
							| 
						 | 
					@ -1,4 +1,4 @@
 | 
				
			||||||
const VERSION = 'v19'
 | 
					const VERSION = 'v20'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const CACHE_FIRST = [
 | 
					const CACHE_FIRST = [
 | 
				
			||||||
	// Root
 | 
						// Root
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue