Skip to content

Commit

Permalink
Adding back exact match
Browse files Browse the repository at this point in the history
  • Loading branch information
ar2rsawseen committed May 21, 2019
1 parent c3b1724 commit f69a2b6
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions static/scripts/collapse.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@ function hideAllButCurrent(){
});

//only current page (if it exists) should be opened
var file = window.location.pathname.split("/").pop();
document.querySelectorAll("nav > ul > li > a[href^='"+file+"']").forEach(function(parent) {
parent.parentNode.querySelectorAll("ul li").forEach(function(elem) {
elem.style.display = "block";
});
var file = window.location.pathname.split("/").pop().replace(/\.html/, '');
document.querySelectorAll("nav > ul > li > a").forEach(function(parent) {
var href = parent.attributes.href.value.replace(/\.html/, '');
if (file === href) {
parent.parentNode.querySelectorAll("ul li").forEach(function(elem) {
elem.style.display = "block";
});
}
});
}

Expand Down

0 comments on commit f69a2b6

Please sign in to comment.