modif des marges hautes et basses des encarts

This commit is contained in:
Valentin
2023-07-28 02:54:57 +02:00
parent ec262aa48e
commit 903c9a993e
9 changed files with 170 additions and 42 deletions
+50 -11
View File
@@ -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(' :', '&nbsp;:');
encart.innerHTML = encart.innerHTML.replaceAll(' ?', '&nbsp;?');
encart.innerHTML = encart.innerHTML.replaceAll(' !', '&nbsp;!');
encart.innerHTML = encart.innerHTML.replaceAll('« ', '«&nbsp;');
encart.innerHTML = encart.innerHTML.replaceAll(' »', '&nbsp;»');
encart.innerHTML = encart.innerHTML.replaceAll('(« ', '(«&nbsp;');
encart.innerHTML = encart.innerHTML.replaceAll(' »)', '&nbsp;»)');
encart.innerHTML = encart.innerHTML.replaceAll('“', '«&nbsp;');
encart.innerHTML = encart.innerHTML.replaceAll('”', '&nbsp;»');
encart.innerHTML = encart.innerHTML.replaceAll(' min', '&nbsp;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(' :', '&nbsp;:');
contentToParse[i].childNodes[j].innerHTML = contentToParse[i].childNodes[j].innerHTML.replaceAll(' ?', '&nbsp;?');
contentToParse[i].childNodes[j].innerHTML = contentToParse[i].childNodes[j].innerHTML.replaceAll(' !', '&nbsp;!');
contentToParse[i].childNodes[j].innerHTML = contentToParse[i].childNodes[j].innerHTML.replaceAll('« ', '«&nbsp;');
contentToParse[i].childNodes[j].innerHTML = contentToParse[i].childNodes[j].innerHTML.replaceAll(' »', '&nbsp;»');
contentToParse[i].childNodes[j].innerHTML = contentToParse[i].childNodes[j].innerHTML.replaceAll('“', '«&nbsp;');
contentToParse[i].childNodes[j].innerHTML = contentToParse[i].childNodes[j].innerHTML.replaceAll('”', '&nbsp;»');
contentToParse[i].childNodes[j].innerHTML = contentToParse[i].childNodes[j].innerHTML.replaceAll(' min', '&nbsp;min');
}
contentToParse[i].childNodes[j].innerHTML = contentToParse[i].childNodes[j].innerHTML.replaceAll(' :', '&nbsp;:');
contentToParse[i].childNodes[j].innerHTML = contentToParse[i].childNodes[j].innerHTML.replaceAll(' ?', '&nbsp;?');
contentToParse[i].childNodes[j].innerHTML = contentToParse[i].childNodes[j].innerHTML.replaceAll(' !', '&nbsp;!');
contentToParse[i].childNodes[j].innerHTML = contentToParse[i].childNodes[j].innerHTML.replaceAll('« ', '«&nbsp;');
contentToParse[i].childNodes[j].innerHTML = contentToParse[i].childNodes[j].innerHTML.replaceAll(' »', '&nbsp;»');
contentToParse[i].childNodes[j].innerHTML = contentToParse[i].childNodes[j].innerHTML.replaceAll('(« ', '(«&nbsp;');
contentToParse[i].childNodes[j].innerHTML = contentToParse[i].childNodes[j].innerHTML.replaceAll(' »)', '&nbsp;»)');
contentToParse[i].childNodes[j].innerHTML = contentToParse[i].childNodes[j].innerHTML.replaceAll('“', '«&nbsp;');
contentToParse[i].childNodes[j].innerHTML = contentToParse[i].childNodes[j].innerHTML.replaceAll('”', '&nbsp;»');
contentToParse[i].childNodes[j].innerHTML = contentToParse[i].childNodes[j].innerHTML.replaceAll(' min', '&nbsp;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();
}
}