2,963
edits
Efernandez (talk | contribs) No edit summary |
Efernandez (talk | contribs) No edit summary |
||
Line 241: | Line 241: | ||
// Function to highlight the current page | // Function to highlight the current page | ||
function highlightCurrentPage() { | function highlightCurrentPage() { | ||
var currentPage = window.location.pathname.split('/').pop(); // Get the current page name | |||
var links = document.querySelectorAll('.wiki-toc-list a'); | |||
links.forEach(function (link) { | |||
var linkPage = link.href.split('/').pop(); // Extract page name from link | |||
linkPage = linkPage.replace(/%20/g, '_'); | |||
linkPage = linkPage.replace(/ /g, '_'); | |||
if (linkPage === currentPage) { | |||
link.classList.add('current-page'); | |||
var parentLi = link.closest('ul').previousElementSibling; | |||
//if (parentLi && parentLi.classList.contains('toc-section-header')) { | |||
// parentLi.classList.add('current-section'); | |||
//} | |||
} | |||
}); | |||
} | |||
} | |||
highlightCurrentPage(); | highlightCurrentPage(); | ||