modif des marges hautes et basses des encarts
This commit is contained in:
@@ -57,7 +57,10 @@ class setMarginTexts extends Paged.Handler {
|
||||
let vignetteSize = bottomVignette.getBoundingClientRect().height;
|
||||
if (bottomVignette.previousElementSibling) {
|
||||
let textBottom = bottomVignette.previousElementSibling.getBoundingClientRect().bottom;
|
||||
if (bottomVignette.previousElementSibling.classList.contains('labeur')) {
|
||||
if (bottomVignette.previousElementSibling.classList.contains('labeur') ||
|
||||
bottomVignette.previousElementSibling.classList.contains('citation') ||
|
||||
bottomVignette.previousElementSibling.classList.contains('free') ||
|
||||
bottomVignette.previousElementSibling.classList.contains('temps')) {
|
||||
bottomVignette.style.marginTop = `${(pageBottom - textBottom) - vignetteSize}px`;
|
||||
}
|
||||
bottomVignette.style.transform = 'translateY(12px)';
|
||||
@@ -132,12 +135,13 @@ class setMarginTexts extends Paged.Handler {
|
||||
// encarts
|
||||
let encarts = document.querySelectorAll('.latour, .lampe, .latour_nohead, .lampe_nohead');
|
||||
for (let encart of encarts) {
|
||||
if (encart.previousElementSibling != null) {
|
||||
/* if (encart.previousElementSibling != null) {
|
||||
encart.style.marginTop = '10mm';
|
||||
}
|
||||
if (encart.nextElementSibling != null) {
|
||||
encart.style.marginBottom = '10mm';
|
||||
}
|
||||
*/
|
||||
|
||||
if (encart.hasAttribute('data-split-to')) {
|
||||
let plainColor = document.createElement('div');
|
||||
@@ -153,6 +157,7 @@ class setMarginTexts extends Paged.Handler {
|
||||
}
|
||||
|
||||
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')) {
|
||||
@@ -169,7 +174,7 @@ class setMarginTexts extends Paged.Handler {
|
||||
// TITRES ATELIERS
|
||||
let h3s = document.querySelectorAll('h3');
|
||||
for (let h3 of h3s) {
|
||||
if (h3.nextSibling?.firstChild.tagName === "IMG") {
|
||||
if (h3.nextSibling?.firstChild?.tagName === "IMG") {
|
||||
let coverPhoto;
|
||||
let photoContainer = h3.nextElementSibling;
|
||||
if (h3.nextSibling?.children.length === 2) {
|
||||
@@ -327,6 +332,23 @@ class setMarginTexts extends Paged.Handler {
|
||||
'#cb8e31'
|
||||
]
|
||||
|
||||
let sprays = [
|
||||
'/user/themes/carnet-atterrissage/assets/sprays/spary_couleurs-page001.png',
|
||||
'/user/themes/carnet-atterrissage/assets/sprays/spary_couleurs-page002.png',
|
||||
'/user/themes/carnet-atterrissage/assets/sprays/spary_couleurs-page003.png',
|
||||
'/user/themes/carnet-atterrissage/assets/sprays/spary_couleurs-page004.png',
|
||||
'/user/themes/carnet-atterrissage/assets/sprays/spary_couleurs-page005.png',
|
||||
'/user/themes/carnet-atterrissage/assets/sprays/spary_couleurs-page006.png',
|
||||
'/user/themes/carnet-atterrissage/assets/sprays/spary_couleurs-page007.png',
|
||||
'/user/themes/carnet-atterrissage/assets/sprays/spary_couleurs-page008.png',
|
||||
'/user/themes/carnet-atterrissage/assets/sprays/spary_couleurs-page009.png',
|
||||
'/user/themes/carnet-atterrissage/assets/sprays/spary_couleurs-page010.png',
|
||||
'/user/themes/carnet-atterrissage/assets/sprays/spary_couleurs-page011.png',
|
||||
'/user/themes/carnet-atterrissage/assets/sprays/spary_couleurs-page012.png',
|
||||
'/user/themes/carnet-atterrissage/assets/sprays/spary_couleurs-page013.png',
|
||||
'/user/themes/carnet-atterrissage/assets/sprays/spary_couleurs-page014.png'
|
||||
]
|
||||
|
||||
// set all colors
|
||||
let allPages = document.querySelectorAll('.pagedjs_page');
|
||||
let atelierColor = '';
|
||||
@@ -347,6 +369,27 @@ class setMarginTexts extends Paged.Handler {
|
||||
if (pageCounter) {
|
||||
pageCounter.style.color = atelierColor;
|
||||
}
|
||||
let citations = page.querySelectorAll('.citation');
|
||||
for (let citation of citations) {
|
||||
// dessiner et colorer les guillemets
|
||||
if (citation.innerText.charAt(0) === '“') {
|
||||
citation.innerText = citation.innerText.substring(1);
|
||||
}
|
||||
if (citation.innerText.charAt(citation.innerText.length - 1) === '”') {
|
||||
citation.innerText = citation.innerText.substring(0, citation.innerText.length - 1);
|
||||
}
|
||||
let guillemetOuvrant = document.createElement('div');
|
||||
guillemetOuvrant.innerText = '“';
|
||||
guillemetOuvrant.style.color = atelierColor;
|
||||
guillemetOuvrant.classList.add('guillement_ouvrant');
|
||||
citation.prepend(guillemetOuvrant);
|
||||
|
||||
let guillemetFermant = document.createElement('div');
|
||||
guillemetFermant.innerText = '”';
|
||||
guillemetFermant.style.color = atelierColor;
|
||||
guillemetFermant.classList.add('guillement_fermant');
|
||||
citation.append(guillemetFermant);
|
||||
}
|
||||
let atelierTitle = page.querySelector('h3');
|
||||
if (atelierTitle) {
|
||||
atelierTitle.style.color = atelierColor;
|
||||
@@ -358,24 +401,33 @@ class setMarginTexts extends Paged.Handler {
|
||||
let bibliographiePage = bibliographie.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement;
|
||||
bibliographiePage.style.backgroundColor = bgColor;
|
||||
let nextPage = bibliographiePage.parentElement?.nextElementSibling?.firstElementChild;
|
||||
if (nextPage) {
|
||||
nextPage.style.backgroundColor = bgColor;
|
||||
if (!bibliographie.closest('.pagedjs_page').previousElementSibling.querySelector('.bibliographie')) {
|
||||
if (nextPage) {
|
||||
nextPage.style.backgroundColor = bgColor;
|
||||
}
|
||||
let sprayImg = document.createElement('img');
|
||||
sprayImg.setAttribute('src', sprays[atelierIndex]);
|
||||
sprayImg.style.height = "242mm";
|
||||
sprayImg.style.width = "60mm";
|
||||
sprayImg.style.position = "absolute";
|
||||
sprayImg.style.top = "-22mm";
|
||||
sprayImg.style.right = "-20mm";
|
||||
sprayImg.style.mixBlendMode = "multiply";
|
||||
bibliographiePage.parentElement.nextElementSibling?.querySelector('.bibliographie').insertAdjacentElement("afterend", sprayImg);
|
||||
}
|
||||
let sprayImg = document.createElement('img');
|
||||
sprayImg.setAttribute('src', '/user/themes/carnet-atterrissage/assets/sprays/spary_couleurs-page001.png');
|
||||
sprayImg.style.height = "242mm";
|
||||
sprayImg.style.width = "60mm";
|
||||
sprayImg.style.position = "absolute";
|
||||
sprayImg.style.top = "-22mm";
|
||||
sprayImg.style.right = "-20mm";
|
||||
sprayImg.style.mixBlendMode = "multiply";
|
||||
bibliographiePage.parentElement.nextElementSibling?.querySelector('.pagedjs_page_content').prepend(sprayImg);
|
||||
|
||||
}
|
||||
let h4 = page.querySelector('h4');
|
||||
if (h4 && h4?.nextElementSibling?.classList.contains('bibliographie')) {
|
||||
h4.style.color = atelierColor;
|
||||
}
|
||||
let serpentins = document.querySelectorAll('img[alt="serpentin"]');
|
||||
for (let serpentin of serpentins) {
|
||||
let page = serpentin.closest('.pagedjs_page');
|
||||
let nextPage = page.nextElementSibling;
|
||||
page.style.backgroundColor = "rgb(245, 245, 245)";
|
||||
nextPage.style.backgroundColor = "rgb(245, 245, 245)";
|
||||
}
|
||||
let links = page.querySelectorAll('a');
|
||||
for (let link of links) {
|
||||
link.style.color = atelierColor;
|
||||
|
||||
@@ -14,6 +14,7 @@ let baliseWords = [
|
||||
'lampe_nohead',
|
||||
'bibliographie',
|
||||
'imgsmall',
|
||||
'imgsmallsmall',
|
||||
'imgsmall_bottom',
|
||||
'fullpage2imgs',
|
||||
'fullpageimage',
|
||||
@@ -60,7 +61,7 @@ for(let i = 0; i < moments.length; i++) {
|
||||
|
||||
// cleaner le balisage des éléments contenant plusieurs paragraphes
|
||||
let contentToParse = [];
|
||||
let labeurs = document.querySelectorAll('.labeur');
|
||||
let labeurs = document.querySelectorAll('.labeur, .free');
|
||||
for(let labeur of labeurs) {
|
||||
contentToParse.push(labeur);
|
||||
}
|
||||
@@ -68,7 +69,17 @@ for(let labeur of labeurs) {
|
||||
// créer header icons pour encarts
|
||||
let encarts = document.querySelectorAll('.latour, .latour_nohead, .lampe, .lampe_nohead');
|
||||
for(let encart of encarts) {
|
||||
contentToParse.push(encart);
|
||||
|
||||
encart.innerHTML = encart.innerHTML.replaceAll(' :', ' :');
|
||||
encart.innerHTML = encart.innerHTML.replaceAll(' ?', ' ?');
|
||||
encart.innerHTML = encart.innerHTML.replaceAll(' !', ' !');
|
||||
encart.innerHTML = encart.innerHTML.replaceAll('« ', '« ');
|
||||
encart.innerHTML = encart.innerHTML.replaceAll(' »', ' »');
|
||||
encart.innerHTML = encart.innerHTML.replaceAll('(« ', '(« ');
|
||||
encart.innerHTML = encart.innerHTML.replaceAll(' »)', ' »)');
|
||||
encart.innerHTML = encart.innerHTML.replaceAll('“', '« ');
|
||||
encart.innerHTML = encart.innerHTML.replaceAll('”', ' »');
|
||||
encart.innerHTML = encart.innerHTML.replaceAll(' min', ' min');
|
||||
|
||||
let headContent = encart.firstChild
|
||||
let headerEl = document.createElement('div');
|
||||
@@ -100,6 +111,21 @@ for(let encart of encarts) {
|
||||
if (encart.querySelector('.encart-header').nextElementSibling == null) {
|
||||
encart.querySelector('.encart-header').style.marginBottom = '0';
|
||||
}
|
||||
|
||||
/* console.log(encart.nextElementSibling);
|
||||
if (encart.nextElementSibling?.classList.contains('moment')) {
|
||||
console.log('BAAAAAAAAH');
|
||||
encart.style.color = 'red';
|
||||
}
|
||||
*/}
|
||||
|
||||
// clean bibliographie
|
||||
let bibliographies = document.querySelectorAll('.bibliographie');
|
||||
for (let bibliographie of bibliographies) {
|
||||
contentToParse.push(bibliographie);
|
||||
if (bibliographie.nextElementSibling.innerText === "") {
|
||||
bibliographie.nextElementSibling.remove();
|
||||
}
|
||||
}
|
||||
|
||||
for(let i = 0; i < contentToParse.length; i++) {
|
||||
@@ -113,15 +139,17 @@ for(let i = 0; i < contentToParse.length; i++) {
|
||||
for(j = 0; j < contentToParse[i].childNodes.length; j++) {
|
||||
let contentHTML = contentToParse[i].childNodes[j].innerHTML;
|
||||
if (contentHTML != undefined) {
|
||||
contentToParse[i].childNodes[j].innerHTML = contentToParse[i].childNodes[j].innerHTML.replaceAll(' :', ' :');
|
||||
contentToParse[i].childNodes[j].innerHTML = contentToParse[i].childNodes[j].innerHTML.replaceAll(' ?', ' ?');
|
||||
contentToParse[i].childNodes[j].innerHTML = contentToParse[i].childNodes[j].innerHTML.replaceAll(' !', ' !');
|
||||
contentToParse[i].childNodes[j].innerHTML = contentToParse[i].childNodes[j].innerHTML.replaceAll('« ', '« ');
|
||||
contentToParse[i].childNodes[j].innerHTML = contentToParse[i].childNodes[j].innerHTML.replaceAll(' »', ' »');
|
||||
contentToParse[i].childNodes[j].innerHTML = contentToParse[i].childNodes[j].innerHTML.replaceAll('“', '« ');
|
||||
contentToParse[i].childNodes[j].innerHTML = contentToParse[i].childNodes[j].innerHTML.replaceAll('”', ' »');
|
||||
contentToParse[i].childNodes[j].innerHTML = contentToParse[i].childNodes[j].innerHTML.replaceAll(' min', ' min');
|
||||
}
|
||||
contentToParse[i].childNodes[j].innerHTML = contentToParse[i].childNodes[j].innerHTML.replaceAll(' :', ' :');
|
||||
contentToParse[i].childNodes[j].innerHTML = contentToParse[i].childNodes[j].innerHTML.replaceAll(' ?', ' ?');
|
||||
contentToParse[i].childNodes[j].innerHTML = contentToParse[i].childNodes[j].innerHTML.replaceAll(' !', ' !');
|
||||
contentToParse[i].childNodes[j].innerHTML = contentToParse[i].childNodes[j].innerHTML.replaceAll('« ', '« ');
|
||||
contentToParse[i].childNodes[j].innerHTML = contentToParse[i].childNodes[j].innerHTML.replaceAll(' »', ' »');
|
||||
contentToParse[i].childNodes[j].innerHTML = contentToParse[i].childNodes[j].innerHTML.replaceAll('(« ', '(« ');
|
||||
contentToParse[i].childNodes[j].innerHTML = contentToParse[i].childNodes[j].innerHTML.replaceAll(' »)', ' »)');
|
||||
contentToParse[i].childNodes[j].innerHTML = contentToParse[i].childNodes[j].innerHTML.replaceAll('“', '« ');
|
||||
contentToParse[i].childNodes[j].innerHTML = contentToParse[i].childNodes[j].innerHTML.replaceAll('”', ' »');
|
||||
contentToParse[i].childNodes[j].innerHTML = contentToParse[i].childNodes[j].innerHTML.replaceAll(' min', ' min');
|
||||
}
|
||||
}
|
||||
|
||||
// data align last split
|
||||
@@ -152,6 +180,7 @@ for (let h3 of h3s) {
|
||||
return `<div class="gros-chiffre">${match}</div>`;
|
||||
});
|
||||
}
|
||||
h3.innerHTML = h3.innerHTML.replace(/ \«/g, '<br>«');
|
||||
}
|
||||
|
||||
let dessinsPreH3 = document.querySelectorAll('h3 + p img');
|
||||
@@ -159,3 +188,13 @@ for (let dessin of dessinsPreH3) {
|
||||
dessin.style.width = '0px';
|
||||
dessin.style.height = '0px';
|
||||
}
|
||||
|
||||
// pour les serpentins
|
||||
let h4s = document.querySelectorAll('h4');
|
||||
for (let h4 of h4s) {
|
||||
if (h4.innerText === "Serpentin") {
|
||||
let serpentin = h4.nextElementSibling.nextElementSibling;
|
||||
serpentin.nextElementSibling.remove();
|
||||
h4.remove();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user