Warn if custom layer source may not be GeoJSON

This commit is contained in:
Chandler Swift 2024-10-19 17:39:22 -05:00
parent 13855a9a38
commit 13eb66570a
Signed by: chandlerswift
GPG key ID: A851D929D52FB93F

View file

@ -164,6 +164,11 @@ const sourceInput = customLayerDiv.querySelector('input[name=source]');
const colorInput = customLayerDiv.querySelector('input[name=color]');
customLayerDiv.querySelector("button").addEventListener("click", function(){
if (!sourceInput.value.toLowerCase().endsWith(".geojson")) {
if (!confirm("Input URL doesn't end in .geojson, so is probably not a valid GeoJSON file. Do you want to continue anyway?")) {
return;
}
}
newCustomLayer(labelInput.value, sourceInput.value, colorInput.value);
});
document.querySelector("aside").appendChild(customLayerDiv);