From ebb0b5f0ba90d3eb5bf59f6c316c06694f83960b Mon Sep 17 00:00:00 2001 From: Dan Cojocaru Date: Tue, 20 Sep 2022 00:50:22 +0300 Subject: [PATCH] Add loading text --- base.css | 6 ++++++ sw.js | 2 +- view-station.html | 4 ++++ view-station.js | 2 ++ view-train.html | 4 ++++ view-train.js | 2 ++ 6 files changed, 19 insertions(+), 1 deletion(-) diff --git a/base.css b/base.css index adf600f..209f80d 100644 --- a/base.css +++ b/base.css @@ -36,6 +36,12 @@ body { display: none; } +#loading { + display: flex; + align-items: center; + justify-content: center; +} + footer { margin-top: auto; display: flex; diff --git a/sw.js b/sw.js index 9a75023..a0b1af0 100755 --- a/sw.js +++ b/sw.js @@ -1,4 +1,4 @@ -const VERSION = 'v8' +const VERSION = 'v9' const API_ORIGIN = 'https://scraper.infotren.dcdev.ro/' const API_TRAINS = `${API_ORIGIN}v3/trains` const API_STATIONS = `${API_ORIGIN}v3/stations` diff --git a/view-station.html b/view-station.html index 7355415..2fc8bda 100644 --- a/view-station.html +++ b/view-station.html @@ -29,6 +29,10 @@

Departures

+
+

Loading data...

+
+
diff --git a/view-station.js b/view-station.js index c387956..2823abc 100644 --- a/view-station.js +++ b/view-station.js @@ -14,6 +14,8 @@ function onStationData(data) { document.getElementById('date').textContent = data.date + document.getElementById('loading').classList.add('hidden') + /** * @param {HTMLElement} elem * @param {any[]} trains diff --git a/view-train.html b/view-train.html index 97c4bd7..bd366f3 100644 --- a/view-train.html +++ b/view-train.html @@ -23,6 +23,10 @@

+
+

Loading data...

+
+ diff --git a/view-train.js b/view-train.js index 825577a..f35ac2e 100755 --- a/view-train.js +++ b/view-train.js @@ -22,6 +22,8 @@ function onTrainData(data) { document.getElementById('company').textContent = data.operator document.getElementById('date').textContent = data.date + document.getElementById('loading').classList.add('hidden') + var group = null; if (data.groups.length > 1 && groupIndex == null) { document.getElementById('group-choice').classList.remove('hidden')