0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-14 04:12:43 +00:00

Add fixes to account for no page numbers

Clear out manual toggles.
This commit is contained in:
David Bolack
2024-01-29 20:14:52 -06:00
parent 692205b0e6
commit 85caf0a892
2 changed files with 2 additions and 14 deletions

View File

@@ -33,10 +33,10 @@ const getTOC = ()=>{
const headings = iframeDocument.querySelectorAll('h1, h2, h3');
_.each(headings, (heading)=>{
const onPage = parseInt(heading.closest('.page,.phb').id.replace(/^p/, ''));
const onPage = parseInt(heading.closest('.page,.phb').id?.replace(/^p/, ''));
const ToCExclude = getComputedStyle(heading).getPropertyValue('--TOC');
if(ToCExclude != '"exclude"') {
if(onPage != -1) {
if(!isNaN(onPage)) {
const headingText = heading.innerText;
if(heading.tagName == 'H1') {
add1(headingText, onPage);