Add version control context processor and integrate map functionality with dedicated JavaScript

This commit is contained in:
pacnpal
2025-02-06 20:06:10 -05:00
parent f3d28817a5
commit ecf94bf84e
16 changed files with 1671 additions and 89 deletions

20
static/js/map-init.js Normal file
View File

@@ -0,0 +1,20 @@
document.addEventListener('DOMContentLoaded', function() {
const mapContainer = document.getElementById('map');
if (!mapContainer) return;
const lat = parseFloat(mapContainer.dataset.lat);
const lng = parseFloat(mapContainer.dataset.lng);
const name = mapContainer.dataset.name;
if (isNaN(lat) || isNaN(lng)) return;
const map = L.map('map').setView([lat, lng], 13);
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '© OpenStreetMap contributors'
}).addTo(map);
L.marker([lat, lng])
.addTo(map)
.bindPopup(name);
});