// créer header icons pour encarts if (debug) console.log('start addInsertIcons'); (function() { let encarts = document.querySelectorAll('.latour, .latour_nohead, .lampe, .lampe_nohead'); for(let encart of encarts) { let headContent = encart.firstChild let headerEl = document.createElement('div'); headerEl.setAttribute('class', 'encart-header') let iconImg = document.createElement('img'); let imgFile = encart.classList.contains('latour') || encart.classList.contains('latour_nohead') ? 'map' : 'lampe'; iconImg.setAttribute('src', `/user/themes/carnet-atterrissage/assets/${ imgFile }.png`); if (encart.classList.contains('latour_nohead') || encart.classList.contains('lampe_nohead')) { headerEl.style.flexDirection = 'column'; headerEl.style.alignItems = 'flex-start'; headerEl.style.fontWeight = 'normal'; encart.style.paddingTop = '5mm'; encart.style.paddingBottom = '5mm'; iconImg.style.marginBottom = '2mm'; iconImg.style.margin = '0'; iconImg.style.marginBottom = '2.5mm'; } headerEl.append(iconImg); headerEl.append(headContent); encart.firstChild?.remove(); encart.prepend(headerEl); if (encart.querySelector('.encart-header').nextElementSibling == null) { encart.querySelector('.encart-header').style.marginBottom = '0'; } } })(); if (debug) console.log('end addInsertIcons');