diff options
Diffstat (limited to 'public/static/js')
| -rw-r--r-- | public/static/js/geolocation.js | 20 | ||||
| -rw-r--r-- | public/static/js/geolocation.min.js | 2 |
2 files changed, 2 insertions, 20 deletions
diff --git a/public/static/js/geolocation.js b/public/static/js/geolocation.js index fdf757a..58f14a1 100644 --- a/public/static/js/geolocation.js +++ b/public/static/js/geolocation.js @@ -18,25 +18,7 @@ $(document).ready(function() { $('div.geolocation').append(errnode); - const recent = $('div.geolocation').data('recent'); - if (recent) { - const stops = recent.split('|'); - const res = $(document.createElement('p')); - $.each(stops, function(i, stop) { - const parts = stop.split(';'); - const [ eva, name, dbris, efa, hafas, motis ] = parts; - - const node = $('<a class="tablerow" href="/s/' + eva + '?dbris=' + (dbris||0) + '&efa=' + (efa||0) + '&hafas=' + (hafas||0) + '&motis=' + (motis||0) + '"><span>' + name + '</span></a>'); - node.click(function() { - $('nav .preloader-wrapper').addClass('active'); - }); - res.append(node); - }); - $('p.geolocationhint').text('Letzte Ziele:'); - getPlaceholder().replaceWith(res); - } else { - getPlaceholder().remove(); - } + getPlaceholder().remove(); }; const processResult = function(data) { diff --git a/public/static/js/geolocation.min.js b/public/static/js/geolocation.min.js index f4e38ec..b83984d 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 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=$('<a class="tablerow" href="/s/'+a+"?dbris="+(t||0)+"&efa="+(i||0)+"&hafas="+(o||0)+"&motis="+(r||0)+'"><span>'+n+"</span></a>");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 r=$(document.createElement("p"));$.each(e.candidates,function(e,a){let n;var t,i,o;(n=a.dbris?(i=a.eva,o=a.name,t=a.dbris,a.distance.toFixed(1),$('<a class="tablerow" href="/s/'+i+"?dbris="+t+'"><span><i class="material-icons" aria-hidden="true">directions</i>'+o+"</span></a>")):a.efa?(i=a.eva,t=a.name,o=a.efa,a.distance.toFixed(1),$('<a class="tablerow" href="/s/'+i+"?efa="+o+'"><span><i class="material-icons" aria-hidden="true">directions</i>'+t+"</span></a>")):a.hafas?(i=a.eva,o=a.name,t=a.hafas,a.distance.toFixed(1),$('<a class="tablerow" href="/s/'+i+"?hafas="+t+'"><span><i class="material-icons" aria-hidden="true">directions</i>'+o+"</span></a>")):a.motis?({id:i,name:t,motis:o}=a,$('<a class="tablerow" href="/s/'+i+"?motis="+o+'"><span><i class="material-icons" aria-hidden="true">directions</i>'+t+"</span></a>")):(i=a.eva,o=a.name,a.distance.toFixed(1),$('<a class="tablerow" href="/s/'+i+'"><span><i class="material-icons" aria-hidden="true">train</i>'+o+"</span></a>"))).click(function(){$("nav .preloader-wrapper").addClass("active")}),r.append(n)}),i().replaceWith(r)}},o=$("div.geolocation > .request");o.data("recent");function r(){o.replaceWith($('<p class="geolocationhint">Stationen in der Umgebung:</p><div class="progress"><div class="indeterminate"></div></div>')),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))}); +$(document).ready(function(){function i(){return $("div.geolocation div.progress")}function e(e){var n=$("div.geolocation").data("backend");$.post("/geolocation",{lon:e.coords.longitude,lat:e.coords.latitude,backend:n},t)}function n(e){e.code==e.PERMISSION_DENIED?a("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?a("Standort konnte nicht ermittelt werden","(Service nicht verfügbar)","geolocation.error.POSITION_UNAVAILABLE"):e.code==e.TIMEOUT?a("Standort konnte nicht ermittelt werden","(Timeout)","geolocation.error.TIMEOUT"):a("Standort konnte nicht ermittelt werden","(unbekannter Fehler)","unknown geolocation.error code")}const a=function(e,n,a){var t=$(document.createElement("div")),n=(t.attr("class","error"),t.text(n),$(document.createElement("strong")));n.text(e+" "),t.prepend(n),$("div.geolocation").append(t),i().remove()},t=function(e){if(e.error)a("Backend-Fehler:",e.error,null);else if(0==e.candidates.length)a("Keine Bahnhöfe in 70km Umkreis gefunden","",null);else{const r=$(document.createElement("p"));$.each(e.candidates,function(e,n){let a;var t,i,o;(a=n.dbris?(i=n.eva,o=n.name,t=n.dbris,n.distance.toFixed(1),$('<a class="tablerow" href="/s/'+i+"?dbris="+t+'"><span><i class="material-icons" aria-hidden="true">directions</i>'+o+"</span></a>")):n.efa?(i=n.eva,t=n.name,o=n.efa,n.distance.toFixed(1),$('<a class="tablerow" href="/s/'+i+"?efa="+o+'"><span><i class="material-icons" aria-hidden="true">directions</i>'+t+"</span></a>")):n.hafas?(i=n.eva,o=n.name,t=n.hafas,n.distance.toFixed(1),$('<a class="tablerow" href="/s/'+i+"?hafas="+t+'"><span><i class="material-icons" aria-hidden="true">directions</i>'+o+"</span></a>")):n.motis?({id:i,name:t,motis:o}=n,$('<a class="tablerow" href="/s/'+i+"?motis="+o+'"><span><i class="material-icons" aria-hidden="true">directions</i>'+t+"</span></a>")):(i=n.eva,o=n.name,n.distance.toFixed(1),$('<a class="tablerow" href="/s/'+i+'"><span><i class="material-icons" aria-hidden="true">train</i>'+o+"</span></a>"))).click(function(){$("nav .preloader-wrapper").addClass("active")}),r.append(a)}),i().replaceWith(r)}},o=$("div.geolocation > .request");o.data("recent");function r(){o.replaceWith($('<p class="geolocationhint">Stationen in der Umgebung:</p><div class="progress"><div class="indeterminate"></div></div>')),navigator.geolocation.getCurrentPosition(e,n)}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):a("Standortanfragen werden von diesem Browser nicht unterstützt","",null))}); |
