X-Git-Url: https://git-public.kairo.at/?p=lantea.git;a=blobdiff_plain;f=js%2Fui.js;h=9edf4dd67c15f4fdd61dae9791cd3bddf8166ddc;hp=92dd488e051e1c185707ccca347a9c8a621ea7bd;hb=da8fd4b697c86d4c61acbe4c95764ab7d27d4198;hpb=662078d15cd8052cab2a7effd2a1306283cfb2a6 diff --git a/js/ui.js b/js/ui.js index 92dd488..9edf4dd 100644 --- a/js/ui.js +++ b/js/ui.js @@ -18,6 +18,10 @@ var gBackendURL = "https://backend.lantea.kairo.at/"; var gAuthClientID = "lantea"; window.onload = function() { + // Assign click functions to buttons. + document.getElementById("zoomInButton").onclick = gMap.zoomIn; + document.getElementById("zoomOutButton").onclick = gMap.zoomOut; + gAction = document.getElementById("action"); gActionLabel = document.getElementById("actionlabel"); @@ -239,11 +243,15 @@ function initDB(aEvent) { request.onerror = function(event) { // Errors can be handled here. Error codes explain in: // https://developer.mozilla.org/en/IndexedDB/IDBDatabaseException#Constants - if (gDebug) - console.log("error opening mainDB: " + event.target.errorCode); + console.log("error opening mainDB: " + event.target.error); + showDBErrorDialog(); + if (gDebug) { + console.log("error code: " + event.target.error.code + + " - name: " + event.target.error.name); + } }; request.onsuccess = function(event) { - mainDB = request.result; + mainDB = event.target.result; var throwEv = new CustomEvent("dbinit-done"); gAction.dispatchEvent(throwEv); }; @@ -382,6 +390,16 @@ function showGLWarningDialog() { dia.classList.remove("hidden"); } +function showDBErrorDialog() { + var dia = document.getElementById("dialogArea"); + var areas = dia.children; + for (var i = 0; i <= areas.length - 1; i++) { + areas[i].style.display = "none"; + } + document.getElementById("DBError").style.display = "block"; + dia.classList.remove("hidden"); +} + function showFirstRunDialog() { var dia = document.getElementById("dialogArea"); var areas = dia.children; @@ -561,6 +579,13 @@ function reportUploadStatus(aSuccess, aResponse) { } } +function setMapStyle() { + var mapSel = document.getElementById("mapSelector"); + if (mapSel.selectedIndex >= 0 && gMap.activeMap != mapSel.value) { + gMap.setActiveMap(mapSel.value); + } +} + var gPrefs = { objStore: "prefs",