Warn if custom layer source may not be GeoJSON
This commit is contained in:
parent
13855a9a38
commit
13eb66570a
5
main.js
5
main.js
|
@ -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);
|
||||||
|
|
Loading…
Reference in a new issue