Refactor language file structure and improve article content selection logic in toc.js

This commit is contained in:
spleenftw committed 2026-06-04 11:42:10 +02:00
1 parent 0225e8ff6a
commit a33b949942
2 files changed
+5 -7

No files matched your search

+2 -4
View File
@@ -1,6 +1,4 @@
{ {
"plugin-bludit-toc": { "plugin-name": "Table of Contents",
"name": "Table of Contents", "plugin-description": "Sticky ToC sidebar (desktop) and floating drawer (mobile) generated from the article's h2/h3/h4 headings."
"description": "Sticky ToC sidebar (desktop) and floating drawer (mobile) generated from the article's h2/h3/h4 headings."
}
} }
+3 -3
View File
@@ -18,12 +18,12 @@
document.head.appendChild(styleEl); document.head.appendChild(styleEl);
/* ---- Find the article content area ---- */ /* ---- Find the article content area ---- */
/* Only match unambiguous single-article containers to avoid firing on
homepage post-list cards that also contain <article> and <h2> tags. */
var content = document.querySelector('.content') var content = document.querySelector('.content')
|| document.querySelector('article .entry-content') || document.querySelector('article .entry-content')
|| document.querySelector('.entry-content') || document.querySelector('.entry-content')
|| document.querySelector('.post-content') || document.querySelector('.post-content');
|| document.querySelector('article')
|| document.querySelector('main');
if (!content) return; if (!content) return;