Compare commits
2 Commits
bddb4b2088
...
f9c98d6941
Author | SHA1 | Date |
---|---|---|
Valentin | f9c98d6941 | |
Valentin | 9f8f9f3a62 |
|
@ -53,6 +53,8 @@ import router from './router/router';
|
|||
const mapStore = useMapStore();
|
||||
app.mount('#content-modale');
|
||||
|
||||
setHamburgerWhenLogged();
|
||||
|
||||
Drupal.behaviors.customLeafletInteraction = {
|
||||
attach: function(context, settings) {
|
||||
$(context).on('leafletMapInit', function (e, settings, map, mapid, markers) {
|
||||
|
@ -97,11 +99,13 @@ import router from './router/router';
|
|||
|
||||
function processStaticLinks(store, map) {
|
||||
let general_link_fields = document.querySelectorAll('#menu > ul > li > a');
|
||||
for (let field of general_link_fields) {
|
||||
let general_link_href = field.getAttribute('href');
|
||||
for (let i =1; i < general_link_fields.length; i ++) {
|
||||
let general_link_href = general_link_fields[i].getAttribute('href');
|
||||
const nid = general_link_href.charAt(general_link_href.length-1);
|
||||
field.setAttribute('data-node-nid', parseInt(nid));
|
||||
field.addEventListener('click', (e) => onClickContentLink(e, store, map, 'static'));
|
||||
if (!isNaN(nid)) {
|
||||
general_link_fields[i].setAttribute('data-node-nid', parseInt(nid));
|
||||
general_link_fields[i].addEventListener('click', (e) => onClickContentLink(e, store, map, 'static'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -162,6 +166,20 @@ import router from './router/router';
|
|||
})
|
||||
}
|
||||
|
||||
function setHamburgerWhenLogged() {
|
||||
if (drupalSettings.user.uid != 0) {
|
||||
const menuBurger = document.querySelector('#hamburger');
|
||||
const menuTitle = document.querySelector('#menu-title');
|
||||
const menuContainer = document.querySelector('#block-caravane-mainnavigation > #menu > ul');
|
||||
const header = document.querySelector('.dialog-off-canvas-main-canvas');
|
||||
const headerTop = header.getBoundingClientRect().top;
|
||||
|
||||
menuTitle.style.top = `${headerTop}px`;
|
||||
menuBurger.style.top = `${headerTop}px`;
|
||||
menuContainer.style.paddingTop = `${headerTop}px`;
|
||||
}
|
||||
}
|
||||
|
||||
function setupEtapeMapPopup(store, map) {
|
||||
const icons = document.querySelectorAll('.leaflet-map-divicon');
|
||||
for (let icon of icons) {
|
||||
|
|
|
@ -138,15 +138,8 @@ const handleMapMovement = () => {
|
|||
watch(
|
||||
() => href.value,
|
||||
() => {
|
||||
console.log("NEW HREF");
|
||||
console.log(href.value);
|
||||
|
||||
isModaleEtape = !isObjectEmpty(etape.value);
|
||||
|
||||
console.log("CAS 1", !wasModaleEtape && isModaleEtape);
|
||||
console.log("CAS 2", wasModaleEtape && isModaleEtape);
|
||||
console.log("CAS 3", wasModaleEtape && !isModaleEtape);
|
||||
|
||||
if (!wasModaleEtape && isModaleEtape) {
|
||||
document.documentElement.style.setProperty('--modale-enter-delay', `${duration.value}s`);
|
||||
mapState.zoomToPlace(map.value, etape.value.coordinates.lat, etape.value.coordinates.lon);
|
||||
|
|
Loading…
Reference in New Issue