Warn if custom layer source may not be GeoJSON

main
Chandler Swift 2024-10-19 17:39:22 -05:00
parent 13855a9a38
commit 13eb66570a
Signed by: chandlerswift
GPG Key ID: A851D929D52FB93F
1 changed files with 5 additions and 0 deletions

View File

@ -164,6 +164,11 @@ const sourceInput = customLayerDiv.querySelector('input[name=source]');
const colorInput = customLayerDiv.querySelector('input[name=color]'); const colorInput = customLayerDiv.querySelector('input[name=color]');
customLayerDiv.querySelector("button").addEventListener("click", function(){ 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); newCustomLayer(labelInput.value, sourceInput.value, colorInput.value);
}); });
document.querySelector("aside").appendChild(customLayerDiv); document.querySelector("aside").appendChild(customLayerDiv);