btns.forEach(btn => {
btn.addEventListener(‘click’, function(e) {
e.preventDefault();
});
});
}
});
map.on(‘layeradd’, function(event) {
var focusable = mapContener.querySelectorAll(‘a, input, button, select, img[role=”button”]’);
if(typeof focusable==’object’ && focusable.length>0) {
focusable.forEach(el => {
el.setAttribute(‘tabindex’, ‘-1’);
});
}
});
var pois = [
{
coords:L.latLng(‘47.460712’, ‘-0.596227′),
opts: {title:”Parc de loisirs du Lac de Maine”}
},
];
pois.forEach(function(poi, index, arr) {
L.marker(poi.coords, poi.opts).addTo(map).bindPopup(poi.opts.title);
bound.extend(poi.coords);
});
if(typeof bound==’object’ && bound.isValid()) {
map.fitBounds(bound);
}
else {
hideMap(mapContener);
}
}
else {
hideMap(mapContener);
}
}
}
function hideMap(mapContener) {
mapContener.style.width = ‘0px’;
mapContener.style.height = ‘0px’;
mapContener.style.display = ‘none’;
}
function loadMyMap() {
var oldScript = document.getElementById(‘scriptMyMap’);
if(oldScript) {document.body.removeChild(oldScript);}
var script = document.createElement(“script”);
script.id = “scriptMyMap”;
script.src = “https://unpkg.com/leaflet@1.8.0/dist/leaflet.js”;
script.addEventListener(“load”, function(event) {
var oldScriptFull = document.getElementById(‘scriptMyMaFull’);
if(oldScriptFull) {document.body.removeChild(oldScriptFull);}
var scriptFull = document.createElement(“script”);
scriptFull.id = “scriptMyMaFull”;
scriptFull.src = “https://unpkg.com/leaflet.fullscreen@2.4.0/Control.FullScreen.js”;
scriptFull.addEventListener(“load”, function(event) {
initializeMyMap();
});
document.body.appendChild(scriptFull);
});
document.body.appendChild(script);
}
window.addEventListener(“load”, function(event) {loadMyMap();});
]]>






