refacto fonctions

This commit is contained in:
Tykayn 2025-06-06 23:28:35 +02:00 committed by tykayn
parent 1b0d2d425d
commit 9b09b0d59d
8 changed files with 191 additions and 163 deletions

View file

@ -181,17 +181,11 @@
{{ parent() }}
<script src={{asset('js/mapbox/mapbox-gl.js')}}></script>
<script>
function openInJOSM(type, id) {
{# function openInJOSM(type, id) {
const josmUrl = `http://localhost:8111/load_object?objects=${type}${id}`;
window.open(josmUrl);
}
} #}
function openInPanoramax() {
const center = map.getCenter();
const zoom = map.getZoom();
const panoramaxUrl = `https://api.panoramax.xyz/?focus=map&map=${zoom}/${center.lat}/${center.lng}`;
window.open(panoramaxUrl);
}
{% if commerce is not empty and mapbox_token is not empty and maptiler_token is not empty and commerce_overpass['@attributes'].lon is defined and commerce_overpass['@attributes'].lat is defined %}
mapboxgl.accessToken = '{{ mapbox_token }}';
@ -208,5 +202,11 @@
.addTo(map);
{% endif %}
// Ajouter un écouteur d'événement pour le redimensionnement de la fenêtre
window.addEventListener('resize', () => {
updateMapHeightForLargeScreens();
});
</script>
{% endblock %}