From 0047f40f507f4ab61e439458c2948489d67afdd8 Mon Sep 17 00:00:00 2001 From: ShaopengLin Date: Mon, 9 Sep 2024 04:13:31 -0400 Subject: [PATCH] Reduce Affect of Should minimally alter original page --- resources/js/toc.js | 6 +++--- resources/js/tocStyle.js | 14 ++++++++++++-- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/resources/js/toc.js b/resources/js/toc.js index 28a3f11ae..a0f30980b 100644 --- a/resources/js/toc.js +++ b/resources/js/toc.js @@ -22,7 +22,7 @@ function recurseChild(elem, recurseData) recurseData.count += 1; /* Wrap header content with something we can reference. */ - elem.innerHTML = '' + headerText + ''; + elem.innerHTML = '' + headerText + ''; /* Start or end a list or item based on current and previous level */ if (level > prevLevel) @@ -60,8 +60,8 @@ function tocHTMLStr() function openPop() { var tocElem = document.getElementById("kiwix-toc"); - var isTOCVisible = tocElem.style.visibility === "visible"; - tocElem.style.visibility = isTOCVisible ? "hidden" : "visible"; + var isTOCVisible = tocElem.style.display === "block"; + tocElem.style.display = isTOCVisible ? "none" : "block"; } function tocPopupButtonElem() diff --git a/resources/js/tocStyle.js b/resources/js/tocStyle.js index 1c94e8bde..c428474c6 100644 --- a/resources/js/tocStyle.js +++ b/resources/js/tocStyle.js @@ -24,10 +24,20 @@ style.innerHTML = ` padding: 0px; } +.kiwix-toc-a { + color: inherit; + outline: none; + text-decoration: none; +} + +.kiwix-toc-a:hover { + color: inherit; + text-decoration: none; +} + #kiwix-toc { all: initial; - display: block; - visibility: hidden; + display: none; position: relative; max-height: 50vh;