From 6741a225277df64c8a10d6214f9f8e9b3e1ebf9a Mon Sep 17 00:00:00 2001 From: Corentin Date: Thu, 23 Oct 2025 18:57:29 +0900 Subject: [PATCH] Add default place (link) --- public/index.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/public/index.js b/public/index.js index f6b5a74..a80de0c 100644 --- a/public/index.js +++ b/public/index.js @@ -41,6 +41,8 @@ map.on('click', onMapClick); let markers = {}; let categories = {}; fetch('/marker.json').then(response => response.json()).then(marker_data => { + const params = new URLSearchParams(document.location.search); + let default_place = params.get('place'); for(let category_name in marker_data) { const category_data = marker_data[category_name]; @@ -49,8 +51,16 @@ fetch('/marker.json').then(response => response.json()).then(marker_data => { category_data.places.forEach(marker_info => { const marker = L.marker( [marker_info.lat, marker_info.lon], - {title: marker_info.name, icon: icon}).bindPopup(`

${marker_info.name}

${marker_info.description}`); + {title: marker_info.name, icon: icon}).bindPopup( + `

${marker_info.name}

+
${marker_info.description}
+
link<\a>
`); category_markers.push(marker); + if(marker_info.name === default_place) + { + marker.addTo(map); + map.setView([marker_info.lat, marker_info.lon], 16); + } }); categories[category_name] = { icon: icon, icon_url: `/images/${category_data.icon}`, name: category_data.name, enable: false};