aboutsummaryrefslogtreecommitdiff
path: root/html/haddock-util.js
diff options
context:
space:
mode:
authorDavid Waern <david.waern@gmail.com>2011-10-01 01:56:48 +0200
committerDavid Waern <david.waern@gmail.com>2011-10-01 01:56:48 +0200
commita26a25d047f68051f9e1419a0cec515b62ad7e21 (patch)
treef93f0f390ed3ac6a704cd614685b249736f15c14 /html/haddock-util.js
parent64c6e2464fb3a9207e01b01a17c815284e49808b (diff)
parentb50695a86358fd02b9a0ececbc107bf5274d5f95 (diff)
Merge branch 'development'
Diffstat (limited to 'html/haddock-util.js')
-rw-r--r--html/haddock-util.js37
1 files changed, 35 insertions, 2 deletions
diff --git a/html/haddock-util.js b/html/haddock-util.js
index 4a7e4255..9a6fccf7 100644
--- a/html/haddock-util.js
+++ b/html/haddock-util.js
@@ -50,11 +50,43 @@ toggleCollapser = makeClassToggle("collapser", "expander");
function toggleSection(id)
{
- var b = toggleShow(document.getElementById("section." + id))
- toggleCollapser(document.getElementById("control." + id), b)
+ var b = toggleShow(document.getElementById("section." + id));
+ toggleCollapser(document.getElementById("control." + id), b);
+ rememberCollapsed(id, b);
return b;
}
+var collapsed = {};
+function rememberCollapsed(id, b)
+{
+ if(b)
+ delete collapsed[id]
+ else
+ collapsed[id] = null;
+
+ var sections = [];
+ for(var i in collapsed)
+ {
+ if(collapsed.hasOwnProperty(i))
+ sections.push(i);
+ }
+ // cookie specific to this page; don't use setCookie which sets path=/
+ document.cookie = "collapsed=" + escape(sections.join('+'));
+}
+
+function restoreCollapsed()
+{
+ var cookie = getCookie("collapsed");
+ if(!cookie)
+ return;
+
+ var ids = cookie.split('+');
+ for(var i in ids)
+ {
+ if(document.getElementById("section." + ids[i]))
+ toggleSection(ids[i]);
+ }
+}
function setCookie(name, value) {
document.cookie = name + "=" + escape(value) + ";path=/;";
@@ -307,5 +339,6 @@ function pageLoad() {
addStyleMenu();
adjustForFrames();
resetStyle();
+ restoreCollapsed();
}