in freemarker-docgen-core/src/main/resources-gulp/org/freemarker/docgen/core/js/make-toc.js [81:148]
function menuChildren(children, depth, onPath) {
var ul = document.createElement('ul');
ul.classList.add('depth-' + menuLevel);
for (var x = 0; x < children.length; x++) {
var node = children[x];
var li = document.createElement('li');
var isLast = checkIfLast(node);
if (menuLevel === 0) {
li.classList.add('section');
}
// @todo: hide this until we can figure out a solution for search
if (node.title === 'Search') {
li.style.display = 'none';
}
li.addEventListener('click', menuClick);
li.addEventListener('keydown', keyboardNavigation);
// add menu link
li.appendChild(menuItemInnerHTML(node));
if (node.title === breadcrumb[depth + 1] && onPath) {
if (depth + 2 === breadcrumb.length) {
li.classList.add('current');
}
// 'section' is always open
if (menuLevel !== 0) {
li.classList.add('open');
}
depth++;
} else if (menuLevel > 0) {
li.classList.add('closed');
}
if (isLast) {
li.classList.add('last');
// @todo: add flags to docgen
if (typeof node.flags !== 'undefined') {
li.classList.add(node.flags.join(' '));
}
} else if (menuLevel > 0) {
// don't add for top menuLevel elements
li.classList.add('has-children');
}
if (!isLast) {
menuLevel++;
li.appendChild(menuChildren(node.children, depth, (node.title === breadcrumb[depth])));
menuLevel--;
}
ul.appendChild(li);
}
return ul;
}