summaryrefslogtreecommitdiff
path: root/static
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.net>2010-04-07 04:55:32 +0200
committerRené 'Necoro' Neumann <necoro@necoro.net>2010-04-07 04:55:32 +0200
commit98d2d9833d04a88d2e1b1f6f92668190d8d36195 (patch)
treedc50da3191ae54af1189d00602d536c743acc610 /static
parent9752e9bdf8dade02c24b6fff08bd9fba7ac75911 (diff)
downloadweb-98d2d9833d04a88d2e1b1f6f92668190d8d36195.tar.gz
web-98d2d9833d04a88d2e1b1f6f92668190d8d36195.tar.bz2
web-98d2d9833d04a88d2e1b1f6f92668190d8d36195.zip
Javascript to generate TOCs
Diffstat (limited to 'static')
-rw-r--r--static/js/toc.js31
1 files changed, 31 insertions, 0 deletions
diff --git a/static/js/toc.js b/static/js/toc.js
new file mode 100644
index 0000000..5fbba70
--- /dev/null
+++ b/static/js/toc.js
@@ -0,0 +1,31 @@
+function createToc(pages) {
+ var tdiv = document.getElementById("toc");
+ if (tdiv)
+ {
+ var a = tdiv.appendChild(document.createElement('span'));
+ // a.onclick = showhideToc;
+ a.id = 'contentheader';
+ a.innerHTML = 'Contents';
+
+ var ldiv = tdiv.appendChild(document.createElement('ul'));
+ ldiv.id = 'innertoc';
+
+ for (key in pages) {
+ var link = ldiv.appendChild(document.createElement('li')).appendChild(document.createElement('a'));
+ link.innerHTML = pages[key];
+ link.className = 'tocLink';
+ link.href = '#' + key;
+ }
+
+ // showhideToc();
+ }
+}
+
+var TocState = 'none';
+
+function showhideToc() {
+ TocState = (TocState == 'none') ? 'block' : 'none';
+ var newText = (TocState == 'none') ? 'show page contents' : 'hide page contents';
+ document.getElementById('contentheader').innerHTML = newText;
+ document.getElementById('innertoc').style.display = TocState;
+}