show hint in case of geolocation error
This commit is contained in:
parent
a0040bceb6
commit
13d81d72ee
4 changed files with 12 additions and 2 deletions
|
@ -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) {
|
||||
|
|
2
public/static/js/geolocation.min.js
vendored
2
public/static/js/geolocation.min.js
vendored
|
@ -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=$("<table><tbody></tbody></table>"),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('<tr><td><a href="/s/'+o+'">'+a+"</a></td></tr>")}),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=$("<table><tbody></tbody></table>"),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('<tr><td><a href="/s/'+n+'">'+r+"</a></td></tr>")}),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","")});
|
||||
|
|
1
public/static/v2
Symbolic link
1
public/static/v2
Symbolic link
|
@ -0,0 +1 @@
|
|||
.
|
|
@ -5,7 +5,7 @@
|
|||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="theme-color" content="#673ab7">
|
||||
% 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"
|
||||
|
|
Loading…
Reference in a new issue