aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/js/even.js12
-rw-r--r--src/package.json2
2 files changed, 13 insertions, 1 deletions
diff --git a/src/js/even.js b/src/js/even.js
index 783698a..974346e 100644
--- a/src/js/even.js
+++ b/src/js/even.js
@@ -160,12 +160,24 @@ Even.toc = function () {
// toc = true, but there are no headings
tocContainer.parentNode.removeChild(tocContainer)
} else {
+ this._refactorToc(toc)
this._linkToc()
this._initToc()
}
}
}
+Even._refactorToc = function (toc) {
+ const oldTocList = toc.children[0]
+ let newTocList = oldTocList
+ let temp
+ while (newTocList.children.length === 1 && (temp = newTocList.children[0].children[0]).tagName === 'UL')
+ newTocList = temp
+
+ if (newTocList !== oldTocList)
+ toc.replaceChild(newTocList, oldTocList)
+}
+
Even._linkToc = function () {
const links = document.querySelectorAll('#TableOfContents a')
for (let i = 0; i < links.length; i++) links[i].className += ' toc-link'
diff --git a/src/package.json b/src/package.json
index 2bb8e88..1be0cce 100644
--- a/src/package.json
+++ b/src/package.json
@@ -1,6 +1,6 @@
{
"name": "even-src",
- "version": "2.6.4",
+ "version": "2.6.5",
"description": "even source file",
"main": "index.js",
"scripts": {