Skip to content
This repository was archived by the owner on May 14, 2024. It is now read-only.

Commit 622b748

Browse files
committed
First steps toward updating the docs
1 parent 9ec1e90 commit 622b748

File tree

16 files changed

+512
-206
lines changed

16 files changed

+512
-206
lines changed

Makefile

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,8 @@ TAP := ./node_modules/.bin/tap
2323
#
2424
# Files
2525
#
26-
DOC_FILES = client.md \
27-
dn.md \
28-
errors.md \
29-
examples.md \
30-
filters.md \
31-
guide.md \
32-
index.md \
33-
persistent_search.md \
34-
server.md
35-
26+
DOC_FILES := $(shell find docs -name '*.md' -printf '%f\n')
27+
RESTDOWN_FLAGS := -b docs/branding/
3628
JS_FILES := $(shell find lib test -name '*.js') $(shell find bin -name 'ldapjs-*')
3729
JSL_CONF_NODE = tools/jsl.node.conf
3830
JSL_FILES_NODE = $(JS_FILES)

deps/restdown

docs/branding/footer.html.in

Lines changed: 37 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,46 @@
1-
<div id="footer">
2-
<p class='copy'>Copyright &copy; 2011 <a href="https://github.com/mcavage">Mark Cavage</a></p>
3-
</div>
4-
</div> <!-- end of #main -->
5-
</div> <!-- end of #wrapper -->
61
<script type="text/javascript" charset="utf-8">
7-
$(function () {
8-
$("#toc").click(function(event) {
9-
// This to ensure clicks in the #toc don't make it up to the
10-
// button handler.
11-
event.stopPropagation();
12-
});
13-
$("#toc a").click(function(event) {
14-
$("#tocbutton").click();
15-
})
16-
$("#tocbutton").click(function(event) {
17-
var target = $("#toc");
18-
if (target.css("display") !== "block") {
19-
$("body").bind("click.tocCloser", function(event) {
20-
$("#tocbutton").click();
21-
event.stopPropagation();
22-
});
2+
$(function() {
3+
var headerHeight = $("#header").height();
4+
var offsets = [];
5+
var current = -1;
6+
7+
function endpoint(scrollDistance) {
8+
if (scrollDistance < offsets[0]) {
9+
return -1;
2310
} else {
24-
$("body").unbind("click.tocCloser");
11+
for (var id = offsets.length; id > 0; id--) {
12+
if (scrollDistance > offsets[id - 1]) {
13+
return id - 1;
14+
break;
15+
}
16+
}
2517
}
26-
target.slideToggle(100);
27-
event.stopPropagation();
28-
});
18+
}
2919

30-
$("#api").click(function(event) {
31-
// This to ensure clicks in the #api don't make it up to the
32-
// button handler.
33-
event.stopPropagation();
20+
$("h2").each(function(i) {
21+
offsets.push($(this).offset().top - headerHeight)
3422
});
35-
$("#api a").click(function(event) {
36-
$("#apibutton").click();
37-
})
38-
$("#apibutton").click(function(event) {
39-
var target = $("#api");
40-
if (target.css("display") !== "block") {
41-
$("body").bind("click.apiCloser", function(event) {
42-
$("#apibutton").click();
43-
event.stopPropagation();
44-
});
45-
} else {
46-
$("body").unbind("click.apiCloser");
23+
24+
$("#content").append('<h2 class="fixed" style="display: none"><span>&nbsp;</span></h2>');
25+
var fixed_h2 = $("h2.fixed");
26+
var fixed_span = $("h2.fixed span");
27+
28+
$("#content").scroll(function() {
29+
var scrollDistance = $("#content").attr('scrollTop');
30+
var now = endpoint(scrollDistance);
31+
32+
if (now !== current) {
33+
$("#sidebar li").removeClass("current");
34+
current = now;
35+
if (current < 0) {
36+
fixed_h2.hide();
37+
} else if (current >= 0) {
38+
var heading = $($("h2 span")[current]).text();
39+
$("#sidebar a[href|=#" + heading.replace(' ', '-') + "]").parent().addClass("current");
40+
fixed_span.text(heading);
41+
fixed_h2.show();
42+
}
4743
}
48-
target.slideToggle(100);
49-
event.stopPropagation();
5044
});
5145
});
5246
</script>

docs/branding/header.html.in

Lines changed: 23 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,32 @@
11
<!DOCTYPE html>
22
<html lang="en">
33
<head>
4-
<title>%(title)s</title>
5-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
6-
<link rel="stylesheet" type="text/css" href="%(mediaroot)s/css/style.css">
7-
%(doc_style)s
8-
<script type="text/javascript" src="media/js/jquery-1.4.2.min.js"></script>
9-
<script type="text/javascript">
10-
var _gaq = _gaq || [];
11-
_gaq.push(['_setAccount', 'UA-25326304-1']);
12-
_gaq.push(['_trackPageview']);
13-
14-
(function() {
15-
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
16-
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
17-
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
18-
})();
19-
</script>
4+
<title>%(title)s</title>
5+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
6+
<link rel="stylesheet" type="text/css" href="%(mediaroot)s/css/restdown.css">
7+
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
208
</head>
219
<body>
22-
<div id="wrapper">
23-
<div id="main">
24-
<div id="fadeout"></div>
2510
<div id="header">
26-
<span id="logo">
27-
<a id="homelink" href="http://ldapjs.org">ldapjs</a>
28-
</span>
29-
30-
<a class="navbutton" href="guide.html">Guide</a>
31-
32-
<span id="apibox">
33-
<span id="apibutton" class="navbutton">API</span>
34-
<div id="api" class="popup" style="display: none">
35-
<ul>
36-
<li><div><a href="server.html">server</a></div></li>
37-
<li><div><a href="client.html">client</a></div></li>
38-
<li><div><a href="dn.html">dn</a></div></li>
39-
<li><div><a href="filters.html">filters</a></div></li>
40-
<li><div><a href="errors.html">errors</a></div></li>
41-
<li><div><a href="examples.html">examples</a></div></li>
42-
</ul>
43-
</div>
44-
</span>
11+
<h1>%(title)s Documentation</h1>
12+
</div>
13+
<div id="sidebar">
4514

46-
<span id="tocbox">
47-
<span id="tocbutton" class="navbutton">Page Contents</span>
48-
<div id="toc" class="popup" style="display: none">
49-
%(toc_html)s
50-
</div>
51-
</span>
15+
<div>Sections</div>
16+
<span>
17+
<ul>
18+
<li><div><a href="index.html">Home</a></div></li>
19+
<li><div><a href="guide.html">Guide</a></div></li>
20+
<li><div><a href="examples.html">Examples</a></div></li>
21+
<li><div><a href="client.html">Client API</a></div></li>
22+
<li><div><a href="server.html">Server API</a></div></li>
23+
<li><div><a href="dn.html">DN API</a></div></li>
24+
<li><div><a href="filters.html">Filters API</a></div></li>
25+
<li><div><a href="errors.html">Error API</a></div></li>
26+
</ul>
27+
</span>
5228

53-
<a id="githubfork" href="http://github.com/mcavage/node-ldapjs">
54-
<img src="https://a248.e.akamai.net/assets.github.com/img/abad93f42020b733148435e2cd92ce15c542d320/687474703a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f677265656e5f3030373230302e706e67"
55-
alt="Fork me on GitHub">
56-
</a>
29+
<div>Contents</div>
30+
</span>
31+
%(toc_html)s
5732
</div>

0 commit comments

Comments
 (0)