From a87ab32bcaf9d6729e2cfe8ec9b88d0b8f3d8eb7 Mon Sep 17 00:00:00 2001 From: Valentin Date: Tue, 1 Oct 2024 13:54:28 +0200 Subject: [PATCH] correction couleur icones sur la carte --- web/themes/custom/caravane/assets/js/main.js | 20 ++++++++++++------- .../custom/caravane/assets/scss/main.scss | 2 +- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/web/themes/custom/caravane/assets/js/main.js b/web/themes/custom/caravane/assets/js/main.js index 12275ff..33f54a9 100644 --- a/web/themes/custom/caravane/assets/js/main.js +++ b/web/themes/custom/caravane/assets/js/main.js @@ -152,20 +152,26 @@ import router from './router/router'; const icons = document.querySelectorAll('.leaflet-map-divicon'); for (let icon of icons) { const colorContainer = icon.querySelector('.couleur'); - const colorDiv = colorContainer.querySelector('div > div:nth-of-type(4)'); - const color = colorDiv.innerText.substring(colorDiv.innerText.indexOf('>') + 1, colorDiv.innerText.indexOf('<', colorDiv.innerText.indexOf('>') + 1)).trim(); - console.log(color); - + let colorDivs = colorContainer.querySelectorAll('.separated-content'); + let color; + colorDivs.forEach((div) => { + if (div.innerText.startsWith('
')) { + color = div.innerText; + } + }); + color = color.substring(color.indexOf('>') + 1, color.indexOf('<', color.indexOf('>') + 1)).trim(); const nid = icon.querySelector('.nid'); - const nidValue = nid.querySelector('div > div').innerText; + const nidValue = nid.querySelector('.separated-content').innerText; icon.addEventListener('click', function(event) { store.fetchEtapeData(nidValue); }); - colorContainer.remove(); - nid.remove(); + //colorContainer.remove(); + //nid.remove(); + colorContainer.style.display = "none"; + nid.style.display = "none"; const iconElements = icon.querySelectorAll('div'); for (let iconElement of iconElements) { iconElement.style.backgroundColor = color; diff --git a/web/themes/custom/caravane/assets/scss/main.scss b/web/themes/custom/caravane/assets/scss/main.scss index 1ddaea1..a67e55e 100644 --- a/web/themes/custom/caravane/assets/scss/main.scss +++ b/web/themes/custom/caravane/assets/scss/main.scss @@ -301,7 +301,7 @@ body{ clip-path: polygon(0 0, 100% 0, 50% 100%); transform: rotate(180deg); } - > div:last-of-type { + > div:nth-of-type(3) { height: 8px; clip-path: polygon(0 0, 100% 0, 50% 100%); }