user docs: Highlight currently selected user docs article.

Fixes #7053.
This commit is contained in:
Cynthia Lin 2017-12-24 09:22:33 -08:00 committed by showell
parent 1dcd311ce8
commit fa92a35f17
2 changed files with 23 additions and 1 deletions

View File

@ -17,10 +17,24 @@ function registerCodeSection($codeSection) {
$li.eq(0).click();
}
function highlight_current_article() {
$('.help .sidebar a').removeClass('highlighted');
var path = window.location.href.match(/\/(help|api)\/.+/);
if (!path) {
return;
}
var article = $('.help .sidebar a[href="' + path[0] + '"]');
article.addClass('highlighted');
}
function render_code_sections() {
$(".code-section").each(function () {
registerCodeSection($(this));
});
highlight_current_article();
}
(function () {
@ -53,7 +67,6 @@ function render_code_sections() {
var path = $(this).attr("href");
var container = $(".markdown")[0];
if (loading.name === path) {
return;
}

View File

@ -205,6 +205,15 @@ body {
display: block;
}
.help .sidebar li a.highlighted {
background-color: hsl(152, 40%, 42%);
/* Extend highlight to entire width of sidebar, not just link area */
width: calc(100% + 20px);
margin-left: -40px;
padding-left: 40px;
}
.app.help .hamburger {
display: none;
}