From 16faba1859da85c0a794e7240902001da0220d07 Mon Sep 17 00:00:00 2001 From: Cedric Beust Date: Thu, 8 Oct 2015 06:18:12 -0700 Subject: [PATCH] Better nav bar. --- documentation/index.html | 24 ++-------------- home/index.html | 24 ++-------------- js/{toc.js => kobalt.js} | 61 +++++++++++++++++++++++++++++++++++++++- plug-in/index.html | 23 +++------------ 4 files changed, 70 insertions(+), 62 deletions(-) rename js/{toc.js => kobalt.js} (58%) diff --git a/documentation/index.html b/documentation/index.html index d3907c0..45f3593 100644 --- a/documentation/index.html +++ b/documentation/index.html @@ -40,25 +40,7 @@
-
' + + '' + ; + +function generateNavBar(index) { + var result = before; + for (var i = 0; i < content.length; i++) { + var cls = ""; + if (index == i) { + cls = 'class="active"'; + } + var c = content[i]; + result += '
  • ' + c.title + '
  • '; + } + result += after; + + + var navBarElement = document.getElementById("kobalt-navbar"); + navBarElement.innerHTML = result; +} + +// +// Table of contents +// + function countersToHeading(counters) { var result = ""; for (var i = 0; i < counters.length; i++) { @@ -56,7 +110,12 @@ function generateToc() { if (tocTag) { tocTag.innerHTML = toc; } else { - alert("Couldn't find an id " + tocId); + console.log("Couldn't find an id " + tocId); } } + +function generateKobalt(index) { + generateToc(); + generateNavBar(index); +} diff --git a/plug-in/index.html b/plug-in/index.html index c99d877..d278c3d 100644 --- a/plug-in/index.html +++ b/plug-in/index.html @@ -40,25 +40,7 @@
    -