champs url dans les icones de la map et suppr du data attribute nid sur les liens

This commit is contained in:
Valentin
2024-11-13 11:42:30 +01:00
parent c82fc633aa
commit f2680fc65a
5 changed files with 33 additions and 40 deletions

View File

@@ -4,11 +4,11 @@ import { useLayoutStore } from '../stores/layout';
export async function initFirstLoadRouting(store, router, baseUrl, siteName) {
const decoupled_origin = JSON.parse(window.localStorage.getItem('decoupled_origin'));
if(decoupled_origin) {
if(decoupled_origin) {
await store.fetchContentData(baseUrl + decoupled_origin.url);
router.push(decoupled_origin.url);
window.localStorage.removeItem("decoupled_origin");
document.title = store.pageTitle;
document.title = store.pageTitle;
setActiveNavItem(store.contentType, decoupled_origin.url);
} else {
document.title = siteName;
@@ -29,7 +29,7 @@ export function handleClickableElements(clickableElements, store, router, baseUr
mapStore.resetMap();
} else {
await store.fetchContentData(baseUrl + href);
document.title = store.pageTitle;
document.title = store.pageTitle;
}
setActiveNavItem(store.contentType, href);
@@ -38,4 +38,4 @@ export function handleClickableElements(clickableElements, store, router, baseUr
}
}
}
}
}

View File

@@ -1,5 +1,5 @@
export function processClickableElements() {
return {
return {
etapeListLinks: processEtapeLinks(),
generalListLinks: processStaticLinks(),
logoLink: processLogoLink(),
@@ -26,15 +26,7 @@ function processEtapeLinks() {
function processStaticLinks() {
const general_link_fields = document.querySelectorAll('#menu > ul > li > a');
for (let i = 0; i < general_link_fields.length; i ++) {
let general_link_path = general_link_fields[i].getAttribute('data-drupal-link-system-path');
if (general_link_path && general_link_path !== '<front>') {
const match = [...general_link_path.match(/^node\/(\d+)$/)];
if (match) {
const nid = match[1];
general_link_fields[i].setAttribute('data-nid', parseInt(nid));
}
}
general_link_fields[i].addEventListener('click', (e) => e.preventDefault());
general_link_fields[i].addEventListener('click', (e) => e.preventDefault());
}
return general_link_fields;
@@ -70,11 +62,11 @@ function processMapIcons() {
const popup = document.querySelector('.leaflet-tooltip-center > div');
popup.style.opacity = "1";
});
icon.addEventListener('mouseleave', () => {
icon.style.transform = icon.style.transform.split(' ')[0] + icon.style.transform.split(' ')[1] + icon.style.transform.split(' ')[2];
});
});
}
return icons;
}
}