From 85caf0a892644e6bf85129b1a763323334025f4f Mon Sep 17 00:00:00 2001 From: David Bolack Date: Mon, 29 Jan 2024 20:14:52 -0600 Subject: [PATCH] Add fixes to account for no page numbers Clear out manual toggles. --- themes/V3/5ePHB/snippets/tableOfContents.gen.js | 4 ++-- themes/V3/5ePHB/style.less | 12 ------------ 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/themes/V3/5ePHB/snippets/tableOfContents.gen.js b/themes/V3/5ePHB/snippets/tableOfContents.gen.js index c6ac0671d..150b67c30 100644 --- a/themes/V3/5ePHB/snippets/tableOfContents.gen.js +++ b/themes/V3/5ePHB/snippets/tableOfContents.gen.js @@ -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); diff --git a/themes/V3/5ePHB/style.less b/themes/V3/5ePHB/style.less index a06817566..1047ed729 100644 --- a/themes/V3/5ePHB/style.less +++ b/themes/V3/5ePHB/style.less @@ -806,18 +806,6 @@ .noToC, .toc { --TOC: exclude; } -// Manual Inclusion classes - -.addToC, -.addh1, .addh2, .addh3, .addh4, .addh5, .addh6, .addh1h2 h1, .addh1h2 h2, -.addh1h3 h1, .addh1h3 h2, .addh1h3 h3, .addh1h4 h1, .addh1h4 h2, .addh1h4 h3, .addh1h4 h4, -.addh1h5 h1, .addh1h5 h2, .addh1h5 h3, .addh1h5 h4, .addh1h5 h5 { --TOC: include; } - -// Manual Exclusion classes -.noh1, .noh2, .noh3, .noh4, .noh5, .noh6, .noh1h2 h1, .noh1h2 h2, -.noh1h3 h1, .noh1h3 h2, .noh1h3 h3, .noh1h4 h1, .noh1h4 h2, .noh1h4 h3, .noh1h4 h4, -.noh1h5 h1, .noh1h5 h2, .noh1h5 h3, .noh1h5 h4, .noh1h5 h5 { --TOC: exclude; } - .page { &:has(.toc)::after { display : none; } .toc {