Refactor language file structure and improve article content selection logic in toc.js
This commit is contained in:
1 parent
0225e8ff6a
commit
a33b949942
2 files changed
+5
-7
No files matched your search
@@ -18,12 +18,12 @@
|
||||
document.head.appendChild(styleEl);
|
||||
|
||||
/* ---- 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')
|
||||
|| document.querySelector('article .entry-content')
|
||||
|| document.querySelector('.entry-content')
|
||||
|| document.querySelector('.post-content')
|
||||
|| document.querySelector('article')
|
||||
|| document.querySelector('main');
|
||||
|| document.querySelector('.post-content');
|
||||
|
||||
if (!content) return;
|
||||
|
||||
|
||||
Reference in new issue
Block a user