Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Index toc rendering issue #87

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions theme/src/main/assets/assets/javascripts/groups.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,37 @@ $(function() {
});
});

// Index Page toc
$(".toc").each(function() {
var tocRoot = $(this);
function findHeaderElements(element) {
var headerElements = element.find(".header").filter("a");
headerElements.each(function() {
Roiocam marked this conversation as resolved.
Show resolved Hide resolved
var headerElement = $(this);
// if header hiding by group switch, hide they li parent
// otherwise display there li parent
if (headerElement.css("display") === "none" ) {
var parentLi = headerElement.closest('li');
if (parentLi) {
parentLi.hide();
}
} else {
var parentLi = headerElement.closest('li');
if (parentLi) {
parentLi.show();
}
}
});
// just in case there is a nested header
element.children().each(function() {
var childElement = $(this);
findHeaderElements(childElement);
});
}

findHeaderElements(tocRoot);
})

groupChangeListeners.forEach(listener => listener(group, supergroup, catalog));
}

Expand Down