0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-08 11:52:44 +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);

View File

@@ -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 {