From 622827efda8de694d1fd428ef5cdcb073b717133 Mon Sep 17 00:00:00 2001 From: David Bolack Date: Sat, 20 Jan 2024 20:47:27 -0600 Subject: [PATCH] Fix Exclusion examination --- themes/V3/5ePHB/snippets/tableOfContents.gen.js | 17 +++-------------- themes/V3/5ePHB/style.less | 10 ++++++++++ 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/themes/V3/5ePHB/snippets/tableOfContents.gen.js b/themes/V3/5ePHB/snippets/tableOfContents.gen.js index 1be583ba1..c6ac0671d 100644 --- a/themes/V3/5ePHB/snippets/tableOfContents.gen.js +++ b/themes/V3/5ePHB/snippets/tableOfContents.gen.js @@ -27,26 +27,15 @@ const getTOC = ()=>{ }); }; - const getParentPageNumber = (e)=>{ - let tE = e; - while (tE?.tagName != 'BODY') { - if((tE.className == 'page') || (tE.className.split(' ')?.includes('Page'))) { - // Test for excluded pages here. - return parseInt(tE.id.replace(/^p/, '')); - } - tE = tE.parentElement; - } - return -1; - }; - const res = []; const iframe = document.getElementById('BrewRenderer'); const iframeDocument = iframe.contentDocument || iframe.contentWindow.document; const headings = iframeDocument.querySelectorAll('h1, h2, h3'); _.each(headings, (heading)=>{ - const onPage = getParentPageNumber(heading); - if(getComputedStyle(heading).getPropertyValue('--TOC') != 'exclude') { + const onPage = parseInt(heading.closest('.page,.phb').id.replace(/^p/, '')); + const ToCExclude = getComputedStyle(heading).getPropertyValue('--TOC'); + if(ToCExclude != '"exclude"') { if(onPage != -1) { const headingText = heading.innerText; if(heading.tagName == 'H1') { diff --git a/themes/V3/5ePHB/style.less b/themes/V3/5ePHB/style.less index fba45df42..03dc021c7 100644 --- a/themes/V3/5ePHB/style.less +++ b/themes/V3/5ePHB/style.less @@ -799,6 +799,16 @@ // ***************************** // * TABLE OF CONTENTS // *****************************/ + +.page:has(.frontCover), +.page:has(.backCover), +.page:has(.insideCover), +.page:has(.partCover), +.monster h3, +.monster h4, +h5, h6, +.toc { --TOC: exclude; } + .page { &:has(.toc)::after { display : none; } .toc {