carte ressources va directement sur mission photo

This commit is contained in:
2025-12-01 14:04:26 +01:00
parent ad9c0349c7
commit 4e8fe4fb2d
2 changed files with 97 additions and 17 deletions

View File

@@ -163,25 +163,58 @@ svgElement.addEventListener('mouseout', function(event) {
});
// Gérer les clics pour la page node-type-site uniquement
svgElement.addEventListener('click', function(event) {
if (isNodeTypeSitePage) {
if (event.target.classList.contains('site-link')) {
const targetUrl = event.target.getAttribute('data-url');
if (targetUrl) {
window.location.href = targetUrl; // Redirige vers le data-url correspondant
}
// Gérer les clics sur les cercles de la carte
if (svgElement) {
svgElement.addEventListener('click', function(event) {
const target = event.target;
if (!target.classList || !target.classList.contains('site-link')) {
return;
}
// On récupère les URLs
const missionUrl = target.getAttribute('data-mission-photo-url');
const fallbackUrl = target.getAttribute('data-url');
// 1) Page RESSOURCE : priorité à la mission photo
if (isNodeTypeRessourcePage) {
event.preventDefault(); // empêche le <a href="..."> d'agir
if (missionUrl) {
window.location.href = missionUrl; // Aller directement à la mission photo
} else if (fallbackUrl) {
window.location.href = fallbackUrl; // Sinon, on garde le comportement actuel
}
}
if (isNodeTypeProjetPage) {
if (event.target.classList.contains('site-link')) {
const targetUrl = event.target.getAttribute('data-url');
if (targetUrl) {
window.location.href = targetUrl; // Redirige vers le data-url correspondant
}
return;
}
// 2) Page SITE : comportement actuel
if (isNodeTypeSitePage) {
if (fallbackUrl) {
event.preventDefault();
window.location.href = fallbackUrl;
}
}
});
return;
}
// 3) Page PROJET : comportement actuel
if (isNodeTypeProjetPage) {
if (fallbackUrl) {
event.preventDefault();
window.location.href = fallbackUrl;
}
return;
}
// 4) Autres pages : si tu veux un comportement par défaut
// if (fallbackUrl) {
// event.preventDefault();
// window.location.href = fallbackUrl;
// }
});
}
// Fonction pour gérer l'agrandissement de views-row au survol des cercles
if (isLessitesPage) {