From caf4ce561125bf0ad335c819fff9e9d21295a487 Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Fri, 9 Jun 2023 12:21:53 +0100 Subject: [PATCH] Add notes --- Dockerfile | 2 ++ js/lib.main.js | 2 +- js/train-detail.js | 30 +++++++++++++++++++++--------- pis.html | 2 +- sw.js | 2 +- 5 files changed, 26 insertions(+), 12 deletions(-) diff --git a/Dockerfile b/Dockerfile index 95fb9cf..05b423e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,6 +4,8 @@ RUN npm i uglifyjs-folder uglifycss html-minifier-terser -g COPY . /data/in RUN bash /data/in/conf/deploy.sh +## Maybe use: georgjung/nginx-brotli:mainline-alpine +## Instead? FROM fholzer/nginx-brotli:latest RUN rm /etc/nginx/nginx.conf RUN apk update && apk add --upgrade libxml2 libxslt diff --git a/js/lib.main.js b/js/lib.main.js index e6f2225..5d42569 100644 --- a/js/lib.main.js +++ b/js/lib.main.js @@ -1,6 +1,6 @@ /* eslint-disable no-unused-vars */ /* All Page Init */ -const version = '2023.6.1' +const version = '2023.6.4' /* Feature Detectors */ diff --git a/js/train-detail.js b/js/train-detail.js index 4eaabaa..ef7568c 100644 --- a/js/train-detail.js +++ b/js/train-detail.js @@ -78,29 +78,41 @@ async function displayOne(object) { for (const stop of publicStops) { stopRows += await createPublicStopTableRow(stop) } + // If there are no public stops, show non-public locations + if (!publicStops.length) { + for (const stop of object['stops']) { + stopRows += await createPublicStopTableRow(stop, 'wtt') + } + } const displayBox = document.getElementById('train_data') displayBox.innerHTML = '' displayBox.insertAdjacentHTML('beforeend', dataTableHead + stopRows + dataTableClose) displayBox.style = 'display:block;' } -async function createPublicStopTableRow(stop) { - let data_tiploc = stop['tiploc'], public_arr = stop['publicArrival'], - public_dep = stop['publicDeparture'] +async function createPublicStopTableRow(stop, type='public') { + let arr, dep + let data_tiploc = stop['tiploc'] + if (type === 'wtt') { + arr = stop['wttArrival'], dep = stop['wttDeparture'] + } + if (type === 'public') { + arr = stop['publicArrival'], dep = stop['publicDeparture'] + } if (typeof data_tiploc === 'undefined') { data_tiploc = '' } - if (typeof public_arr === 'undefined') { - public_arr = '-' + if (typeof arr === 'undefined') { + arr = '-' } - if (typeof public_dep === 'undefined') { - public_dep = '-' + if (typeof dep === 'undefined') { + dep = '-' } return ` ${data_tiploc} - ${public_arr} - ${public_dep} + ${arr} + ${dep} ` } \ No newline at end of file diff --git a/pis.html b/pis.html index 328609e..3396ef3 100644 --- a/pis.html +++ b/pis.html @@ -49,7 +49,7 @@
-
+


diff --git a/sw.js b/sw.js index a83e4fb..8bea6fc 100644 --- a/sw.js +++ b/sw.js @@ -1,6 +1,6 @@ /* Service Worker */ -const swVersion = '2023.6.1-1' +const swVersion = '2023.6.4-1' const cacheName = `owlboard-${swVersion}` const cacheIDs = [cacheName] let staticCache = [