12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- function ahTocBuildToc() {
- var context = $('div.advanced-help-topic');
- var elements = $('*', context).filter(function (index) {
- return ['H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'H7'].indexOf(this.nodeName) != -1;
- });
-
- if (elements.length <= 1) {
- return;
- }
-
- var list = "<ul>\n";
- elements.each(function() {
- list += '<li class="' + this.nodeName.toLowerCase() + '">'
- + $(this).text() + "</li>\n";
- })
- list += "</ul>\n";
-
- $('div.ah-toc', context).remove();
-
-
- context.prepend('<div class="ah-toc"><center>Contents</center></div>');
- $('div.ah-toc').append(list);
- return elements;
- }
- $(ahTocBuildToc);
|