mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-05 23:12:39 +00:00
Fix Exclusion examination
This commit is contained in:
@@ -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 res = [];
|
||||||
const iframe = document.getElementById('BrewRenderer');
|
const iframe = document.getElementById('BrewRenderer');
|
||||||
const iframeDocument = iframe.contentDocument || iframe.contentWindow.document;
|
const iframeDocument = iframe.contentDocument || iframe.contentWindow.document;
|
||||||
const headings = iframeDocument.querySelectorAll('h1, h2, h3');
|
const headings = iframeDocument.querySelectorAll('h1, h2, h3');
|
||||||
|
|
||||||
_.each(headings, (heading)=>{
|
_.each(headings, (heading)=>{
|
||||||
const onPage = getParentPageNumber(heading);
|
const onPage = parseInt(heading.closest('.page,.phb').id.replace(/^p/, ''));
|
||||||
if(getComputedStyle(heading).getPropertyValue('--TOC') != 'exclude') {
|
const ToCExclude = getComputedStyle(heading).getPropertyValue('--TOC');
|
||||||
|
if(ToCExclude != '"exclude"') {
|
||||||
if(onPage != -1) {
|
if(onPage != -1) {
|
||||||
const headingText = heading.innerText;
|
const headingText = heading.innerText;
|
||||||
if(heading.tagName == 'H1') {
|
if(heading.tagName == 'H1') {
|
||||||
|
|||||||
@@ -799,6 +799,16 @@
|
|||||||
// *****************************
|
// *****************************
|
||||||
// * TABLE OF CONTENTS
|
// * 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 {
|
.page {
|
||||||
&:has(.toc)::after { display : none; }
|
&:has(.toc)::after { display : none; }
|
||||||
.toc {
|
.toc {
|
||||||
|
|||||||
Reference in New Issue
Block a user