From 5910bae33b5862b5fe8690381b2c1bc48e7a944e Mon Sep 17 00:00:00 2001 From: Edward Betts Date: Thu, 21 May 2026 18:42:01 +0100 Subject: [PATCH] Show spinner while walk-on fares are loading Co-Authored-By: Claude Sonnet 4.6 --- templates/results.html | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/templates/results.html b/templates/results.html index e98d6f4..df0e7c9 100644 --- a/templates/results.html +++ b/templates/results.html @@ -85,6 +85,7 @@ + Loading fares
@@ -352,13 +353,23 @@ } function loadWalkonFares() { - for (var sectionId in WALKON_API_URLS) { + var urls = WALKON_API_URLS; + var pending = Object.keys(urls).length; + if (!pending) return; + function done() { + if (--pending === 0) { + var el = document.getElementById('walkon-loading'); + if (el) el.style.display = 'none'; + } + } + for (var sectionId in urls) { (function(id, url) { fetch(url).then(function(r) { return r.json(); }).then(function(fares) { mergeWalkonFares(id, fares); updateDisplay(); - }); - })(sectionId, WALKON_API_URLS[sectionId]); + done(); + }).catch(done); + })(sectionId, urls[sectionId]); } }