images lowres + modifs pages titres

This commit is contained in:
Valentin
2023-07-22 05:18:51 +02:00
parent fdc4c7f6a0
commit fd20768958
2728 changed files with 234 additions and 166686 deletions
+57 -34
View File
@@ -5,6 +5,18 @@ class setMarginTexts extends Paged.Handler {
super(chunker, polisher, caller);
}
afterParsed(parsed) {
// indication du chargement
let chargement = document.createElement('div');
chargement.setAttribute('id', 'chargement');
chargement.innerHTML = 'chargement';
chargement.style.color = "orange";
chargement.style.position = "fixed";
chargement.style.fontWeight = "bold";
chargement.style.zIndex = "9999";
document.querySelector('body').prepend(chargement);
}
afterPreview(pages) {
// cleaner pour que les paragraphes tombent sur la marge haute
for(let i = 0; i < labeurs.length; i++) {
@@ -133,48 +145,60 @@ class setMarginTexts extends Paged.Handler {
// TITRES ATELIERS
let h3s = document.querySelectorAll('h3');
for (let h3 of h3s) {
if (h3.nextSibling?.firstChild.tagName == "IMG") {
h3.style.position = "absolute";
h3.style.top = "40%";
if (h3.nextSibling?.firstChild.tagName === "IMG") {
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'));
h3.prepend(coverDessin);
coverDessin.style.width = '100%';
coverDessin.style.height = 'auto';
photoContainer.firstElementChild.remove();
} else {
console.log('1 toff');
coverPhoto = h3.nextElementSibling.firstChild;
}
photoContainer.style.position = 'absolute';
photoContainer.style.width = '53mm';
photoContainer.style.height = '220mm';
photoContainer.style.overflow = 'hidden';
photoContainer.style.top = "-22mm";
photoContainer.style.left = "96mm";
photoContainer.style.margin = '0';
h3.nextSibling.style.position = "absolute";
h3.nextSibling.style.top = "5%";
}
if (h3.closest('.pagedjs_page').nextElementSibling?.querySelector('.has-children ')?.firstChild.firstChild.firstChild.tagName == "IMG") {
let coverImg = h3.closest('.pagedjs_page').nextElementSibling.querySelector('.has-children ').firstChild.childNodes[0];
coverImg.style.position = "absolute";
coverImg.style.top = "-22mm";
coverImg.style.left = "96mm";
coverImg.style.height = "220mm";
coverImg.style.width = "53mm";
coverImg.style.overflow = "hidden";
coverImg.firstChild.style.height = "100%";
coverImg.firstChild.style.width = "auto";
h3.parentElement.append(coverImg);
coverPhoto.style.width = 'auto';
coverPhoto.style.height = '100%';
let nextImg = document.createElement('img');
nextImg.setAttribute('src', coverImg.firstChild.getAttribute('src'));
nextImg.setAttribute('src', coverPhoto.getAttribute('src'));
let nextContainer = document.createElement('div');
h3.closest('.pagedjs_page').nextElementSibling.querySelector('.has-children ').append(nextImg);
nextImg.parentElement.style.position = "absolute";
nextImg.parentElement.style.top = "-22mm";
nextImg.parentElement.style.left = "-8mm";
nextImg.parentElement.style.height = "220mm";
nextImg.parentElement.style.width = "171mm";
nextImg.parentElement.style.overflow = "hidden";
nextContainer.style.position = "absolute";
nextContainer.style.top = "-22mm";
nextContainer.style.left = "-8mm";
nextContainer.style.height = "220mm";
nextContainer.style.width = "224mm";
nextContainer.style.overflow = "hidden";
nextContainer.style.marginLeft = "-53mm";
nextImg.style.height = "100%";
nextImg.style.width = "auto";
nextImg.style.marginLeft = "-53mm";
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`;
h3.closest('.pagedjs_pagebox').querySelector('.pagedjs_margin-left').innerHTML = '';
h3.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement
.classList.add('atelier_cover_page');
}
let h4s = document.querySelectorAll('h4');
// SET COLORS
let colors = [
@@ -271,7 +295,7 @@ class setMarginTexts extends Paged.Handler {
// set all colors
let allPages = document.querySelectorAll('.pagedjs_page');
let partieColor = '';
let bgColor = 'rgb(250, 250, 250)';
let bgColor = 'rgb(245, 245, 245)';
for (let page of allPages) {
if (page.classList.contains('partie_cover_page')) {
partieColor = page.firstElementChild.style.backgroundColor;
@@ -324,9 +348,8 @@ class setMarginTexts extends Paged.Handler {
link.setAttribute('target', '_blank');
}
// loading
document.querySelector('body').style.opacity = "1";
document.querySelector('body').style.overflow = "scroll";
// loading fini
document.querySelector('#chargement').remove();
}
}
Paged.registerHandlers(setMarginTexts);