// gestion des encarts splittés if (debug) console.log('start inserts'); (function() { let encarts = document.querySelectorAll('.latour, .lampe, .latour_nohead, .lampe_nohead'); for (let encart of encarts) { if (encart.hasAttribute('data-split-to')) { let plainColor = document.createElement('div'); plainColor.setAttribute('class', 'encart-split'); let plainHeight = encart.closest('.pagedjs_sheet').getBoundingClientRect().bottom - encart.getBoundingClientRect().bottom; if (encart.closest('.pagedjs_page').classList.contains('pagedjs_right_page')) { plainColor.style.width = "149mm"; } else { plainColor.style.width = "129mm"; } plainColor.style.height = `${plainHeight}px`; encart.parentNode.append(plainColor); } if (encart.hasAttribute('data-split-from')) { encart.style.marginTop = "0mm"; let plainColor = document.createElement('div'); plainColor.setAttribute('class', 'encart-split'); if (encart.closest('.pagedjs_page').classList.contains('pagedjs_right_page')) { plainColor.style.width = "149mm"; } else { plainColor.style.width = "129mm"; } plainColor.style.height = "22mm"; plainColor.style.top = "-22mm"; encart.parentNode.prepend(plainColor); } if (encart.previousElementSibling?.classList.contains('breakbefore')) { encart.style.marginTop = "0mm"; } } })(); if (debug) console.log('end inserts');