Add some error feedback
This commit is contained in:
parent
a5784d8aa8
commit
5627f27562
@ -9,16 +9,9 @@ $("body").on("submit", "#wordbox-searchbar", function (e) {
|
|||||||
dolookup($("#wordbox").val());
|
dolookup($("#wordbox").val());
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
//
|
|
||||||
//$("body").on("keypress", "#wordbox", function (e) {
|
|
||||||
// if (e.which == 13) {
|
|
||||||
// dolookup($(this).val());
|
|
||||||
// }
|
|
||||||
// return false;
|
|
||||||
//});
|
|
||||||
|
|
||||||
function dolookup(words) {
|
function dolookup(words) {
|
||||||
//try {
|
try {
|
||||||
words = words.trim().toLowerCase().replace(/\s+/g, ' ');
|
words = words.trim().toLowerCase().replace(/\s+/g, ' ');
|
||||||
|
|
||||||
if (!/^[a-z ]+?$/i.test(words)) {
|
if (!/^[a-z ]+?$/i.test(words)) {
|
||||||
@ -50,7 +43,7 @@ function dolookup(words) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
map.animateMapIn(coords[0], coords[1], zoomlevel);
|
map.animateMapIn(coords[0], coords[1], zoomlevel);
|
||||||
// } catch (e) {
|
} catch (e) {
|
||||||
// alert(e);
|
app.dialog.alert(e, "Error");
|
||||||
// }
|
}
|
||||||
}
|
}
|
@ -13,7 +13,7 @@ function createMap() {
|
|||||||
} else {
|
} else {
|
||||||
console.log("maplibre-gl not supported, disabling map");
|
console.log("maplibre-gl not supported, disabling map");
|
||||||
$("#mapbox").css("display", "none");
|
$("#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)/¯
|
// oh well ¯\(°_o)/¯
|
||||||
console.log(ex);
|
console.log(ex);
|
||||||
$("#mapbox").css("display", "none");
|
$("#mapbox").css("display", "none");
|
||||||
|
app.dialog.alert("There was a problem loading the map. Error message: " + ex, "Error");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,8 +37,8 @@ function maplibreMap() {
|
|||||||
var latitude = (Math.round(coordinates.lat * 10000) / 10000);
|
var latitude = (Math.round(coordinates.lat * 10000) / 10000);
|
||||||
var longitude = (Math.round(coordinates.lng * 10000) / 10000);
|
var longitude = (Math.round(coordinates.lng * 10000) / 10000);
|
||||||
lookupAndShowCoords(latitude, longitude);
|
lookupAndShowCoords(latitude, longitude);
|
||||||
} catch (e) {
|
} catch (ex) {
|
||||||
alert(e);
|
alert(ex);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user