$(function(){vare=function(){$("div.candidatestatus").remove()},t=function(e,t,n){varr=$(document.createElement("div"));r.attr("class","error"),r.text(t);varo=$(document.createElement("strong"));if(o.text(e),r.prepend(o),n){vara=$(document.createElement("div"));a.attr("class","errcode"),a.text(n),r.append(a)}$("div.candidatelist").append(r)},n=function(n){e(),n.error?t("Backend-Fehler:",n.error,null):0==n.candidates.length?t("Keine Bahnhöfe in 70km Umkreis gefunden","",null):$.each(n.candidates,function(e,t){varn=t.ds100,r=t.name,o=t.distance;o=o.toFixed(1);vara=$(document.createElement("a"));a.attr("href",n),a.text(r);vari=$(document.createElement("div"));i.attr("class","distance"),i.text(o),a.append(i),$("div.candidatelist").append(a)})},r=function(r){$.post("/_geolocation",{lon:r.coords.longitude,lat:r.coords.latitude},n).fail(function(n,r,o){e(),t("Netzwerkfehler: ",r,o)}),$("div.candidatestatus").text("Suche Bahnhöfe…")},o=function(n){e(),n.code==n.PERMISSION_DENIED?t("Standortanfrage nicht möglich.","Vermutlich fehlen die Rechte im Browser oder der Android Location Service ist deaktiviert.","geolocation.error.PERMISSION_DENIED"):n.code==n.POSITION_UNAVAILABLE?t("Standort konnte nicht ermittelt werden","(Service nicht verfügbar)","geolocation.error.POSITION_UNAVAILABLE"):n.code==n.TIMEOUT?t("Standort konnte nicht ermittelt werden","(Timeout)","geolocation.error.TIMEOUT"):t("Standort konnte nicht ermittelt werden","(unbekannter Fehler)","unknown geolocation.error code")};navigator.geolocation?(navigator.geolocation.getCurrentPosition(r,o),$("div.candidatestatus").text("Position wird bestimmt…")):(e(),t("Standortanfragen werden von diesem Browser nicht unterstützt","",null))});
$(function(){functiont(e){r(),e.error?o("Backend-Fehler:",e.error,null):0==e.candidates.length?o("Keine Bahnhöfe in 70km Umkreis gefunden","",null):$.each(e.candidates,function(e,t){varn=t.ds100,r=t.name,o=(o=t.distance).toFixed(1),t=$(document.createElement("a"));t.attr("href",n),t.text(r);r=$(document.createElement("div"));r.attr("class","distance"),r.text(o),t.append(r),$("div.candidatelist").append(t)})}varr=function(){$("div.candidatestatus").remove()},o=function(e,t,n){varr=$(document.createElement("div"));r.attr("class","error"),r.text(t);t=$(document.createElement("strong"));t.text(e),r.prepend(t),n&&((t=$(document.createElement("div"))).attr("class","errcode"),t.text(n),r.append(t)),$("div.candidatelist").append(r)};navigator.geolocation?(navigator.geolocation.getCurrentPosition(function(e){$.post("/_geolocation",{lon:e.coords.longitude,lat:e.coords.latitude},t).fail(function(e,t,n){r(),o("Netzwerkfehler: ",t,n)}),$("div.candidatestatus").text("Suche Bahnhöfe…")},function(e){r(),e.code==e.PERMISSION_DENIED?o("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?o("Standort konnte nicht ermittelt werden","(Service nicht verfügbar)","geolocation.error.POSITION_UNAVAILABLE"):e.code==e.TIMEOUT?o("Standort konnte nicht ermittelt werden","(Timeout)","geolocation.error.TIMEOUT"):o("Standort konnte nicht ermittelt werden","(unbekannter Fehler)","unknown geolocation.error code")}),$("div.candidatestatus").text("Position wird bestimmt…")):(r(),o("Standortanfragen werden von diesem Browser nicht unterstützt","",null))});
$(function(){vare=function(){$("div.candidatestatus").remove()},t=function(e,t,n){varr=$(document.createElement("div"));r.attr("class","error"),r.text(t);varo=$(document.createElement("strong"));if(o.text(e),r.prepend(o),n){vari=$(document.createElement("div"));i.attr("class","errcode"),i.text(n),r.append(i)}$("div.candidatelist").append(r)},n=function(n){e(),n.error?t("Backend-Fehler:",n.error,null):0==n.evas.length?t("Keine Bahnstrecke gefunden","",null):0==n.trains.length?t("Keine Züge auf der Strecke gefunden","",null):$.each(n.trains,function(e,t){constn=t.stops[0][1],r=t.stops[0][2],o=t.stops[1][0],i=t.stops[1][1],a=t.stops[1][2];vard=$(document.createElement("a"));d.attr("href","/z/"+t.train+"/"+o),d.text(t.line);varc=$(document.createElement("div"));c.attr("class","traininfo"),c.html(t.likelihood+"%<br/>"+r+""+n+"<br/>"+a+""+i),d.append(c),$("div.candidatelist").append(d)})},r=function(r){$.get("https://dbf.finalrewind.org/__geotrain/search",{lon:r.coords.longitude,lat:r.coords.latitude},n).fail(function(n,r,o){e(),t("Netzwerkfehler: ",r,o)}),$("div.candidatestatus").text("Suche Züge…")},o=function(n){e(),n.code==n.PERMISSION_DENIED?t("Standortanfrage nicht möglich.","Vermutlich fehlen die Rechte im Browser oder der Android Location Service ist deaktiviert.","geolocation.error.PERMISSION_DENIED"):n.code==n.POSITION_UNAVAILABLE?t("Standort konnte nicht ermittelt werden","(Service nicht verfügbar)","geolocation.error.POSITION_UNAVAILABLE"):n.code==n.TIMEOUT?t("Standort konnte nicht ermittelt werden","(Timeout)","geolocation.error.TIMEOUT"):t("Standort konnte nicht ermittelt werden","(unbekannter Fehler)","unknown geolocation.error code")};navigator.geolocation?(navigator.geolocation.getCurrentPosition(r,o),$("div.candidatestatus").text("Position wird bestimmt…")):(e(),t("Standortanfragen werden von diesem Browser nicht unterstützt","",null))});
$(function(){functiont(e){r(),e.error?o("Backend-Fehler:",e.error,null):0==e.evas.length?o("Keine Bahnstrecke gefunden","",null):0==e.trains.length?o("Keine Züge auf der Strecke gefunden","",null):$.each(e.trains,function(e,t){varn=t.stops[0][1],r=t.stops[0][2],o=t.stops[1][0],i=t.stops[1][1],a=t.stops[1][2],d=$(document.createElement("a"));d.attr("href","/z/"+t.train+"/"+o),d.text(t.line);o=$(document.createElement("div"));o.attr("class","traininfo"),o.html(t.likelihood+"%<br/>"+r+""+n+"<br/>"+a+""+i),d.append(o),$("div.candidatelist").append(d)})}varr=function(){$("div.candidatestatus").remove()},o=function(e,t,n){varr=$(document.createElement("div"));r.attr("class","error"),r.text(t);t=$(document.createElement("strong"));t.text(e),r.prepend(t),n&&((t=$(document.createElement("div"))).attr("class","errcode"),t.text(n),r.append(t)),$("div.candidatelist").append(r)};navigator.geolocation?(navigator.geolocation.getCurrentPosition(function(e){$.get("https://dbf.finalrewind.org/__geotrain/search",{lon:e.coords.longitude,lat:e.coords.latitude},t).fail(function(e,t,n){r(),o("Netzwerkfehler: ",t,n)}),$("div.candidatestatus").text("Suche Züge…")},function(e){r(),e.code==e.PERMISSION_DENIED?o("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?o("Standort konnte nicht ermittelt werden","(Service nicht verfügbar)","geolocation.error.POSITION_UNAVAILABLE"):e.code==e.TIMEOUT?o("Standort konnte nicht ermittelt werden","(Timeout)","geolocation.error.TIMEOUT"):o("Standort konnte nicht ermittelt werden","(unbekannter Fehler)","unknown geolocation.error code")}),$("div.candidatestatus").text("Position wird bestimmt…")):(r(),o("Standortanfragen werden von diesem Browser nicht unterstützt","",null))});