From: Micheil Smith Date: Sun, 14 Nov 2010 23:50:14 +0000 (+1100) Subject: Better doc indexes, fix some links X-Git-Tag: v0.3.1~10 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=939fba40fd55d67f873e2edc89503029c616c17e;p=platform%2Fupstream%2Fnodejs.git Better doc indexes, fix some links --- diff --git a/doc/api_assets/core.js b/doc/api_assets/core.js index e22106d..3625b2d 100644 --- a/doc/api_assets/core.js +++ b/doc/api_assets/core.js @@ -1,3 +1,63 @@ $(function(){ highlight(undefined, undefined, 'pre'); -}); \ No newline at end of file + var $headings = $("h2, h3, h4, h5, h6"); + + if(! $("body").hasClass("index") && $headings.size() > 2){ + var current_level + , last_level = 0 + , toc = [ + '
', + '

Table Of Contents Hide

' + ]; + + for(var i=0, hl=$headings.size()+1; i < hl; i++) { + var heading = $headings[i] || false; + if(heading) { + current_level = heading.tagName.substr(1,1); + + console.log(current_level, last_level, $(heading).text()); + + if(last_level != 0 && current_level <= last_level) { + toc.push(""); + } + + if(current_level > last_level) { + toc.push(""); + toc.push(""); + } + } + + if(current_level == last_level || current_level < last_level) { + toc.push("
  • "); + } + + toc.push(''+$(heading).text()+''); + last_level = current_level; + } else { + toc.push("
  • "); + toc.push(""); + } + } + + toc.push(""); + toc.push(""); + toc.push("
    "); + toc.push("
    "); + + $("#container header").after(toc.join("\n")); + $("#toggler").toggle(function(e){ + $("#toc ul").hide(); + $(this).text("show"); + e.preventDefault(); + }, function(e){ + $("#toc ul").show(); + $(this).text("hide"); + e.preventDefault(); + }); + } +}); diff --git a/doc/api_assets/style.css b/doc/api_assets/style.css index a57a820..6dc8718 100644 --- a/doc/api_assets/style.css +++ b/doc/api_assets/style.css @@ -24,6 +24,10 @@ a { color: #b950b7; } +#changelog #gtoc { + display: none; +} + .notice { display: block; padding: 1em; @@ -97,16 +101,15 @@ h1 { } h2 { - font-size: 1.8em; + font-size: 1.9em; line-height: 1.227em; - margin: 0 0 0.75em; - font-style: italic; + margin: 0 0 0.5em; } h3 { - font-size: 1.6em; + font-size: 1.5em; line-height: 1.0909em; - margin: 1.6em 0 1em; + margin: 1.5em 0 0.5em; } h3 + h3 { @@ -175,12 +178,35 @@ code.pre { padding: 0 0.5em 0.225em; } -#container header hr { +hr { background: none; border: medium none; border-bottom: 1px solid #ccc; + margin: 5em 0 2em; } +#container header hr { + margin: 0; + padding: 0; +} + +#toc { + +} + + #toc h2 { + font-size: 1em; + line-height: 1.4em; + } + + #toc h2 a { + float: right; + } + + #toc hr { + margin: 1em 0 2em; + } + p tt, p code { background: #f8f8ff; border: 1px solid #dedede; diff --git a/doc/index.html b/doc/index.html index 27f8f3e..e7c0433 100644 --- a/doc/index.html +++ b/doc/index.html @@ -23,7 +23,7 @@
  • About
  • Links
  • Contributing
  • -
  • Documentation
  • +
  • Documentation
  • @@ -260,7 +260,7 @@ git config --global user.name "Ryan Dahl"

    Before your code your code can be accepted you have to sign the - contributor license agreement. + contributor license agreement.

    diff --git a/doc/template.html b/doc/template.html index dfbf7f0..54ae672 100644 --- a/doc/template.html +++ b/doc/template.html @@ -11,7 +11,7 @@

    Node.js Manual & Documentation