Skip to content

Commit

Permalink
Adding TOC script
Browse files Browse the repository at this point in the history
  • Loading branch information
bleroy committed Nov 4, 2011
1 parent 726691e commit 55eacf6
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions Scripts/toc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
jQuery(function($) {
var toc = $("#TocContainer ol");
$("#MainDiv :header")
.each(function() {
var h = $(this),
name = h.text().replace(/[\s,-;\.]/g, "");
h.before($("<a/>", {name: name}));
toc.append(
$("<li></li>").append(
$("<a/>", {
href: "#" + name
})
.append($("<" + this.tagName + "/>", {
html: h.text().replace(/\s/g, "&nbsp;")
}))
)
);
});
});

0 comments on commit 55eacf6

Please sign in to comment.