0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-26 22:32:45 +00:00

Fix Exclusion examination

This commit is contained in:
David Bolack
2024-01-20 20:47:27 -06:00
parent 854c21639a
commit 622827efda
2 changed files with 13 additions and 14 deletions

View File

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

View File

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