|
@@ -43,9 +43,19 @@ class setMarginTexts extends Paged.Handler {
|
|
|
}
|
|
|
// images collées en bas
|
|
|
let bottomImgs = document.querySelectorAll('.bottomimg, .tripleimgs_bottom, .tripleimgs2_bottom');
|
|
|
- for (let i = 0; i < bottomImgs.length; i++) {
|
|
|
- let page = bottomImgs[i].parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode;
|
|
|
- bottomImgs[i].style.transform = 'translateY(' + (page.getBoundingClientRect().bottom - bottomImgs[i].lastElementChild.getBoundingClientRect().bottom) + 'px)';
|
|
|
+ for (let bottomImg of bottomImgs) {
|
|
|
+ let pageBottom = bottomImg.closest('.pagedjs_area').getBoundingClientRect().bottom;
|
|
|
+ bottomImg.style.transform = 'translateY(' + (pageBottom - bottomImg.lastElementChild.getBoundingClientRect().bottom) + 'px)';
|
|
|
+ }
|
|
|
+ let bottomVignettes = document.querySelectorAll('.imgsmall_bottom'); // pour les images en bas dans les pages avec du texte
|
|
|
+ for (let bottomVignette of bottomVignettes) {
|
|
|
+ let pageBottom = bottomVignette.closest('.pagedjs_area').getBoundingClientRect().bottom;
|
|
|
+ let textBottom = bottomVignette.previousElementSibling.getBoundingClientRect().bottom;
|
|
|
+ let vignetteSize = bottomVignette.getBoundingClientRect().height;
|
|
|
+ if (bottomVignette.previousElementSibling.classList.contains('labeur')) {
|
|
|
+ bottomVignette.style.marginTop = `${(pageBottom - textBottom) - vignetteSize}px`;
|
|
|
+ }
|
|
|
+ bottomVignette.style.transform = 'translateY(12px)';
|
|
|
}
|
|
|
// éléments justifiés pas nécessaires
|
|
|
let justifiedSplitEl = document.querySelectorAll("[data-align-last-split-element='justify']");
|
|
@@ -58,10 +68,10 @@ class setMarginTexts extends Paged.Handler {
|
|
|
}
|
|
|
}
|
|
|
// images fullspread
|
|
|
- let fullspreadEl = document.querySelectorAll('.imgfullspreadleft, .imgfullspreadright, .imgfullspreadright_bleedtop, .imgfullspreadright_bleed');
|
|
|
+ let fullspreadEl = document.querySelectorAll('.imgfullspreadleft, .imgfullspreadright, .imgfullspreadright_bleedtop, .imgfullspreadright_bleed, .doublepage_bigleft, .doublepage_bigright');
|
|
|
for (let i = 0; i < fullspreadEl.length; i++) {
|
|
|
let imgSrc = fullspreadEl[i].firstElementChild.getAttribute('src');
|
|
|
- let nextPage = fullspreadEl[i].closest('.pagedjs_page').nextElementSibling.querySelectorAll('.pagedjs_page_content');
|
|
|
+ let nextPage = fullspreadEl[i].closest('.pagedjs_page').nextElementSibling.querySelector('.pagedjs_page_content');
|
|
|
let imgOverflowEl = document.createElement('div');
|
|
|
if (fullspreadEl[i].classList.contains('imgfullspreadleft')) {
|
|
|
imgOverflowEl.setAttribute('class', 'imgfullspreadleft-right');
|
|
@@ -71,18 +81,37 @@ class setMarginTexts extends Paged.Handler {
|
|
|
imgOverflowEl.setAttribute('class', 'imgfullspreadright_bleedtop-right');
|
|
|
} else if (fullspreadEl[i].classList.contains('imgfullspreadright_bleed')) {
|
|
|
imgOverflowEl.setAttribute('class', 'imgfullspreadright_bleed-right');
|
|
|
+ } else if (fullspreadEl[i].classList.contains('doublepage_bigleft')) {
|
|
|
+ imgOverflowEl.setAttribute('class', 'overflow_bigimgleft');
|
|
|
+ } else if (fullspreadEl[i].classList.contains('doublepage_bigright')) {
|
|
|
+ imgOverflowEl.setAttribute('class', 'overflow_bigimgright');
|
|
|
}
|
|
|
let imgOverflow = document.createElement('img');
|
|
|
imgOverflow.src = imgSrc;
|
|
|
imgOverflowEl.append(imgOverflow);
|
|
|
- nextPage[0].append(imgOverflowEl);
|
|
|
+ nextPage.append(imgOverflowEl);
|
|
|
if (fullspreadEl[i].classList.contains('imgfullspreadright')
|
|
|
|| fullspreadEl[i].classList.contains('imgfullspreadright_bleedtop')
|
|
|
|| fullspreadEl[i].classList.contains('imgfullspreadright_bleed')) {
|
|
|
let imgMargin = imgOverflowEl.getBoundingClientRect().right - fullspreadEl[i].firstElementChild.getBoundingClientRect().right;
|
|
|
fullspreadEl[i].firstElementChild.style.marginLeft = imgMargin + 'px';
|
|
|
}
|
|
|
+ if (fullspreadEl[i].classList.contains('doublepage_bigleft') || fullspreadEl[i].classList.contains('doublepage_bigright')) {
|
|
|
+ let smallImgSrc = fullspreadEl[i].lastElementChild.getAttribute('src');
|
|
|
+ fullspreadEl[i].lastElementChild.remove();
|
|
|
+ let smallImg = document.createElement('img');
|
|
|
+ smallImg.setAttribute('src', smallImgSrc);
|
|
|
+ let smallImgEl = document.createElement('div');
|
|
|
+ smallImgEl.classList.add('dp_sm_img');
|
|
|
+ smallImgEl.append(smallImg);
|
|
|
+ if (fullspreadEl[i].classList.contains('doublepage_bigleft')) {
|
|
|
+ nextPage.append(smallImgEl);
|
|
|
+ } else {
|
|
|
+ fullspreadEl[i].parentElement.append(smallImgEl);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
// fullpage img page gauche
|
|
|
let fullPageImg = document.getElementsByClassName('fullpageimage');
|
|
|
for (let i = 0; i < fullPageImg.length; i++) {
|
|
@@ -91,57 +120,43 @@ class setMarginTexts extends Paged.Handler {
|
|
|
fullPageImg[i].style.marginLeft = '-22mm';
|
|
|
}
|
|
|
}
|
|
|
- // 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';
|
|
|
+ // encarts
|
|
|
+ let encarts = document.querySelectorAll('.latour, .lampe, .latour_nohead, .lampe_nohead');
|
|
|
+ for (let encart of encarts) {
|
|
|
+ if (encart.previousElementSibling != null) {
|
|
|
+ encart.style.marginTop = '10mm';
|
|
|
+ }
|
|
|
+ if (encart.nextElementSibling != null) {
|
|
|
+ encart.style.marginBottom = '10mm';
|
|
|
}
|
|
|
- if (encarts[i].hasAttribute('data-split-original')) {
|
|
|
+
|
|
|
+ if (encart.hasAttribute('data-split-to')) {
|
|
|
let plainColor = document.createElement('div');
|
|
|
- let plainHeight = encarts[i]
|
|
|
- .parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode
|
|
|
- .getBoundingClientRect().bottom - encarts[i].getBoundingClientRect().bottom;
|
|
|
plainColor.setAttribute('class', 'encart-split');
|
|
|
- if (encarts[i]
|
|
|
- .parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode
|
|
|
- .classList.contains('pagedjs_right_page')) {
|
|
|
+ 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";
|
|
|
- encarts[i].parentNode.append(plainColor);
|
|
|
- } else if (encarts[i].hasAttribute('data-split-from')) {
|
|
|
+ plainColor.style.height = `${plainHeight}px`;
|
|
|
+ encart.parentNode.append(plainColor);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (encart.hasAttribute('data-split-from')) {
|
|
|
let plainColor = document.createElement('div');
|
|
|
plainColor.setAttribute('class', 'encart-split');
|
|
|
- if (encarts[i]
|
|
|
- .parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode
|
|
|
- .classList.contains('pagedjs_right_page')) {
|
|
|
+ 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";
|
|
|
- encarts[i].parentNode.prepend(plainColor);
|
|
|
- }
|
|
|
-
|
|
|
- if (encarts[i].previousElementSibling === null) {
|
|
|
- encarts[i].style.marginTop = '0';
|
|
|
- if (encarts[i].hasAttribute('data-split-original')) {
|
|
|
- encarts[i].parentElement.style.height = '214mm';
|
|
|
- encarts[i].style.paddingBottom = '0 !important';
|
|
|
- encarts[i].style.height = "100%";
|
|
|
- encarts[i].nextElementSibling.style.height = '22mm';
|
|
|
- encarts[i].nextElementSibling.style.bottom = '-22mm';
|
|
|
- encarts[i].nextElementSibling.style.right = '-28.5mm';
|
|
|
- }
|
|
|
+ encart.parentNode.prepend(plainColor);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// TITRES ATELIERS
|
|
|
let h3s = document.querySelectorAll('h3');
|
|
|
for (let h3 of h3s) {
|
|
@@ -149,7 +164,6 @@ class setMarginTexts extends Paged.Handler {
|
|
|
let coverPhoto;
|
|
|
let photoContainer = h3.nextElementSibling;
|
|
|
if (h3.nextSibling?.children.length === 2) {
|
|
|
- console.log('2 toffs');
|
|
|
coverPhoto = h3.nextElementSibling.children[1];
|
|
|
let coverDessin = document.createElement('img');
|
|
|
coverDessin.setAttribute('src', photoContainer.firstElementChild.getAttribute('src'));
|
|
@@ -158,7 +172,6 @@ class setMarginTexts extends Paged.Handler {
|
|
|
coverDessin.style.height = 'auto';
|
|
|
photoContainer.firstElementChild.remove();
|
|
|
} else {
|
|
|
- console.log('1 toff');
|
|
|
coverPhoto = h3.nextElementSibling.firstChild;
|
|
|
}
|
|
|
photoContainer.style.position = 'absolute';
|
|
@@ -189,8 +202,6 @@ class setMarginTexts extends Paged.Handler {
|
|
|
nextContainer.append(nextImg);
|
|
|
|
|
|
h3.closest('.pagedjs_page').nextElementSibling?.querySelector('.pagedjs_page_content').append(nextContainer);
|
|
|
- } else {
|
|
|
- console.log('0 toff');
|
|
|
}
|
|
|
h3.style.position = 'absolute';
|
|
|
h3.style.top = `${(h3.closest('.pagedjs_page_content').offsetHeight - h3.offsetHeight) / 3}px`;
|
|
@@ -335,7 +346,7 @@ class setMarginTexts extends Paged.Handler {
|
|
|
link.style.color = partieColor;
|
|
|
}
|
|
|
let lightColor = partieColor.slice(0, -1) + ', 0.1)';
|
|
|
- let encarts = page.querySelectorAll('.lampe, .latour, .encart-split');
|
|
|
+ let encarts = page.querySelectorAll('.lampe, .latour, .lampe_nohead, .latour_nohead, .encart-split');
|
|
|
for (let encart of encarts) {
|
|
|
encart.style.backgroundColor = lightColor;
|
|
|
}
|