1 function toggle_visibility(e) {
2 if(e.style.display == 'none') {
3 e.style.display = 'block';
6 e.style.display = 'none';
12 function createCookie(name,value,days) {
14 var date = new Date();
15 date.setTime(date.getTime()+(days*24*60*60*1000));
16 var expires = "; expires="+date.toGMTString();
18 else var expires = "";
19 document.cookie = name+"="+value+expires+"; path=/";
22 function readCookie(name) {
23 var nameEQ = name + "=";
24 var ca = document.cookie.split(';');
25 for(var i=0;i < ca.length;i++) {
27 while (c.charAt(0)==' ') c = c.substring(1,c.length);
28 if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
37 function popOutTOC(original_toc, p0) {
38 var t = original_toc.cloneNode(true);
40 var c = document.getElementsByClassName("contents")[0];
41 var left = c.style.marginLeft;
42 c.style.marginLeft = "20.5em";
43 document.body.insertBefore(t,c);
45 t.style.top = menubar.clientHeight;
46 t.style.maxHeight = "none";
47 t.style.display = "block";
49 var p = t.getElementsByClassName("popoutlink")[0];
50 p.innerHTML = "close";
51 p.onclick = function() {
52 t.parentNode.removeChild(t);
53 c.style.marginLeft = left;
54 p0.style.display = "";
56 sessionStorage.popToc = "no";
59 var x = document.createElement("div");
61 x.innerHTML = "Table of contents";
62 t.insertBefore(x,p.nextSibling);
63 p0.style.display = "none";
67 sessionStorage.popToc = "yes";
70 function resize_handler() {
71 var height = window.innerHeight - menubar.clientHeight - 20;
73 sidetoc.style.height = height;
75 toc.style.maxHeight = height * 0.75;
78 function addInheritedMethods() {
79 if(!document.getElementById("filename")) return; // hackish trick, only class-docs has a 'filename' div.
80 var doc = docmap["Classes/"+document.title];
82 var sups = doc.superclasses;
84 var divs = [document.getElementById("inheritedclassmets"), document.getElementById("inheritedinstmets")];
85 for(var i=0;i<sups.length;i++) {
86 var s = docmap["Classes/"+sups[i]];
88 for(var j=0;j<2;j++) {
89 d[j] = document.createElement("ul");
90 d[j].className = "inheritedmets";
91 d[j].style.display = "none";
93 var mets = s.methods.sort();
94 for(var j=0;j<mets.length;j++) {
96 if(doc.methods.indexOf(m)<0) { // ignore methods already documented in this helpfile
97 var li = document.createElement("li");
98 li.innerHTML = "<a href='"+helpRoot+"/"+s.path+".html#"+m.slice(1)+"'>"+m.slice(2)+"</a>";
100 d[0].appendChild(li);
103 d[1].appendChild(li);
107 for(var j=0;j<2;j++) {
108 var count = d[j].childElementCount;
110 var x = document.createElement("div");
111 var show = "► show";
112 var hide = "▼ hide";
113 x.className = "inheritedmets_class";
114 x.innerHTML = count+" methods from <a href='"+helpRoot+"/"+s.path+".html'>"+s.title+"</a> ";
115 divs[j].appendChild(x);
117 var a = document.createElement("a");
118 a.className = "inheritedmets_toggle";
119 a.setAttribute("href","#");
121 a.onclick = function() {
122 if(z.style.display == "none") {
123 z.style.display = "block";
126 z.style.display = "none";
133 divs[j].appendChild(d[j]);
140 // make all code examples editable!
141 var x = document.getElementsByClassName("lang-sc");
142 for(var i=0;i<x.length;i++) {
144 e.setAttribute("contentEditable",true);
145 /* FIXME: select whole line. hopefully this happens before WebView responds to the key event??
146 e.onkeydown = function(ev) {
147 if(ev.keycode == 13 && ev.ctrlKey == true || ev.shiftKey == true) {
148 // s = window.getSelection()
149 // if(s.isCollapsed) {
150 // find nodes at start and end of (or start of next) line
151 // s.removeAllRanges();
152 // r=document.createRange(); r.setStart(start,0); r.setEnd(end,0); s.addRange(r)
159 addInheritedMethods();
161 if(sessionStorage == undefined)
167 var toggleMenu = function(e) {
169 openMenu.style.display = 'none';
172 e.style.display = 'block';
175 openMenu = undefined;
180 document.onclick = function() {
181 if(openMenu && !inMenu) {
182 openMenu.style.display = 'none';
183 openMenu = undefined;
190 var bar = document.getElementById("menubar");
192 var nav = ["Home","Browse","Search"];
193 var url = ["Help.html","Browse.html","Search.html"];
194 for(var i=0;i<nav.length;i++) {
195 var li = document.createElement("li");
196 li.className = "menuitem";
197 var a = document.createElement("a");
198 a.innerHTML = nav[i];
199 a.setAttribute("href",helpRoot+"/"+url[i]);
200 a.className = "navLink";
205 var li = document.createElement("li");
206 li.className = "menuitem";
207 var a = document.createElement("a");
208 a.innerHTML = "Indexes ▼";
209 a.setAttribute("href","#");
210 var m1 = document.createElement("div");
211 m1.className = "submenu";
212 m1.style.display = "none";
213 a.onclick = function() {
217 var nav = ["Documents","Classes","Methods"];
218 for(var i=0;i<nav.length;i++) {
219 var b = document.createElement("a");
220 b.setAttribute("href",helpRoot+"/Overviews/"+nav[i]+".html");
221 b.innerHTML = nav[i];
228 var li = document.createElement("li");
229 li.className = "menuitem";
230 var x = document.createElement("span");
231 x.id = "topdoctitle";
232 x.appendChild(document.createTextNode(document.title));
233 x.onclick = function() {
240 var t = document.getElementById("toc");
243 x.appendChild(document.createTextNode(" - "));
244 t.style.display = 'none';
245 t.onclick = function() {
246 t.style.display = 'none';
247 openMenu = undefined;
251 var a = document.createElement("a");
252 a.setAttribute("href","#");
253 a.innerHTML = "Table of contents ▼";
255 a.onclick = function() {
259 li.appendChild(t.parentNode.removeChild(t));
260 var p = document.createElement("a");
261 p.setAttribute("href","#");
262 p.className = "popoutlink";
263 p.innerHTML = "pop out";
264 p.onclick = function() {
269 t.insertBefore(p,t.firstChild);
271 if(sessionStorage.popToc == "yes") {
275 window.onresize = resize_handler;