(function($) {
$(document).ready(function() {
/** -----------------------------------------------
* TABLE OF CONTENTS
*
* Transform a #table-of-contents div to a nested list
*/
if($("#table-of-contents").length > 0) {
var toc = '
In this document:
';
$('#left-column h1, #left-column h2, #left-column h3, #left-column h4').each(function(i) {
var current = $(this);
current.attr('id', 'title' + i);
toc += '- ' + current.html() + '
';
});
toc += '
';
$('#table-of-contents').prepend(toc);
}
});
})(jQuery);