summaryrefslogtreecommitdiff
path: root/static/js/geolocation.js
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2021-08-21 12:11:35 +0200
committerDaniel Friesel <derf@finalrewind.org>2021-08-21 12:11:35 +0200
commitf5a6a5927bfcc4a2b82c34db5041bfe3a49b95e6 (patch)
treed9508512ae32be6ecc865607539c16566db2756e /static/js/geolocation.js
parent8a04cf20c5d6dc577a7de7745cbeb292bf78529d (diff)
refresh departure list every minute0.2.0
Diffstat (limited to 'static/js/geolocation.js')
-rw-r--r--static/js/geolocation.js12
1 files changed, 6 insertions, 6 deletions
diff --git a/static/js/geolocation.js b/static/js/geolocation.js
index aba8b10..eeb535f 100644
--- a/static/js/geolocation.js
+++ b/static/js/geolocation.js
@@ -1,14 +1,14 @@
document.addEventListener("DOMContentLoaded", function() {
const geoLocationButton = document.getElementById('geolocationsearch');
- const mkTextNode = function(className, textContent) {
+ const mkTextNode = (className, textContent) => {
const node = document.createElement("span");
node.className = className;
node.textContent = textContent;
return node
}
- const processResult = function(results) {
+ const processResult = (results) => {
const list = document.createElement("ul");
list.className = "stops";
@@ -73,7 +73,7 @@ document.addEventListener("DOMContentLoaded", function() {
geoLocationButton.replaceWith(list);
};
- const processLocation = function(loc) {
+ const processLocation = (loc) => {
fetch('/geolocation', {
method: 'POST',
headers: {
@@ -86,7 +86,7 @@ document.addEventListener("DOMContentLoaded", function() {
}).then(response => response.json()).then(processResult);
};
- const showError = function(header, text, code) {
+ const showError = (header, text, code) => {
const errnode = document.createElement("div");
const errhead = document.createElement("strong");
const errtext = document.createTextNode(text);
@@ -105,7 +105,7 @@ document.addEventListener("DOMContentLoaded", function() {
geoLocationButton.replaceWith(errnode);
}
- const processError = function(error) {
+ const processError = (error) => {
if (error.code == error.PERMISSION_DENIED) {
showError('Standortanfrage nicht möglich.', 'Vermutlich fehlen die Rechte im Browser oder der Android Location Service ist deaktiviert.', 'geolocation.error.PERMISSION_DENIED');
} else if (error.code == error.POSITION_UNAVAILABLE) {
@@ -117,7 +117,7 @@ document.addEventListener("DOMContentLoaded", function() {
}
};
- const getGeoLocation = function() {
+ const getGeoLocation = () => {
geoLocationButton.textContent = "Suche Haltestellen ...";
geoLocationButton.disabled = true;
navigator.geolocation.getCurrentPosition(processLocation, processError);