diff --git a/www/assets/js/home.js b/www/assets/js/home.js index c74bd02..99a622e 100644 --- a/www/assets/js/home.js +++ b/www/assets/js/home.js @@ -9,16 +9,9 @@ $("body").on("submit", "#wordbox-searchbar", function (e) { dolookup($("#wordbox").val()); return false; }); -// -//$("body").on("keypress", "#wordbox", function (e) { -// if (e.which == 13) { -// dolookup($(this).val()); -// } -// return false; -//}); function dolookup(words) { - //try { + try { words = words.trim().toLowerCase().replace(/\s+/g, ' '); if (!/^[a-z ]+?$/i.test(words)) { @@ -50,7 +43,7 @@ function dolookup(words) { break; } map.animateMapIn(coords[0], coords[1], zoomlevel); -// } catch (e) { -// alert(e); -// } + } catch (e) { + app.dialog.alert(e, "Error"); + } } \ No newline at end of file diff --git a/www/assets/js/map.js b/www/assets/js/map.js index 5148ed0..488e65b 100644 --- a/www/assets/js/map.js +++ b/www/assets/js/map.js @@ -13,7 +13,7 @@ function createMap() { } else { console.log("maplibre-gl not supported, disabling map"); $("#mapbox").css("display", "none"); - // TODO: show error to user + app.dialog.alert("Your device does not support the 3D graphics needed to show the map.", "Unsupported Device"); } } @@ -41,6 +41,7 @@ function reloadMap() { // oh well ¯\(°_o)/¯ console.log(ex); $("#mapbox").css("display", "none"); + app.dialog.alert("There was a problem loading the map. Error message: " + ex, "Error"); } } diff --git a/www/assets/js/map_maplibre.js b/www/assets/js/map_maplibre.js index 058e519..089def8 100644 --- a/www/assets/js/map_maplibre.js +++ b/www/assets/js/map_maplibre.js @@ -37,8 +37,8 @@ function maplibreMap() { var latitude = (Math.round(coordinates.lat * 10000) / 10000); var longitude = (Math.round(coordinates.lng * 10000) / 10000); lookupAndShowCoords(latitude, longitude); - } catch (e) { - alert(e); + } catch (ex) { + alert(ex); } });