chapter hgroup + calming decor

This commit is contained in:
Julie Blanc 2026-04-07 18:09:15 +02:00
parent 0545b131de
commit 94d14d70c1
370 changed files with 9583 additions and 1566 deletions

View file

@ -101,13 +101,27 @@ class subtitlesDecor extends Paged.Handler {
beforeParsed(content){
content.querySelectorAll("h3").forEach(subtitle => {
const next = subtitle.nextElementSibling;
if (next) next.classList.add("following-h3");
content.querySelectorAll("h3, h4").forEach(subtitle => {
const block = subtitle.closest('.block');
const nextBlock = block?.nextElementSibling;
if (!nextBlock) return;
const firstP = nextBlock.querySelector('p');
if (!firstP) return;
if (subtitle.tagName === "H3") {
firstP.classList.add("following-h3");
}
if (subtitle.tagName === "H4") {
firstP.classList.add("following-h4");
}
});
content.querySelectorAll("h4").forEach(subtitle => {
const next = subtitle.nextElementSibling;
if (next) next.classList.add("following-h4");
content.querySelectorAll(".chapter-content").forEach(chapter => {
let pfirst = chapter.querySelector('p');
pfirst.classList.add("first-p");
});
}
@ -121,14 +135,14 @@ class subtitlesDecor extends Paged.Handler {
this.processTitle(subtitle, symbol, true, isLeft);
});
pageElement.querySelectorAll("h4").forEach(subtitle => {
this.processTitle(subtitle, symbol, false, isLeft);
const container = document.createElement("div");
container.className = "h4_container " + subtitle.className;
subtitle.className = "";
subtitle.parentNode.insertBefore(container, subtitle);
container.appendChild(subtitle);
});
// pageElement.querySelectorAll("h4").forEach(subtitle => {
// this.processTitle(subtitle, symbol, false, isLeft);
// const container = document.createElement("div");
// container.className = "h4_container " + subtitle.className;
// subtitle.className = "";
// subtitle.parentNode.insertBefore(container, subtitle);
// container.appendChild(subtitle);
// });
pageElement.querySelectorAll("h6").forEach(h6 => {
if (h6.closest(".h6_container")) return;