Jump to content

Template:RidgeRun Platform Security Manual/TOC: Difference between revisions

no edit summary
No edit summary
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.href; // Get the full URL of the current page
                var currentPage = window.location.pathname.split('/').pop(); // Get the current page name
    var links = document.querySelectorAll('.wiki-toc-list a');
                var links = document.querySelectorAll('.wiki-toc-list a');


    links.forEach(function (link) {
                links.forEach(function (link) {
        var linkUrl = link.href; // Full URL of the link
                    var linkPage = link.href.split('/').pop(); // Extract page name from link
        // Normalize both URLs by decoding them
                    linkPage = linkPage.replace(/%20/g, '_');
        var normalizedLinkUrl = decodeURIComponent(linkUrl);
                    linkPage = linkPage.replace(/ /g, '_');
        var normalizedCurrentPage = decodeURIComponent(currentPage);
                    if (linkPage === currentPage) {
       
                        link.classList.add('current-page');
        if (normalizedLinkUrl === normalizedCurrentPage) {
                        var parentLi = link.closest('ul').previousElementSibling;
            link.classList.add('current-page');
                        //if (parentLi && parentLi.classList.contains('toc-section-header')) {
            var parentLi = link.closest('ul').previousElementSibling;
                        //   parentLi.classList.add('current-section');
            // Uncomment this block if needed to highlight sections
                        //}
            // if (parentLi && parentLi.classList.contains('toc-section-header')) {
                    }
            //     parentLi.classList.add('current-section');
                });
            // }
            }
        }
    });
}


highlightCurrentPage();
            highlightCurrentPage();




Cookies help us deliver our services. By using our services, you agree to our use of cookies.