$(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=$(''+(t||i||o||r?"directions":"train")+""+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=$('directions'+t+"")}else if(a.efa){var i=a.eva,t=a.name,o=a.efa;a.distance.toFixed(1);n=$('directions'+t+"")}else if(a.hafas){i=a.eva,o=a.name,t=a.hafas;a.distance.toFixed(1);n=$('directions'+o+"")}else if(a.motis){const{id,name:r,motis:s}=a;n=$('directions'+r+"")}else{i=a.eva,t=a.name;a.distance.toFixed(1);n=$('train'+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: