modif des notes
This commit is contained in:
@@ -87,21 +87,10 @@ if (debug) console.log('start colors');
|
||||
if (bibliographie) {
|
||||
bibliographie.style.color = atelierColor;
|
||||
// set bg et sprays
|
||||
let bibliographiePage = bibliographie.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement; // désolé
|
||||
let bibliographiePage = bibliographie.closest('.pagedjs_page');
|
||||
bibliographiePage.style.backgroundColor = bgColor;
|
||||
|
||||
let nextPage;
|
||||
if (bibliographiePage.parentElement.classList.contains('pagedjs_sheet')) {
|
||||
nextPage = bibliographiePage.parentElement?.parentElement?.nextElementSibling?.firstElementChild;
|
||||
} else {
|
||||
nextPage = bibliographiePage.parentElement?.nextElementSibling?.firstElementChild;
|
||||
}
|
||||
|
||||
if (!bibliographie.closest('.pagedjs_page').previousElementSibling.querySelector('.bibliographie')) {
|
||||
if (nextPage) {
|
||||
nextPage.style.backgroundColor = bgColor;
|
||||
}
|
||||
|
||||
if (bibliographiePage.classList.contains('pagedjs_left_page')) {
|
||||
let sprayImg = document.createElement('img');
|
||||
sprayImg.setAttribute('src', sprays[atelierIndex - 1]);
|
||||
sprayImg.style.height = "242mm";
|
||||
@@ -110,13 +99,12 @@ if (debug) console.log('start colors');
|
||||
sprayImg.style.top = "-22mm";
|
||||
sprayImg.style.right = "-20mm";
|
||||
sprayImg.style.mixBlendMode = "multiply";
|
||||
sprayImg.style.opacity = "0.75";
|
||||
|
||||
let nextBiblioPageEl = bibliographiePage.parentElement.nextElementSibling?.querySelector('.bibliographie');
|
||||
if (nextBiblioPageEl) {
|
||||
bibliographiePage.parentElement.nextElementSibling?.querySelector('.bibliographie').insertAdjacentElement("afterend", sprayImg);
|
||||
} else {
|
||||
bibliographiePage.parentElement.parentElement.nextElementSibling?.querySelector('.pagedjs_page_content').appendChild(sprayImg);
|
||||
if (!bibliographiePage.nextElementSibling.querySelector('.bibliographie')) {
|
||||
bibliographiePage.nextElementSibling.style.backgroundColor = bgColor;
|
||||
}
|
||||
bibliographiePage.nextElementSibling.querySelector('.pagedjs_page_content').appendChild(sprayImg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -48,8 +48,8 @@ if (debug) console.log('start imgsFullspread');
|
||||
}
|
||||
if (fullspreadEl.classList.contains('doublepage_bigleft')
|
||||
|| fullspreadEl.classList.contains('doublepage_bigright')) {
|
||||
let smallImgSrc = fullspreadEl.lastElementChild?.getAttribute('src');
|
||||
fullspreadEl.lastElementChild?.remove();
|
||||
let smallImgSrc = fullspreadEl.querySelector('img:last-of-type')?.getAttribute('src');
|
||||
fullspreadEl.querySelector('img:last-of-type')?.remove();
|
||||
let smallImg = document.createElement('img');
|
||||
smallImg.setAttribute('src', smallImgSrc);
|
||||
let smallImgEl = document.createElement('div');
|
||||
|
||||
@@ -32,6 +32,10 @@ if (debug) console.log('start inserts');
|
||||
plainColor.style.top = "-22mm";
|
||||
encart.parentNode.prepend(plainColor);
|
||||
}
|
||||
|
||||
if (encart.previousElementSibling?.classList.contains('breakbefore')) {
|
||||
encart.style.marginTop = "0mm";
|
||||
}
|
||||
}
|
||||
|
||||
})();
|
||||
|
||||
@@ -6,33 +6,37 @@ if (debug) console.log('start addInsertIcons');
|
||||
let encarts = document.querySelectorAll('.latour, .latour_nohead, .lampe, .lampe_nohead');
|
||||
|
||||
for(let encart of encarts) {
|
||||
let headContent = encart.firstChild
|
||||
let headerEl = document.createElement('div');
|
||||
headerEl.setAttribute('class', 'encart-header')
|
||||
let iconImg = document.createElement('img');
|
||||
let imgFile = encart.classList.contains('latour') || encart.classList.contains('latour_nohead') ? 'map' : 'lampe';
|
||||
iconImg.setAttribute('src', `/user/themes/carnet-atterrissage/assets/${ imgFile }.png`);
|
||||
|
||||
if (encart.classList.contains('latour_nohead') || encart.classList.contains('lampe_nohead')) {
|
||||
headerEl.style.flexDirection = 'column';
|
||||
headerEl.style.alignItems = 'flex-start';
|
||||
headerEl.style.fontWeight = 'normal';
|
||||
encart.style.paddingTop = '5mm';
|
||||
encart.style.paddingBottom = '5mm';
|
||||
iconImg.style.marginBottom = '2mm';
|
||||
iconImg.style.margin = '0';
|
||||
iconImg.style.marginBottom = '2.5mm';
|
||||
}
|
||||
|
||||
headerEl.append(iconImg);
|
||||
headerEl.append(headContent);
|
||||
|
||||
encart.firstChild?.remove();
|
||||
encart.prepend(headerEl);
|
||||
|
||||
if (encart.querySelector('.encart-header').nextElementSibling == null) {
|
||||
encart.querySelector('.encart-header').style.marginBottom = '0';
|
||||
if (encart.innerHTML.indexOf("<") === -1) {
|
||||
encart.innerHTML = '<p>' + encart.innerHTML;
|
||||
encart.innerHTML = encart.innerHTML + '</p>';
|
||||
} else {
|
||||
// to check if the first tag is a span
|
||||
if (encart.innerHTML, encart.innerHTML[encart.innerHTML.indexOf("<") + 1] === 's') {
|
||||
encart.innerHTML = encart.innerHTML.substring(0, encart.innerHTML.indexOf('</span>') + 7) + '</p>' + encart.innerHTML.substring(encart.innerHTML.indexOf('</span>') + 7);
|
||||
} else {
|
||||
encart.innerHTML = encart.innerHTML.substring(0, encart.innerHTML.indexOf('<')) + '</p>' + encart.innerHTML.substring(encart.innerHTML.indexOf('<'));
|
||||
}
|
||||
encart.innerHTML = '<p>' + encart.innerHTML;
|
||||
}
|
||||
|
||||
let headContent = encart.firstElementChild;
|
||||
let iconImg = document.createElement('img');
|
||||
let imgFile = encart.classList.contains('latour') || encart.classList.contains('latour_nohead') ? 'map' : 'lampe';
|
||||
iconImg.setAttribute('src', `/user/themes/carnet-atterrissage/assets/${ imgFile }.png`);
|
||||
|
||||
if (encart.classList.contains('latour_nohead') || encart.classList.contains('lampe_nohead')) {
|
||||
encart.prepend(iconImg);
|
||||
iconImg.style.marginTop = '3mm';
|
||||
iconImg.style.width = '8mm';
|
||||
} else {
|
||||
headContent.prepend(iconImg);
|
||||
headContent.classList.add('encart-header');
|
||||
}
|
||||
|
||||
if (encart.querySelector('.encart-header')
|
||||
&& encart.querySelector('.encart-header')?.nextElementSibling == null) {
|
||||
encart.querySelector('.encart-header').style.marginBottom = '0';
|
||||
}
|
||||
}
|
||||
|
||||
})();
|
||||
|
||||
@@ -67,7 +67,7 @@ if (debug) console.log('start footnotes');
|
||||
let partie = 0;
|
||||
let notes = document.querySelectorAll('.note');
|
||||
let noteTitleNextEl;
|
||||
let prevNoteContent;
|
||||
let notesContent = [];
|
||||
|
||||
for (let note of notes) {
|
||||
let currentPartie = findH3InAncestorsAndSiblings(note, false);
|
||||
@@ -82,31 +82,35 @@ if (debug) console.log('start footnotes');
|
||||
// insert before the next partie page
|
||||
findH3InAncestorsAndSiblings(note, true).parentNode.insertBefore(notePageTitle, findH3InAncestorsAndSiblings(note, true));
|
||||
noteNumber = 1;
|
||||
notesContent = [];
|
||||
partie++;
|
||||
notePageTitle.setAttribute('id', 'note_page_title_' + partie);
|
||||
noteTitleNextEl = document.getElementById(`note_page_title_${partie}`).nextElementSibling;
|
||||
let notesContentEl = document.createElement('div');
|
||||
notesContentEl.setAttribute('id', `notes_content_${partie}`);
|
||||
notesContentEl.classList.add('note_text');
|
||||
noteTitleNextEl.parentNode.insertBefore(notesContentEl, noteTitleNextEl);
|
||||
}
|
||||
|
||||
if (noteContent != prevNoteContent) {
|
||||
|
||||
if (!notesContent.includes(noteContent)) {
|
||||
notesContent.push(noteContent);
|
||||
let noteTextEl = document.createElement('p');
|
||||
noteTextEl.setAttribute('class', 'note_text');
|
||||
noteTextEl.innerHTML = '<span class="note_texte_number">' + noteNumber + '</span><span> ' + noteContent + '</span>';
|
||||
noteTextEl.innerHTML = `<p class="note_content_${ notesContent.length }"><span class="note_texte_number">` + noteNumber + '</span><span> ' + noteContent + '</span></p>';
|
||||
let notesContentEl = document.getElementById(`notes_content_${partie}`);
|
||||
notesContentEl.append(noteTextEl);
|
||||
} else {
|
||||
// si les notes qui se suivent ont le même contenu
|
||||
let notesContentEl = document.getElementById(`notes_content_${partie}`);
|
||||
let lastSpan = notesContentEl.querySelector('p:last-of-type span:last-of-type');
|
||||
let numberToAdd = document.createElement('span');
|
||||
numberToAdd.setAttribute('class', 'note_texte_number');
|
||||
numberToAdd.innerText = `, ${noteNumber}`;
|
||||
notesContentEl.querySelector('p:last-of-type').insertBefore(numberToAdd, lastSpan);
|
||||
let notesPageEl = document.querySelector(`#notes_content_${partie}`);
|
||||
let noteContentEl = notesPageEl.querySelector(`.note_content_${notesContent.indexOf(noteContent) + 1}`);
|
||||
console.log(noteContentEl);
|
||||
let spanToAdd = document.createElement('span');
|
||||
spanToAdd.classList.add('note_texte_number');
|
||||
spanToAdd.innerText = `, ${ noteNumber }`;
|
||||
let lastSpan = noteContentEl.lastElementChild.previousElementSibling;
|
||||
console.log(lastSpan, spanToAdd, noteContent);
|
||||
lastSpan.append(spanToAdd);
|
||||
}
|
||||
|
||||
prevNoteContent = noteContent;
|
||||
|
||||
prevPartie = currentPartie;
|
||||
|
||||
if (isImgNote(note)) {
|
||||
|
||||
@@ -2,39 +2,21 @@
|
||||
if (debug) console.log('start nonBreakingSpaces');
|
||||
|
||||
(function() {
|
||||
let contentsToClean = document.querySelectorAll('.labeur, .free, .latour, .latour_nohead, .lampe, .lampe_nohead, .bibliographie');
|
||||
let contentsToClean = document.querySelectorAll('.labeur, .free, .latour, .latour_nohead, .lampe, .lampe_nohead, .bibliographie, .citation');
|
||||
|
||||
for (let content of contentsToClean) {
|
||||
content.innerHTML = content.innerHTML.replaceAll(' :', ' :');
|
||||
content.innerHTML = content.innerHTML.replaceAll(' ?', ' ?');
|
||||
content.innerHTML = content.innerHTML.replaceAll(' !', ' !');
|
||||
content.innerHTML = content.innerHTML.replaceAll('« ', '« ');
|
||||
content.innerHTML = content.innerHTML.replaceAll(' »', ' »');
|
||||
content.innerHTML = content.innerHTML.replaceAll('(« ', '(« ');
|
||||
content.innerHTML = content.innerHTML.replaceAll(' »)', ' »)');
|
||||
content.innerHTML = content.innerHTML.replaceAll('“', '« ');
|
||||
content.innerHTML = content.innerHTML.replaceAll('”', ' »');
|
||||
content.innerHTML = content.innerHTML.replaceAll(' min', ' min');
|
||||
content.innerHTML = content.innerHTML.replaceAll(' ;', ' ;');
|
||||
content.innerHTML = content.innerHTML.replaceAll(' :', ' :');
|
||||
content.innerHTML = content.innerHTML.replaceAll(' ?', ' ?');
|
||||
content.innerHTML = content.innerHTML.replaceAll(' !', ' !');
|
||||
content.innerHTML = content.innerHTML.replaceAll('« ', '« ');
|
||||
content.innerHTML = content.innerHTML.replaceAll(' »', ' »');
|
||||
content.innerHTML = content.innerHTML.replaceAll('(« ', '(« ');
|
||||
content.innerHTML = content.innerHTML.replaceAll(' »)', ' »)');
|
||||
content.innerHTML = content.innerHTML.replaceAll('“', '« ');
|
||||
content.innerHTML = content.innerHTML.replaceAll('”', ' »');
|
||||
content.innerHTML = content.innerHTML.replaceAll(' min', ' min');
|
||||
}
|
||||
})();
|
||||
|
||||
if (debug) console.log('end nonBreakingSpaces');
|
||||
|
||||
|
||||
/*
|
||||
// micro-typo
|
||||
for(let 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('“', '« ');
|
||||
contentToParse[i].childNodes[j].innerHTML = contentToParse[i].childNodes[j].innerHTML.replaceAll('”', ' »');
|
||||
contentToParse[i].childNodes[j].innerHTML = contentToParse[i].childNodes[j].innerHTML.replaceAll(' min', ' min');
|
||||
}
|
||||
} */
|
||||
if (debug) console.log('end nonBreakingSpaces');
|
||||
@@ -34,7 +34,8 @@ if (debug) console.log('start tagToClass');
|
||||
'breakbefore',
|
||||
'breakafter',
|
||||
`doublepage_bigright`,
|
||||
`doublepage_bigleft`
|
||||
`doublepage_bigleft`,
|
||||
`screenshot`,
|
||||
];
|
||||
|
||||
let bodyContent = $('#body').html();
|
||||
|
||||
@@ -45,6 +45,8 @@ if (debug) console.log('start pagesToDisplay');
|
||||
uiContent.append(pagesToDisplayContainer);
|
||||
|
||||
function displayPagesRange(start, end) {
|
||||
start = parseInt(start);
|
||||
end = parseInt(end);
|
||||
let pages = document.querySelectorAll('.pagedjs_page');
|
||||
|
||||
if (/^\d+$/.test(start) && /^\d+$/.test(end) && start <= pages.length && end <= pages.length && start < end) {
|
||||
|
||||
@@ -8,9 +8,9 @@ if (debug) console.log('start toggleUiWhenPrinting');
|
||||
uiContainer.style.display = "none";
|
||||
});
|
||||
|
||||
window.addEventListener("afterprint", (event) => {
|
||||
uiContainer.style.display = "block";
|
||||
});
|
||||
window.addEventListener("afterprint", (event) => {
|
||||
uiContainer.style.display = "block";
|
||||
});
|
||||
|
||||
})();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user