]> git.somenet.org - somenet/www-somenet-org.git/blob - theme/js/autosidebar.js
make git-publish build 2023-12-25T02:16:36+01:00
[somenet/www-somenet-org.git] / theme / js / autosidebar.js
1 jQuery.fn.justtext = function() {
2     return $(this).clone()
3             .children()
4             .remove()
5             .end()
6             .text();
7  
8 };
9
10 $(document).ready(function(){
11    $("h1").each(function(){
12         $("#sidebar").append(
13             "<li class=\"nav-header\"><h4>"+$(this).children()[0].justtext()+"</h4></li>"
14         );
15         ul = $("<ul>");
16         $("h2",$(this).parent().parent()).each(function(){
17             ul.append(
18             "<li class=\"nav-header\"><h5>"+$(this).justtext()+"</h5></li>"
19             );
20             subul = $("<ul>");
21             $("h3",$(this).parent()).each(function(){
22                 subul.append(
23                 "<li class=\"nav-header\"><h6>"+$(this).justtext()+"</h6></li>"
24                 );
25             });
26             ul.append(subul);
27         });
28         $("#sidebar").append(ul);
29    });
30 });