|
@@ -7,15 +7,21 @@ class setMarginTexts extends Paged.Handler {
|
|
|
|
|
|
afterPreview(pages) {
|
|
|
// afficher correctement les éléments en marge
|
|
|
- let topLeftBoxes = document.getElementsByClassName('pagedjs_margin-left-top');
|
|
|
- for (let i = 0; i < topLeftBoxes.length; i++) {
|
|
|
- topLeftBoxes[i].childNodes[0].style.marginTop = topLeftBoxes[i].childNodes[0].offsetWidth / 2 - topLeftBoxes[i].childNodes[0].offsetHeight / 2 + "px";
|
|
|
+ let topLeftBoxes = document.querySelectorAll('.pagedjs_margin-left-top');
|
|
|
+ for (let topLeftBox of topLeftBoxes) {
|
|
|
+ let contentDiv = topLeftBox.firstElementChild;
|
|
|
+ contentDiv.append('Texte marge');
|
|
|
+ contentDiv.style.marginTop = contentDiv.offsetWidth / 2 - contentDiv.offsetHeight / 2 + "px";
|
|
|
}
|
|
|
- let bottomLeftBoxes = document.getElementsByClassName('pagedjs_margin-left-bottom');
|
|
|
- for (let i = 0; i < bottomLeftBoxes.length; i++) {
|
|
|
- bottomLeftBoxes[i].childNodes[0].style.marginBottom = bottomLeftBoxes[i].childNodes[0].offsetWidth / 2 - bottomLeftBoxes[i].childNodes[0].offsetHeight / 2 + "px";
|
|
|
+ let bottomLeftBoxes = document.querySelectorAll('.pagedjs_margin-left-bottom');
|
|
|
+ for (let bottomLeftBox of bottomLeftBoxes) {
|
|
|
+ let contentDiv = bottomLeftBox.firstElementChild;
|
|
|
+ contentDiv.append('Texte marge');
|
|
|
+ contentDiv.style.marginBottom = contentDiv.offsetWidth / 2 - contentDiv.offsetHeight / 2 + "px";
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
// cleaner pour que les paragraphes tombent sur la marge haute
|
|
|
for(let i = 0; i < labeurs.length; i++) {
|
|
|
if (labeurs[i] == labeurs[i].parentNode.firstElementChild
|
|
@@ -90,13 +96,13 @@ class setMarginTexts extends Paged.Handler {
|
|
|
}
|
|
|
}
|
|
|
// encarts bleed
|
|
|
- let encarts = document.querySelectorAll('.latour, .lampe')
|
|
|
- for (let i = 0; i < encarts.length; i++) {
|
|
|
- if (encarts[i].parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode
|
|
|
- .classList.contains('pagedjs_right_page')) {
|
|
|
- encarts[i].style.marginRight = '-22mm';
|
|
|
- encarts[i].style.paddingRight = '22mm';
|
|
|
- }
|
|
|
+ let encarts = document.querySelectorAll('.latour, .lampe');
|
|
|
+ for (let i = 0; i < encarts.length; i++) {
|
|
|
+ if (encarts[i].parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode
|
|
|
+ .classList.contains('pagedjs_right_page')) {
|
|
|
+ encarts[i].style.marginRight = '-22mm';
|
|
|
+ encarts[i].style.paddingRight = '22mm';
|
|
|
+ }
|
|
|
if (encarts[i].hasAttribute('data-split-original')) {
|
|
|
let plainColor = document.createElement('div');
|
|
|
let plainHeight = encarts[i]
|
|
@@ -131,7 +137,7 @@ class setMarginTexts extends Paged.Handler {
|
|
|
// TITRES
|
|
|
let h3s = document.querySelectorAll('h3');
|
|
|
for (let h3 of h3s) {
|
|
|
- if (h3.nextSibling.firstChild.tagName == "IMG") {
|
|
|
+ if (h3.nextSibling?.firstChild.tagName == "IMG") {
|
|
|
h3.style.position = "absolute";
|
|
|
h3.style.top = "40%";
|
|
|
|
|
@@ -176,6 +182,7 @@ class setMarginTexts extends Paged.Handler {
|
|
|
h4.style.color = "#d98a29";
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
// loading
|
|
|
document.querySelector('body').style.opacity = "1";
|
|
|
document.querySelector('body').style.overflow = "scroll";
|