Skip to content

Commit

Permalink
fix JS error in interacive TOC
Browse files Browse the repository at this point in the history
when no toc is available on the current page, an error would be thrown.
This is now fixed. When no toc is available the code in question is not  executed.

Also removed some unecessary JQuery
  • Loading branch information
jothepro committed Aug 18, 2022
1 parent afc4868 commit 4621dc4
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions doxygen-awesome-interactive-toc.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ class DoxygenAwesomeInteractiveToc {
static headers = []

static init() {
$(function() {
$(document).ready(function() {
let toc = document.querySelector(".contents > .toc")
window.addEventListener("load", () => {
let toc = document.querySelector(".contents > .toc")
if(toc) {
toc.classList.add("interactive")
if(!DoxygenAwesomeInteractiveToc.hideMobileMenu) {
toc.classList.add("open")
Expand All @@ -46,7 +46,6 @@ class DoxygenAwesomeInteractiveToc {
} else {
toc.classList.add("open")
}

})

document.querySelectorAll(".contents > .toc > ul a").forEach((node) => {
Expand All @@ -61,7 +60,7 @@ class DoxygenAwesomeInteractiveToc {
})
})
DoxygenAwesomeInteractiveToc.update()
})
}
})
}

Expand Down

0 comments on commit 4621dc4

Please sign in to comment.