modif des notes
This commit is contained in:
@@ -10,6 +10,11 @@ img {
|
||||
.imgsmallsmall {
|
||||
padding-left: calc((var(--pagedjs-pagebox-width) / var(--cols)) + 10mm);
|
||||
}
|
||||
|
||||
.screenshot {
|
||||
padding-left: calc((var(--pagedjs-pagebox-width) / var(--cols)) + 6mm);
|
||||
padding-right: 16mm;
|
||||
}
|
||||
|
||||
.imgsmall_bottom {
|
||||
break-after: page;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
.latour_nohead, .lampe_nohead {
|
||||
font-family: 'Novel';
|
||||
font-weight: normal;
|
||||
margin-top: 5mm !important;
|
||||
margin-top: 5mm;
|
||||
margin-left: calc(var(--pagedjs-pagebox-width) / var(--cols));
|
||||
margin-right: -16mm;
|
||||
margin-bottom: 5mm;
|
||||
@@ -17,8 +17,9 @@
|
||||
max-height: 198mm;
|
||||
}
|
||||
|
||||
.pagedjs_page_content section div div div div:first-child:is(.latour),
|
||||
.pagedjs_page_content section div div div div:nth-child(2):is(.latour[data-split-from]) {
|
||||
.pagedjs_page_content section div div div div:first-child:is(.latour, .lampe, .latour_nohead, .lampe_nohead),
|
||||
.pagedjs_page_content section div div div div:nth-child(2):is(
|
||||
.latour[data-split-from], .latour_nohead[data-split-from], .lampe[data-split-from], .lampe_nohead[data-split-from]) {
|
||||
margin-top: 0mm !important;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,10 +24,14 @@
|
||||
column-fill: auto;
|
||||
line-height: 12pt;
|
||||
font-size: 9pt;
|
||||
font-weight: bold;
|
||||
font-weight: normal;
|
||||
z-index: 1;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.bibliographie em {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.bibliographie a {
|
||||
word-break: break-all;
|
||||
|
||||
@@ -71,7 +71,8 @@ a {
|
||||
padding-right: 16mm;
|
||||
hyphens: auto;
|
||||
font-style: italic;
|
||||
margin-top: 4mm;
|
||||
margin-top: 10mm;
|
||||
margin-bottom: 10mm;
|
||||
}
|
||||
|
||||
.citation .guillement_ouvrant {
|
||||
|
||||
@@ -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";
|
||||
});
|
||||
|
||||
})();
|
||||
|
||||
|
||||
@@ -34,13 +34,13 @@
|
||||
{% endblock %}
|
||||
</head>
|
||||
<body id="top" class="{{ page.header.body_classes|e }}">
|
||||
{% block body %}
|
||||
<section id="body">
|
||||
<div>
|
||||
{% block content %}{% endblock %}
|
||||
</div>
|
||||
</section>
|
||||
{% endblock %}
|
||||
{% block body %}
|
||||
<section id="body">
|
||||
<div>
|
||||
{% block content %}{% endblock %}
|
||||
</div>
|
||||
</section>
|
||||
{% endblock %}
|
||||
|
||||
|
||||
{% block bottom %}
|
||||
|
||||
Reference in New Issue
Block a user