Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add Previous/Next section navigation bar (Experimental)

  • Loading branch information...
commit f7d43c203312419e630cec897ffef4b8f1e24cee 1 parent 28667f3
@cbonte authored
View
2  haproxy-dconv.py
@@ -296,7 +296,7 @@ def convert(infile, outfile):
chapterIndexes = sorted(chapters.keys())
if level == 1:
documentAppend("<div class=\"page-header\">", False)
- documentAppend("<h%d><small>%s.</small> %s</h%d>" % (level, details["chapter"], cgi.escape(title, True), level))
+ documentAppend("<h%d id=\"%s\"><small>%s.</small> %s</h%d>" % (level, details["chapter"], details["chapter"], cgi.escape(title, True), level))
if level == 1:
documentAppend("</div>", False)
View
3  templates/summary.html
@@ -1,5 +1,6 @@
+<a name="summary"></a>
<div class="page-header">
- <h1>Summary</h1>
+ <h1 id="summary">Summary</h1>
</div>
<div class="row-fluid">
<div class="span6">
View
46 templates/template.html
@@ -13,7 +13,7 @@
<a class="brand" href="#">${headers['title']} ${headers['subtitle']}</a>
<ul class="nav">
<li class="divider-vertical"></li>
- <li><a href="http://haproxy.1wt.eu/">HAProxy home page</a></li>
+ <li><a href="http://haproxy.1wt.eu/">HAProxy home page</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
Versions
@@ -50,6 +50,18 @@
</div>
</div>
</div>
+ <div class="navbar navbar-fixed-bottom">
+ <div class="navbar-inner">
+ <div class="container">
+ <ul class="nav">
+ <li id="previous"></li>
+ </ul>
+ <ul class="nav pull-right">
+ <li id="next"></li>
+ </ul>
+ </div>
+ </div>
+ </div>
<div class="container">
<div class="pagination-right">
<small>Converted with <a href="http://github.com/cbonte/haproxy-dconv">haproxy-dconv</a> v<b>${version}</b> on <b>${date}</b></small>
@@ -86,6 +98,7 @@
<script src="bootstrap/js/bootstrap.min.js"></script>
<script>
+ /* Keyword search */
var keywords = [
"${'",\n\t\t\t\t"'.join(keywords)}"
];
@@ -108,6 +121,37 @@
return item
}
})
+
+ /* EXPERIMENTAL - Previous/Next navigation */
+ var headings = $(":header");
+ function refreshNavigation() {
+ var previous = false
+ var next = false
+ $.each(headings, function(item, value) {
+ var el = $(value)
+ if (! el.attr('id')) return true
+ if (el.offset().top < $(window).scrollTop()) {
+ previous = el
+ }
+ if (el.offset().top - 1 > $(window).scrollTop()) {
+ next = el
+ }
+ if (next) return false
+ })
+ $('#previous').html(
+ previous && previous.attr('id') ? '<a href="#' + previous.attr('id') + '">&larr; ' + previous.text() + '</a>' : '<a href="#top">&larr; Top</a>'
+ )
+ $('#next').html(
+ next && next.attr('id') ? '<a href="#' + next.attr('id') + '">' + next.text() + ' &rarr;</a>' : '<a href="#bottom">Bottom &rarr;</a>'
+ )
+ }
+
+ $(window).scroll(function () {
+ refreshNavigation()
+ });
+ $(document).ready(function() {
+ refreshNavigation()
+ });
</script>
<!-- Piwik -->
Please sign in to comment.
Something went wrong with that request. Please try again.