From f2df8944b8082b158bb161f143053f4ec4dc0844 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sun, 11 Jul 2021 14:19:59 +0200 Subject: geolocation.js: Add missing showError function --- static/v0/js/geolocation.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'static/v0/js/geolocation.js') diff --git a/static/v0/js/geolocation.js b/static/v0/js/geolocation.js index acf672a..1ea4ee5 100644 --- a/static/v0/js/geolocation.js +++ b/static/v0/js/geolocation.js @@ -80,6 +80,25 @@ document.addEventListener("DOMContentLoaded", function() { }).then(response => response.json()).then(processResult); }; + const showError = function(header, text, code) { + const errnode = document.createElement("div"); + const errhead = document.createElement("strong"); + const errtext = document.createTextNode(text); + const errcode = document.createElement("div"); + + errnode.className = "error"; + errcode.className = "errcode"; + + errhead.textContent = header; + errcode.textContent = code; + + errnode.appendChild(errhead); + errnode.appendChild(errtext); + errnode.appendChild(errcode); + + geoLocationButton.replaceWith(errnode); + } + const processError = function(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'); -- cgit v1.2.3