mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
Better doc indexes, fix some links
This commit is contained in:
@@ -1,3 +1,63 @@
|
||||
$(function(){
|
||||
highlight(undefined, undefined, 'pre');
|
||||
});
|
||||
var $headings = $("h2, h3, h4, h5, h6");
|
||||
|
||||
if(! $("body").hasClass("index") && $headings.size() > 2){
|
||||
var current_level
|
||||
, last_level = 0
|
||||
, toc = [
|
||||
'<div id="toc">',
|
||||
'<h2>Table Of Contents <a id="toggler" href="#toc">Hide</a></h2>'
|
||||
];
|
||||
|
||||
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("</li>");
|
||||
}
|
||||
|
||||
if(current_level > last_level) {
|
||||
toc.push("<ul>");
|
||||
toc.push("<li>");
|
||||
} else if(current_level < last_level) {
|
||||
console.log(last_level-current_level);
|
||||
for(var c=last_level-current_level; 0 < c ; c-- ){
|
||||
toc.push("</ul>");
|
||||
toc.push("</li>");
|
||||
}
|
||||
}
|
||||
|
||||
if(current_level == last_level || current_level < last_level) {
|
||||
toc.push("<li>");
|
||||
}
|
||||
|
||||
toc.push('<a href="#'+$(heading).attr("id")+'">'+$(heading).text()+'</a>');
|
||||
last_level = current_level;
|
||||
} else {
|
||||
toc.push("</li>");
|
||||
toc.push("</ul>");
|
||||
}
|
||||
}
|
||||
|
||||
toc.push("</li>");
|
||||
toc.push("</ul>");
|
||||
toc.push("<hr />");
|
||||
toc.push("</div>");
|
||||
|
||||
$("#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();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
<li><a href="#about">About</a></li>
|
||||
<li><a href="#links">Links</a></li>
|
||||
<li><a href="#contributing">Contributing</a></li>
|
||||
<li><a href="api.html">Documentation</a></li>
|
||||
<li><a href="api/">Documentation</a></li>
|
||||
</ol>
|
||||
</div>
|
||||
<div id="content">
|
||||
@@ -260,7 +260,7 @@ git config --global user.name "Ryan Dahl"
|
||||
|
||||
<p>
|
||||
Before your code your code can be accepted you have to sign the
|
||||
<a href="http://nodejs.org/cla.html">contributor license agreement</a>.
|
||||
<a href="cla.html">contributor license agreement</a>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<header>
|
||||
<h1>Node.js Manual & Documentation</h1>
|
||||
<div id="gtoc">
|
||||
<p><a href="index.html">Table of Contents</a> | <a href="all.html">View on single page</a></p>
|
||||
<p><a href="index.html">Index</a> | <a href="all.html">View on single page</a></p>
|
||||
</div>
|
||||
<hr />
|
||||
</header>
|
||||
|
||||
Reference in New Issue
Block a user