forked from travis-ci/travis-ci.github.com
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsite.js
More file actions
22 lines (20 loc) · 612 Bytes
/
site.js
File metadata and controls
22 lines (20 loc) · 612 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
$(function(){
var cname = function(name) {
return name.replace(/[ \/<>]/g, '-');
}
var list;
if ( $("#toc").length ) {
list = $("<ul />");
$("#toc").append(list);
}
$('#main').children(":header:not(h1):not(h2.title)").each(function(i) {
var current = $(this);
var text = current.text();
var id = cname(text);
current.attr("id", id);
current.append(' <a class=\"toc-anchor\" href=\"#' + encodeURIComponent(id) + '\">#</a>');
if(current.is("h2") && list){
list.append("<li><a href=\"#" + encodeURIComponent(id) + "\">" + text + "</a></li>");
}
});
});