mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-09 20:12:41 +00:00
Add fixes to account for no page numbers
Clear out manual toggles.
This commit is contained in:
@@ -33,10 +33,10 @@ const getTOC = ()=>{
|
|||||||
const headings = iframeDocument.querySelectorAll('h1, h2, h3');
|
const headings = iframeDocument.querySelectorAll('h1, h2, h3');
|
||||||
|
|
||||||
_.each(headings, (heading)=>{
|
_.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');
|
const ToCExclude = getComputedStyle(heading).getPropertyValue('--TOC');
|
||||||
if(ToCExclude != '"exclude"') {
|
if(ToCExclude != '"exclude"') {
|
||||||
if(onPage != -1) {
|
if(!isNaN(onPage)) {
|
||||||
const headingText = heading.innerText;
|
const headingText = heading.innerText;
|
||||||
if(heading.tagName == 'H1') {
|
if(heading.tagName == 'H1') {
|
||||||
add1(headingText, onPage);
|
add1(headingText, onPage);
|
||||||
|
|||||||
@@ -806,18 +806,6 @@
|
|||||||
.noToC,
|
.noToC,
|
||||||
.toc { --TOC: exclude; }
|
.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 {
|
.page {
|
||||||
&:has(.toc)::after { display : none; }
|
&:has(.toc)::after { display : none; }
|
||||||
.toc {
|
.toc {
|
||||||
|
|||||||
Reference in New Issue
Block a user