Skip to content

Commit

Permalink
Reduce Affect of <a href>
Browse files Browse the repository at this point in the history
Should minimally alter original page
  • Loading branch information
ShaopengLin committed Sep 9, 2024
1 parent a75ce45 commit 0047f40
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
6 changes: 3 additions & 3 deletions resources/js/toc.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function recurseChild(elem, recurseData)
recurseData.count += 1;

/* Wrap header content with something we can reference. */
elem.innerHTML = '<a href="#' + anchor + '" id="' + anchor + '">' + headerText + '</a>';
elem.innerHTML = '<a href="#' + anchor + '" id="' + anchor + '" class="kiwix-toc-a" >' + headerText + '</a>';

/* Start or end a list or item based on current and previous level */
if (level > prevLevel)
Expand Down Expand Up @@ -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()
Expand Down
14 changes: 12 additions & 2 deletions resources/js/tocStyle.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 0047f40

Please sign in to comment.