page titre et loader
This commit is contained in:
@@ -125,6 +125,59 @@ class setMarginTexts extends Paged.Handler {
|
||||
encarts[i].parentNode.prepend(plainColor);
|
||||
}
|
||||
}
|
||||
|
||||
// TITRES
|
||||
let h3s = document.querySelectorAll('h3');
|
||||
for (let h3 of h3s) {
|
||||
if (h3.nextSibling.firstChild.tagName == "IMG") {
|
||||
h3.style.position = "absolute";
|
||||
h3.style.top = "40%";
|
||||
|
||||
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";
|
||||
|
||||
console.log(coverImg);
|
||||
h3.parentElement.append(coverImg);
|
||||
|
||||
let nextImg = document.createElement('img');
|
||||
nextImg.setAttribute('src', coverImg.firstChild.getAttribute('src'));
|
||||
|
||||
|
||||
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";
|
||||
nextImg.style.height = "100%";
|
||||
nextImg.style.width = "auto";
|
||||
nextImg.style.marginLeft = "-53mm";
|
||||
}
|
||||
|
||||
h3.closest('.pagedjs_pagebox').querySelector('.pagedjs_margin-left').innerHTML = '';
|
||||
}
|
||||
let h4s = document.querySelectorAll('h4');
|
||||
for (let h4 of h4s) {
|
||||
if (h4.nextElementSibling?.classList.contains('bibliographie')) {
|
||||
h4.style.color = "#d98a29";
|
||||
}
|
||||
}
|
||||
// loading
|
||||
document.querySelector('body').style.opacity = "1";
|
||||
document.querySelector('body').style.overflow = "scroll";
|
||||
}
|
||||
}
|
||||
Paged.registerHandlers(setMarginTexts);
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
|
||||
// transformer les balises [...] en <div class="...">
|
||||
let bodyContent = $('#body').html()
|
||||
.replace(/\[([^\/\]]+)\]/g, '<div class="$1">')
|
||||
@@ -72,4 +73,14 @@ for(let i = 0; i < contentToParse.length; i++) {
|
||||
contentToParse[i].childNodes[j].innerHTML = contentToParse[i].childNodes[j].innerHTML.replaceAll(' min', ' min');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// PAGES TITRES
|
||||
let h3s = document.querySelectorAll('h3');
|
||||
for (let h3 of h3s) {
|
||||
if (h3.nextElementSibling.firstChild.tagName == 'IMG') {
|
||||
h3.style.width = "50%";
|
||||
h3.nextElementSibling.firstChild.style.width = "60%";
|
||||
h3.innerHTML = h3.innerHTML.replace(/[^\s]*/, `<div class="gros-chiffre">${1}</div>`);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user