Files
zulip/static/js/portico/api.js
Brock Whittaker e86e259cb1 /api/: Add Markdown-based /api-new documentation.
This commit allows for the /api-new/ page to rendered similarly to our
/help pages.  It's based on the old content for /api, but we're not
replacing the old content yet, to give a bit of time to restructure
things reasonably.

Tweaked by eeshangarg and tabbott.
2017-10-30 22:32:43 -07:00

22 lines
558 B
JavaScript

function registerCodeSection($codeSection) {
const $li = $codeSection.find("ul.nav li");
const $blocks = $codeSection.find(".blocks div");
$li.click(function () {
const language = this.dataset.language;
$li.removeClass("active");
$li.filter("[data-language="+language+"]").addClass("active");
$blocks.removeClass("active");
$blocks.filter("[data-language="+language+"]").addClass("active");
});
$li.eq(0).click();
}
$(".code-section").each(function () {
registerCodeSection($(this));
});