From d07c033ad73a16ab7a0f7e69a5d6bcc5f04d0a3b Mon Sep 17 00:00:00 2001 From: Arun Ganesh Date: Tue, 5 Dec 2023 01:51:48 +0530 Subject: [PATCH] Code cleanup --- js/chennai.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/js/chennai.js b/js/chennai.js index b8831a9..e0f883f 100644 --- a/js/chennai.js +++ b/js/chennai.js @@ -19,11 +19,11 @@ fetch('https://cloudflare.com/cdn-cgi/trace') .then(data => { userIpMatch = data.match(/ip=([\d.]+)/); -userLocationMatch = data.match(/colo=([\d.]+)/); +userLocationMatch = data.match(/colo=([A-Z]+)/); + user.location = userLocationMatch ? userLocationMatch[1] : null; user.ip = userIpMatch ? userIpMatch[1] : null; - }) map.off('tile.error', map.onError); @@ -202,14 +202,12 @@ function selectionHandler(data) { if (map.getZoom() >= 15) { let features; features = map.queryRenderedFeatures(e.point, { layers: ['selected-roads'] }) - console.log(features) if (features.length) { deleteRoad(data, addedRoads, addedFeatures, features); } else { let features; features = map.queryRenderedFeatures(e.point, { layers: MAP_LAYERS['road'] }); if (features.length) { - console.log(features) addRoad(data, addedRoads, addedFeatures, features); } }