Browse Source

Add train operator to itineraries page

master
Kenneth Bruen 2 years ago
parent
commit
0833765a84
Signed by: kbruen
GPG Key ID: C1980A470C3EE5B1
  1. 5
      route.css
  2. 5
      route.js
  3. 2
      sw.js

5
route.css

@ -58,3 +58,8 @@
margin-left: 2px; margin-left: 2px;
margin-right: 2px; margin-right: 2px;
} }
.train .company {
font-size: 0.8em;
font-style: italic;
}

5
route.js

@ -241,6 +241,11 @@ function onItineraries(data) {
var trainUrl = new URL('/view-train.html', window.location.origin) var trainUrl = new URL('/view-train.html', window.location.origin)
trainUrl.searchParams.set('train', train.trainNumber) trainUrl.searchParams.set('train', train.trainNumber)
trainLink.href = trainUrl.toString() trainLink.href = trainUrl.toString()
trainP.appendChild(document.createTextNode(' '))
var trainCompany = document.createElement('span')
trainP.appendChild(trainCompany)
trainCompany.textContent = '(' + train.operator + ')'
trainCompany.classList.add('company')
var arrivalTimeP = document.createElement('p') var arrivalTimeP = document.createElement('p')
trainDiv.appendChild(arrivalTimeP) trainDiv.appendChild(arrivalTimeP)

2
sw.js

@ -1,4 +1,4 @@
const VERSION = 'v32' const VERSION = 'v33'
const API_ORIGIN = 'https://scraper.infotren.dcdev.ro/' const API_ORIGIN = 'https://scraper.infotren.dcdev.ro/'
const API_TRAINS = `${API_ORIGIN}v3/trains` const API_TRAINS = `${API_ORIGIN}v3/trains`
const API_STATIONS = `${API_ORIGIN}v3/stations` const API_STATIONS = `${API_ORIGIN}v3/stations`

Loading…
Cancel
Save