Skip to content

Commit

Permalink
Remove empty blocks from moonlightnovel.com
Browse files Browse the repository at this point in the history
See: #1095
  • Loading branch information
dteviot committed Oct 17, 2023
1 parent c0e363e commit 93623b8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions plugin/js/parsers/NoblemtlParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,17 @@ class NoblemtlParser extends Parser{
let toRemove = [...element.querySelectorAll("p")]
.filter(p => p.style.opacity === "0");
util.removeElements(toRemove);
util.removeElements(this.findEmptySpanElements(element));
util.removeChildElementsMatchingCss(element, "span.modern-footnotes-footnote__note");
util.removeChildElementsMatchingCss(element, "span.footnote_tooltip");
super.removeUnwantedElementsFromContentElement(element);
}

findEmptySpanElements(element) {
return [...element.querySelectorAll("span")]
.filter(s => !s.firstChild);
}

findChapterTitle(dom) {
return dom.querySelector("h1.entry-title");
}
Expand Down

0 comments on commit 93623b8

Please sign in to comment.