From da34ec2e4a6fb5534c8d0f103a29cf8ba361b774 Mon Sep 17 00:00:00 2001 From: Birte Kristina Friesel Date: Fri, 20 Jun 2025 18:49:43 +0200 Subject: geolocation.js: It's an accident that this ever worked to begin with --- public/static/js/geolocation.js | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) (limited to 'public/static/js/geolocation.js') diff --git a/public/static/js/geolocation.js b/public/static/js/geolocation.js index f3bacd1..877bd59 100644 --- a/public/static/js/geolocation.js +++ b/public/static/js/geolocation.js @@ -26,7 +26,7 @@ $(document).ready(function() { const parts = stop.split(';'); const [ eva, name, dbris, efa, hafas, motis ] = parts; - const node = $('' + name + ''); + const node = $('' + name + ''); node.click(function() { $('nav .preloader-wrapper').addClass('active'); }); @@ -49,24 +49,36 @@ $(document).ready(function() { $.each(data.candidates, function(i, candidate) { let node; - if (candidate.motis !== undefined) { - const { id, name, motis } = candidate; - - node = $('' + name + ''); - } else if (candidate.efa !== undefined) { + if (candidate.dbris) { + const eva = candidate.eva, + name = candidate.name, + dbris = candidate.dbris, + distance = candidate.distance.toFixed(1); + node = $('' + name + ''); + } else if (candidate.efa) { const eva = candidate.eva, name = candidate.name, efa = candidate.efa, distance = candidate.distance.toFixed(1); node = $('' + name + ''); - } else { + } else if (candidate.hafas) { const eva = candidate.eva, name = candidate.name, hafas = candidate.hafas, distance = candidate.distance.toFixed(1); - node = $('' + name + ''); + node = $('' + name + ''); + } else if (candidate.motis) { + const { id, name, motis } = candidate; + + node = $('' + name + ''); + } else { + const eva = candidate.eva, + name = candidate.name, + distance = candidate.distance.toFixed(1); + + node = $('' + name + ''); } node.click(function() { -- cgit v1.2.3