at main 811 B view raw
1<div id="checkpoints-map"></div> 2<script type="module"> 3 import {VelodbMap} from '/static/map.js'; 4 5 6 function updateMapFromUrl(e) { 7 console.log('updateMapFromUrl', {e}) 8 if (location.hash.startsWith('#eid:')) { 9 const eid = location.hash.split(':')[1]; 10 if (eid) { 11 htmx.trigger('#checkpoints-map', 'checkpoints:geometry:zoom',{ entity: eid }); 12 } 13 } 14 }; 15 window.addEventListener('popstate', updateMapFromUrl); 16 17 const map = new VelodbMap(document.getElementById('checkpoints-map')); 18 map.addGeometry(['{{links.locations.geojson|safe}}']); 19 document['map'] = map; 20 21 htmx.on('checkpoints:map:geometry:load', updateMapFromUrl); 22</script> 23<style> 24#checkpoints-map { 25 width: 100%; 26 height: 100vh; 27 min-width: 200px; 28} 29</style>