+ //
+ // Additionally injects breadcrumbs for the active sidebar
+ // entry, if any, into the `.collapsed-header` element above.
function renderItems(items, paths) {
if (!items || items.length == 0)
return $();
@@ -103,9 +129,14 @@
});
var active = (urls.indexOf(location.pathname) !== -1);
if (active) {
- $("#ch-breadcrumbs")
+ // This mutation inside an otherwise pure function is
+ // unfortunate, but doing it here avoids a separate
+ // traversal of the sidebar data.
+ var breadcrumbs = $("
")
+ .addClass("collapsed-header__pre")
.html(paths.join("\n"));
- $("#ch-title").html(item.title);
+ var title = $("
").html(item.title);
+ $(".collapsed-header").empty().append(breadcrumbs, title);
}
var subitems = renderItems(item.items, paths.concat(item.title));
var a = $("")