diff --git a/public/static/js/geolocation.js b/public/static/js/geolocation.js index caf2a2a..6e638e0 100644 --- a/public/static/js/geolocation.js +++ b/public/static/js/geolocation.js @@ -4,6 +4,15 @@ $(document).ready(function() { var showError = function(header, message, code) { prePlaceholder.remove(); placeholder.remove(); + var errnode = $(document.createElement('div')); + errnode.attr('class', 'error'); + errnode.text(message + '. Alternativ kannst du unter „travelynx.de/s/Name der Station“ einchecken.'); + + var headnode = $(document.createElement('strong')); + headnode.text(header); + errnode.prepend(headnode); + + $('div.geolocation').append(errnode); }; var processResult = function(data) { diff --git a/public/static/js/geolocation.min.js b/public/static/js/geolocation.min.js index 1bd2c77..6b4a790 100644 --- a/public/static/js/geolocation.min.js +++ b/public/static/js/geolocation.min.js @@ -1 +1 @@ -$(document).ready(function(){var a=$("p.geolocationhint"),n=$("div.geolocation div.progress"),t=function(e,t,o){a.remove(),n.remove()},o=function(e){e.error?t(0,e.error):0==e.candidates.length?t():(resultTable=$("
"),resultBody=resultTable.children(),$.each(e.candidates,function(e,t){var o=t.ds100,a=t.name,n=t.distance;n=n.toFixed(1);var r=$(document.createElement("a"));r.attr("href",o),r.text(a),resultBody.append(''+a+"")}),n.replaceWith(resultTable))};navigator.geolocation?navigator.geolocation.getCurrentPosition(function(e){$.post("/geolocation",{lon:e.coords.longitude,lat:e.coords.latitude},o)},function(e){e.code==e.PERMISSION_DENIED||e.code==e.POSITION_UNAVAILABLE||(e.code,e.TIMEOUT),t()}):t()}); +$(document).ready(function(){var e=$("p.geolocationhint"),t=$("div.geolocation div.progress"),n=function(n,r,o){e.remove(),t.remove();var a=$(document.createElement("div"));a.attr("class","error"),a.text(r+". Alternativ kannst du unter „travelynx.de/s/Name der Station“ einchecken.");var i=$(document.createElement("strong"));i.text(n),a.prepend(i),$("div.geolocation").append(a)},r=function(e){e.error?n("Backend-Fehler:",e.error):0==e.candidates.length?n("Keine Bahnhöfe in 70km Umkreis gefunden",""):(resultTable=$("
"),resultBody=resultTable.children(),$.each(e.candidates,function(e,t){var n=t.ds100,r=t.name,o=t.distance;o=o.toFixed(1);var a=$(document.createElement("a"));a.attr("href",n),a.text(r),resultBody.append(''+r+"")}),t.replaceWith(resultTable))},o=function(e){$.post("/geolocation",{lon:e.coords.longitude,lat:e.coords.latitude},r)},a=function(e){e.code==e.PERMISSION_DENIED?n("Standortanfrage nicht möglich.","Vermutlich fehlen die Rechte im Browser oder der Android Location Service ist deaktiviert."):e.code==e.POSITION_UNAVAILABLE?n("Standort konnte nicht ermittelt werden","(Service nicht verfügbar)"):e.code==e.TIMEOUT?n("Standort konnte nicht ermittelt werden","(Timeout)"):n("Standort konnte nicht ermittelt werden","(unbekannter Fehler)")};navigator.geolocation?navigator.geolocation.getCurrentPosition(o,a):n("Standortanfragen werden von diesem Browser nicht unterstützt","")}); diff --git a/public/static/v2 b/public/static/v2 new file mode 120000 index 0000000..945c9b4 --- /dev/null +++ b/public/static/v2 @@ -0,0 +1 @@ +. \ No newline at end of file diff --git a/templates/layouts/default.html.ep b/templates/layouts/default.html.ep index 3fdb075..efd7ee4 100644 --- a/templates/layouts/default.html.ep +++ b/templates/layouts/default.html.ep @@ -5,7 +5,7 @@ - % my $av = 'v1'; # asset version + % my $av = 'v2'; # asset version %= stylesheet "/static/${av}/css/materialize.min.css" %= stylesheet "/static/${av}/css/material-icons.css" %= stylesheet "/static/${av}/css/local.css"