mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	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.
		
			
				
	
	
		
			22 lines
		
	
	
		
			558 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			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));
 | 
						|
});
 |