Regex is hard...

This commit is contained in:
2024-03-19 22:38:35 +01:00
parent ed83bb4e16
commit 21a47090da
+3 -1
View File
@@ -48,7 +48,9 @@ const buffers: { [reason in BannedArea]: (FeatureCollection | Feature)[] } = {
let center: [number, number] = [53.0711829, 8.8087718]; let center: [number, number] = [53.0711829, 8.8087718];
let zoom = 14; let zoom = 14;
const urlPosition = /#@(\d+.?\d*),(\d+.?\d*),(\d+)/.exec(window.location.hash); const urlPosition = /#@(-?\d+\.?\d*),(-?\d+\.?\d*),(\d+)/.exec(
window.location.hash
);
if (urlPosition && urlPosition.length === 4) { if (urlPosition && urlPosition.length === 4) {
const lat = parseFloat(urlPosition[1]); const lat = parseFloat(urlPosition[1]);
const lon = parseFloat(urlPosition[2]); const lon = parseFloat(urlPosition[2]);