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};