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/css/material-icons.css | 8 ++++---- public/static/js/geolocation.js | 28 ++++++++++++++++++++-------- public/static/js/geolocation.min.js | 2 +- public/static/manifest.json | 12 ++++++------ public/static/v93 | 1 - public/static/v95 | 1 + 6 files changed, 32 insertions(+), 20 deletions(-) delete mode 120000 public/static/v93 create mode 120000 public/static/v95 (limited to 'public/static') diff --git a/public/static/css/material-icons.css b/public/static/css/material-icons.css index 3c1b3a7..ad59f3a 100644 --- a/public/static/css/material-icons.css +++ b/public/static/css/material-icons.css @@ -2,12 +2,12 @@ font-family: 'Material Icons'; font-style: normal; font-weight: 400; - src: url(/static/v94/fonts/MaterialIcons-Regular.eot); /* For IE6-8 */ + src: url(/static/v95/fonts/MaterialIcons-Regular.eot); /* For IE6-8 */ src: local('Material Icons'), local('MaterialIcons-Regular'), - url(/static/v94/fonts/MaterialIcons-Regular.woff2) format('woff2'), - url(/static/v94/fonts/MaterialIcons-Regular.woff) format('woff'), - url(/static/v94/fonts/MaterialIcons-Regular.ttf) format('truetype'); + url(/static/v95/fonts/MaterialIcons-Regular.woff2) format('woff2'), + url(/static/v95/fonts/MaterialIcons-Regular.woff) format('woff'), + url(/static/v95/fonts/MaterialIcons-Regular.ttf) format('truetype'); } .material-icons { 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() { diff --git a/public/static/js/geolocation.min.js b/public/static/js/geolocation.min.js index 4bf5584..4ec9dc7 100644 --- a/public/static/js/geolocation.min.js +++ b/public/static/js/geolocation.min.js @@ -1 +1 @@ -$(document).ready(function(){function i(){return $("div.geolocation div.progress")}function e(e){var t=$("div.geolocation").data("backend");$.post("/geolocation",{lon:e.coords.longitude,lat:e.coords.latitude,backend:t},a)}function t(e){e.code==e.PERMISSION_DENIED?n("Standortanfrage nicht möglich.","Vermutlich fehlen die Rechte im Browser oder der Android Location Service ist deaktiviert.","geolocation.error.PERMISSION_DENIED"):e.code==e.POSITION_UNAVAILABLE?n("Standort konnte nicht ermittelt werden","(Service nicht verfügbar)","geolocation.error.POSITION_UNAVAILABLE"):e.code==e.TIMEOUT?n("Standort konnte nicht ermittelt werden","(Timeout)","geolocation.error.TIMEOUT"):n("Standort konnte nicht ermittelt werden","(unbekannter Fehler)","unknown geolocation.error code")}const n=function(e,t,n){var a=$(document.createElement("div")),t=(a.attr("class","error"),a.text(t),$(document.createElement("strong"))),e=(t.text(e+" "),a.prepend(t),$("div.geolocation").append(a),$("div.geolocation").data("recent"));if(e){t=e.split("|");const c=$(document.createElement("p"));$.each(t,function(e,t){var[t,n,a,i,o,r]=t.split(";"),t=$('"+n+"");t.click(function(){$("nav .preloader-wrapper").addClass("active")}),c.append(t)}),$("p.geolocationhint").text("Letzte Ziele:"),i().replaceWith(c)}else i().remove()},a=function(e){if(e.error)n("Backend-Fehler:",e.error,null);else if(0==e.candidates.length)n("Keine Bahnhöfe in 70km Umkreis gefunden","",null);else{const r=$(document.createElement("p"));$.each(e.candidates,function(e,t){let n;var a,i,o;(n=void 0!==t.motis?({id:a,name:i,motis:o}=t,$(''+i+"")):void 0!==t.efa?(a=t.eva,o=t.name,i=t.efa,t.distance.toFixed(1),$(''+o+"")):(a=t.eva,i=t.name,o=t.hafas,t.distance.toFixed(1),$('"+i+""))).click(function(){$("nav .preloader-wrapper").addClass("active")}),r.append(n)}),i().replaceWith(r)}},o=$("div.geolocation > .request");o.data("recent");function r(){o.replaceWith($('

Stationen in der Umgebung:

')),navigator.geolocation.getCurrentPosition(e,t)}o.length&&(navigator.geolocation?navigator.permissions?navigator.permissions.query({name:"geolocation"}).then(function(e){"prompt"===e.state?o.on("click",r):r()}):o.on("click",r):n("Standortanfragen werden von diesem Browser nicht unterstützt","",null))}); +$(document).ready(function(){function i(){return $("div.geolocation div.progress")}function e(e){var a=$("div.geolocation").data("backend");$.post("/geolocation",{lon:e.coords.longitude,lat:e.coords.latitude,backend:a},t)}function a(e){e.code==e.PERMISSION_DENIED?n("Standortanfrage nicht möglich.","Vermutlich fehlen die Rechte im Browser oder der Android Location Service ist deaktiviert.","geolocation.error.PERMISSION_DENIED"):e.code==e.POSITION_UNAVAILABLE?n("Standort konnte nicht ermittelt werden","(Service nicht verfügbar)","geolocation.error.POSITION_UNAVAILABLE"):e.code==e.TIMEOUT?n("Standort konnte nicht ermittelt werden","(Timeout)","geolocation.error.TIMEOUT"):n("Standort konnte nicht ermittelt werden","(unbekannter Fehler)","unknown geolocation.error code")}const n=function(e,a,n){var t=$(document.createElement("div")),a=(t.attr("class","error"),t.text(a),$(document.createElement("strong"))),e=(a.text(e+" "),t.prepend(a),$("div.geolocation").append(t),$("div.geolocation").data("recent"));if(e){a=e.split("|");const s=$(document.createElement("p"));$.each(a,function(e,a){var[a,n,t,i,o,r]=a.split(";"),a=$('"+n+"");a.click(function(){$("nav .preloader-wrapper").addClass("active")}),s.append(a)}),$("p.geolocationhint").text("Letzte Ziele:"),i().replaceWith(s)}else i().remove()},t=function(e){if(e.error)n("Backend-Fehler:",e.error,null);else if(0==e.candidates.length)n("Keine Bahnhöfe in 70km Umkreis gefunden","",null);else{const c=$(document.createElement("p"));$.each(e.candidates,function(e,a){let n;if(a.dbris){a.eva;var t=a.name,i=a.dbris;a.distance.toFixed(1);n=$(''+t+"")}else if(a.efa){var i=a.eva,t=a.name,o=a.efa;a.distance.toFixed(1);n=$(''+t+"")}else if(a.hafas){i=a.eva,o=a.name,t=a.hafas;a.distance.toFixed(1);n=$(''+o+"")}else if(a.motis){const{id,name:r,motis:s}=a;n=$(''+r+"")}else{i=a.eva,t=a.name;a.distance.toFixed(1);n=$(''+t+"")}n.click(function(){$("nav .preloader-wrapper").addClass("active")}),c.append(n)}),i().replaceWith(c)}},o=$("div.geolocation > .request");o.data("recent");function r(){o.replaceWith($('

Stationen in der Umgebung:

')),navigator.geolocation.getCurrentPosition(e,a)}o.length&&(navigator.geolocation?navigator.permissions?navigator.permissions.query({name:"geolocation"}).then(function(e){"prompt"===e.state?o.on("click",r):r()}):o.on("click",r):n("Standortanfragen werden von diesem Browser nicht unterstützt","",null))}); diff --git a/public/static/manifest.json b/public/static/manifest.json index 0709497..648b1e1 100644 --- a/public/static/manifest.json +++ b/public/static/manifest.json @@ -3,27 +3,27 @@ "short_name": "Travelynx", "scope": "/", "icons": [{ - "src": "/static/v94/icons/icon-128x128.png", + "src": "/static/v95/icons/icon-128x128.png", "sizes": "128x128", "type": "image/png" }, { - "src": "/static/v94/icons/icon-144x144.png", + "src": "/static/v95/icons/icon-144x144.png", "sizes": "144x144", "type": "image/png" }, { - "src": "/static/v94/icons/icon-152x152.png", + "src": "/static/v95/icons/icon-152x152.png", "sizes": "152x152", "type": "image/png" }, { - "src": "/static/v94/icons/icon-192x192.png", + "src": "/static/v95/icons/icon-192x192.png", "sizes": "192x192", "type": "image/png" }, { - "src": "/static/v94/icons/icon-256x256.png", + "src": "/static/v95/icons/icon-256x256.png", "sizes": "256x256", "type": "image/png" }, { - "src": "/static/v94/icons/icon-512x512.png", + "src": "/static/v95/icons/icon-512x512.png", "sizes": "512x512", "type": "image/png" }], diff --git a/public/static/v93 b/public/static/v93 deleted file mode 120000 index 945c9b4..0000000 --- a/public/static/v93 +++ /dev/null @@ -1 +0,0 @@ -. \ No newline at end of file diff --git a/public/static/v95 b/public/static/v95 new file mode 120000 index 0000000..945c9b4 --- /dev/null +++ b/public/static/v95 @@ -0,0 +1 @@ +. \ No newline at end of file -- cgit v1.2.3