aboutsummaryrefslogtreecommitdiffstats
path: root/bootstrap2/static/js/autosidebar.js
diff options
context:
space:
mode:
authorm-r-r <skami@skami-laptop.dyndns.org>2012-06-22 07:57:12 +0000
committerm-r-r <skami@skami-laptop.dyndns.org>2012-06-22 07:57:12 +0000
commit98f0d46f2bbddf86e8d202b533af35fa79da2d2f (patch)
tree297d677cfa76bb20d4e80803343c69b99c939e37 /bootstrap2/static/js/autosidebar.js
parent2950b6abdad62fdd74682880acdec32f9b417420 (diff)
parent83892b7112e27721218556c4030cdd5c8d26f98b (diff)
downloadpelican-themes-98f0d46f2bbddf86e8d202b533af35fa79da2d2f.tar.gz
[dev-random] resolved conflicts
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..b9cef7e
--- /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(
+ "<li class=\"nav-header\"><h4>"+$(this).children()[0].justtext()+"</h4></li>"
+ );
+ ul = $("<ul>");
+ $("h2",$(this).parent().parent()).each(function(){
+ ul.append(
+ "<li class=\"nav-header\"><h5>"+$(this).justtext()+"</h5></li>"
+ );
+ subul = $("<ul>");
+ $("h3",$(this).parent()).each(function(){
+ subul.append(
+ "<li class=\"nav-header\"><h6>"+$(this).justtext()+"</h6></li>"
+ );
+ });
+ ul.append(subul);
+ });
+ $("#sidebar").append(ul);
+ });
+}); \ No newline at end of file