From 68d4b8aac785d4f73514fe67871b64605db5bde9 Mon Sep 17 00:00:00 2001 From: Aaron Carlisle Date: Mon, 15 Mar 2021 14:51:06 -0400 Subject: [PATCH] Javascript: Add support for deep toc levels (#1089) In ca015a57042713ebd7f39563cdb01fab5b604051 support was added for tox levels up to 10. This only fixed the css side, this commit makes a similar fix for the js side. Fixes #893 --- src/theme.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/theme.js b/src/theme.js index 530827e8a..2f0133428 100644 --- a/src/theme.js +++ b/src/theme.js @@ -146,13 +146,10 @@ function ThemeNav () { if (link.length > 0) { $('.wy-menu-vertical .current').removeClass('current'); link.addClass('current'); - link.closest('li.toctree-l1').addClass('current'); link.closest('li.toctree-l1').parent().addClass('current'); - link.closest('li.toctree-l1').addClass('current'); - link.closest('li.toctree-l2').addClass('current'); - link.closest('li.toctree-l3').addClass('current'); - link.closest('li.toctree-l4').addClass('current'); - link.closest('li.toctree-l5').addClass('current'); + for (let i = 1; i <= 10; i++) { + link.closest('li.toctree-l' + i).addClass('current'); + } link[0].scrollIntoView(); } }