aboutsummaryrefslogtreecommitdiffstats
path: root/bootstrap2-dark/static/js/autosidebar.js
diff options
context:
space:
mode:
authorfrantic1048 <franticblack@163.com>2013-07-11 01:32:20 +0800
committerfrantic1048 <franticblack@163.com>2013-07-11 01:32:20 +0800
commit19c2d742273c5933a9a929976310a91fa629a8c4 (patch)
treec784da02e5b9a95177848794e79945f0f6a55fe9 /bootstrap2-dark/static/js/autosidebar.js
parent376467725ab3d14e1d59e20a74b54be84ed805a8 (diff)
downloadpelican-themes-19c2d742273c5933a9a929976310a91fa629a8c4.tar.gz
New theme bootstrap2-dark
Dark version of bootstrap2 theme
Diffstat (limited to 'bootstrap2-dark/static/js/autosidebar.js')
-rw-r--r--bootstrap2-dark/static/js/autosidebar.js30
1 files changed, 30 insertions, 0 deletions
diff --git a/bootstrap2-dark/static/js/autosidebar.js b/bootstrap2-dark/static/js/autosidebar.js
new file mode 100644
index 0000000..b9cef7e
--- /dev/null
+++ b/bootstrap2-dark/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