mirror of
https://github.com/valitydev/salt.git
synced 2024-11-09 01:36:48 +00:00
6a2936886f
The initial problem was, that the <li> elements for the JS-generated TOC weren't placed inside <ul></ul>, but after it.
32 lines
681 B
HTML
32 lines
681 B
HTML
<div id="module-funcs"></div>
|
|
|
|
<script>
|
|
jQuery.fn.local_toc = function(tgt_sel) {
|
|
var tgt = jQuery(tgt_sel);
|
|
|
|
tgt.append('<h4>Table of Contents</h4>');
|
|
|
|
tgt.append('<ul></ul>');
|
|
jQuery('dt .headerlink').each(function(idx, elem) {
|
|
|
|
var i = [
|
|
'<li><a href="', elem.href, '">',
|
|
last(elem.href.split('.')),
|
|
'</a></li>']
|
|
.join('');
|
|
|
|
jQuery(tgt_sel + '> ul').append(i);
|
|
});
|
|
|
|
function last(list) {
|
|
return list[list.length - 1];
|
|
}
|
|
};
|
|
</script>
|
|
|
|
<script>
|
|
;(function($) {
|
|
$.fn.local_toc('#module-funcs');
|
|
})(jQuery);
|
|
</script>
|