Ticket #177: persistent-collapsed.darcs

File persistent-collapsed.darcs, 5.7 kB (added by liyang, 3 years ago)
Line 
11 patch for repository http://code.haskell.org/haddock:
2
3Mon Apr 11 18:09:54 JST 2011  Liyang HU <haddock@liyang.hu>
4  * Remember collapsed sections in index.html / haddock-util.js
5
6New patches:
7
8[Remember collapsed sections in index.html / haddock-util.js
9Liyang HU <haddock@liyang.hu>**20110411090954
10 Ignore-this: 68b2c0ec5ff442607c46b00a7179e7fa
11] {
12hunk ./html/haddock-util.js 53
13 
14 function toggleSection(id)
15 {
16-  var b = toggleShow(document.getElementById("section." + id))
17-  toggleCollapser(document.getElementById("control." + id), b)
18+  var b = toggleShow(document.getElementById("section." + id));
19+  toggleCollapser(document.getElementById("control." + id), b);
20+  rememberCollapsed(id, b);
21   return b;
22 }
23 
24hunk ./html/haddock-util.js 60
25 
26+var collapsed = {};
27+function rememberCollapsed(id, b)
28+{
29+  if(b)
30+    delete collapsed[id]
31+  else
32+    collapsed[id] = null;
33+
34+  var sections = [];
35+  for(var i in collapsed)
36+  {
37+    if(collapsed.hasOwnProperty(i))
38+      sections.push(i);
39+  }
40+  // cookie specific to this page; don't use setCookie which sets path=/
41+  document.cookie = "collapsed=" + escape(sections.join('+'));
42+}
43+
44+function restoreCollapsed()
45+{
46+  var cookie = getCookie("collapsed");
47+  if(!cookie)
48+    return;
49+
50+  var ids = cookie.split('+');
51+  for(var i in ids)
52+  {
53+    if(document.getElementById("section." + ids[i]))
54+      toggleSection(ids[i]);
55+  }
56+}
57+
58+
59 function setCookie(name, value) {
60   document.cookie = name + "=" + escape(value) + ";path=/;";
61 }
62hunk ./html/haddock-util.js 344
63   addStyleMenu();
64   adjustForFrames();
65   resetStyle();
66+  restoreCollapsed();
67 }
68 
69}
70
71Context:
72
73[Indentation
74David Waern <david.waern@gmail.com>**20110522220911
75 Ignore-this: 55246d0c1b3892320426342c8a99f1fb
76]
77[Fix some stylistic issues in mkExportItems
78David Waern <david.waern@gmail.com>**20110522215352
79 Ignore-this: 38aef2684e6f98b7bda0fb0867d222b
80]
81[Break out fullContentsOf, give it a better name and some documentation
82David Waern <david.waern@gmail.com>**20110522214021
83 Ignore-this: 9b39ae4d437f52750771d38d25f37c70
84 
85 The documentation describes how we want this function to eventually behave,
86 once we have fixed a few problems with the current implementation.
87]
88[Fix a bug
89David Waern <david.waern@gmail.com>**20110522213903
90 Ignore-this: ff4ea57f9ea8f12067ee03d002e103f9
91]
92[We don't need to send DocOptions nor a flag to mkExportItems
93David Waern <david.waern@gmail.com>**20110522014544
94 Ignore-this: 5eed2837db4697c5a5597524e4ad5a86
95]
96[Use cabal's test suite support to run the test suite
97David Waern <david.waern@gmail.com>**20110522154152
98 Ignore-this: 5e91a2cfe96f9099bf80b84db9c4d7f4
99 
100 This gives up proper dependency tracking of the test script.
101]
102[Improve a haddock comment
103David Waern <david.waern@gmail.com>**20110521235756
104 Ignore-this: de1de57aa9f180c7a207ac55fe1db21d
105]
106[Add documentation for "support for blank lines in the result of examples"
107Simon Hengel <simon.hengel@wiktory.org>**20110408173650
108 Ignore-this: 7972573bbf0b1608a0405e0362551599
109]
110[Add support for blank lines in the result of examples
111Simon Hengel <simon.hengel@wiktory.org>**20110408170928
112 Ignore-this: 157d79dc570e3cc1466ddb021d11b75f
113 
114 Result lines that only contain the string "<BLANKLINE>" are treated as a blank
115 line.
116]
117[Update Haddock version in *.html.ref
118Simon Hengel <simon.hengel@wiktory.org>**20110408162849
119 Ignore-this: 32df84351b930569a1c51d4089247eec
120]
121[Update runtests.hs for GHC 7.0.2
122Simon Hengel <simon.hengel@wiktory.org>**20110408162536
123 Ignore-this: 4c20bd28ad6b668f716300c238c59d3e
124]
125[Set unit tests back to work
126Simon Hengel <simon.hengel@wiktory.org>**20110408160124
127 Ignore-this: 3cb689ad45aeef8737c530c20009d513
128 
129 Here "ghci>" was still used instead of ">>>".
130]
131[Set shell script for unit tests back to work
132Simon Hengel <simon.hengel@wiktory.org>**20110408155301
133 Ignore-this: 5f03d2f8cb87454ac8a089ad8c103f73
134]
135[TAG 2.9.2-actual
136David Waern <david.waern@gmail.com>**20110310224750
137 Ignore-this: e868ef36a55bd75215c911fd3e790488
138]
139[Fix build with ghc 7.0.1
140David Waern <david.waern@gmail.com>**20110310224731
141 Ignore-this: 54deb5ad05948ee54c831bccca4aa27f
142]
143[Update CHANGES
144David Waern <david.waern@gmail.com>**20110310224713
145 Ignore-this: 632904f16e0c1a583a68cb470b3c9fd8
146]
147[TAG GHC 7.0.2 release
148Ian Lynagh <igloo@earth.li>**20110303150237
149 Ignore-this: 7d2d831557f86917b610b68b53c73ccf
150]
151[Update Haddock to reflect change in hs_tyclds field of HsGroup
152simonpj@microsoft.com**20110110173112
153 Ignore-this: 5e6d569179da057454f23263344bcdc6
154]
155[Name the haddock script haddock-ghc-7.0.2 instead of haddock-7.0.2; #4882
156Ian Lynagh <igloo@earth.li>**20110107230657
157 "7.0.2" looked like a haddock version number before
158]
159[TAG 2.9.2
160David Waern <david.waern@gmail.com>**20110108140707
161 Ignore-this: 9d9e0a5acbeb5ba338145578fec494ab
162]
163[Bump version
164David Waern <david.waern@gmail.com>**20110108140644
165 Ignore-this: ca23159d2ba1168a8b6c97454a2a67de
166]
167[Follow GHC build system changes
168Ian Lynagh <igloo@earth.li>**20110107023311
169 Ignore-this: dc59b6a8c15641bde334926445a3efdd
170]
171[Fix spelling error - contributed by Marco Silva
172David Waern <david.waern@gmail.com>**20110122160944
173 Ignore-this: 41872c8ace5814c45dd8baeb016be63a
174]
175[Put title outside doc div when HTML:fying title+prologue
176David Waern <david.waern@gmail.com>**20110122000035
177 Ignore-this: 5f3cd275489f06248f814c6f67fd6709
178 
179 Avoids indenting the title, and makes more sense since the title
180 is not a doc string anyway.
181]
182[Write hoogle output in utf8; fixes GHC build on Windows
183Ian Lynagh <igloo@earth.li>**20110105182427
184 Ignore-this: 5c69fa9f33227e4df76524c8fbeef34d
185]
186[TAG 2.9.1
187David Waern <david.waern@gmail.com>**20101219180649
188 Ignore-this: 24e440e93a68f24bc93d3906bf93c040
189]
190Patch bundle hash:
19159addae43a1f055926737ab77832f6c8b48f1522