aboutsummaryrefslogtreecommitdiffstats
path: root/bootstrap2/static/js/autosidebar.js
diff options
context:
space:
mode:
Diffstat (limited to 'bootstrap2/static/js/autosidebar.js')
-rw-r--r--bootstrap2/static/js/autosidebar.js30
1 files changed, 30 insertions, 0 deletions
diff --git a/bootstrap2/static/js/autosidebar.js b/bootstrap2/static/js/autosidebar.js
new file mode 100644
index 0000000..2f4a6d2
--- /dev/null
+++ b/bootstrap2/static/js/autosidebar.js
@@ -0,0 +1,30 @@
+jQuery.fn.justtext = function() {
+ return $(this).clone()
+ .children()
+ .remove()
+ .end()
+ .text();
+
+};
+
+$(document).ready(function(){
+ $("h1").each(function(){
+ $("#sidebar").append(
+ "<h4><a href='#'>"+$(this).justtext()+"</a></h4>"
+ );
+ ul = $("<ul>");
+ $("h2",$(this).parent().parent()).each(function(){
+ ul.append(
+ "<li><a href='#'>"+$(this).justtext()+"</a></li>"
+ );
+ subul = $("<ul>");
+ $("h3",$(this).parent()).each(function(){
+ subul.append(
+ "<li><a href='#'>"+$(this).justtext()+"</a></li>"
+ );
+ });
+ ul.append(subul);
+ });
+ $("#sidebar").append(ul);
+ });
+}); \ No newline at end of file