VERB_code_2.3
navtree.js
1 var NAVTREE =
2 [
3  [ "VERB_code_2.2", "index.html", [
4  [ "Todo List", "todo.html", null ],
5  [ "Namespaces", null, [
6  [ "Namespace List", "namespaces.html", "namespaces" ],
7  [ "Namespace Members", "namespacemembers.html", [
8  [ "All", "namespacemembers.html", null ],
9  [ "Functions", "namespacemembers_func.html", null ],
10  [ "Variables", "namespacemembers_vars.html", null ]
11  ] ]
12  ] ],
13  [ "Classes", null, [
14  [ "Class List", "annotated.html", "annotated" ],
15  [ "Class Hierarchy", "hierarchy.html", "hierarchy" ],
16  [ "Class Members", "functions.html", [
17  [ "All", "functions.html", "functions_dup" ],
18  [ "Functions", "functions_func.html", null ],
19  [ "Variables", "functions_vars.html", null ]
20  ] ]
21  ] ],
22  [ "Files", null, [
23  [ "File List", "files.html", "files" ],
24  [ "File Members", "globals.html", [
25  [ "All", "globals.html", null ],
26  [ "Functions", "globals_func.html", null ],
27  [ "Variables", "globals_vars.html", null ],
28  [ "Typedefs", "globals_type.html", null ],
29  [ "Macros", "globals_defs.html", null ]
30  ] ]
31  ] ]
32  ] ]
33 ];
34 
35 var NAVTREEINDEX =
36 [
37 "_additional_sources_and_losses_8cpp.html",
38 "class_grid.html#a846df308970fb4fccf6d0f7f0a944faf",
39 "index.html",
40 "various_functions_8h.html#a39875c2042f035db0b6f2423c8b5bb4a"
41 ];
42 
43 var SYNCONMSG = 'click to disable panel synchronisation';
44 var SYNCOFFMSG = 'click to enable panel synchronisation';
45 var navTreeSubIndices = new Array();
46 
47 function getData(varName)
48 {
49  var i = varName.lastIndexOf('/');
50  var n = i>=0 ? varName.substring(i+1) : varName;
51  return eval(n.replace(/\-/g,'_'));
52 }
53 
54 function stripPath(uri)
55 {
56  return uri.substring(uri.lastIndexOf('/')+1);
57 }
58 
59 function stripPath2(uri)
60 {
61  var i = uri.lastIndexOf('/');
62  var s = uri.substring(i+1);
63  var m = uri.substring(0,i+1).match(/\/d\w\/d\w\w\/$/);
64  return m ? uri.substring(i-6) : s;
65 }
66 
67 function localStorageSupported()
68 {
69  try {
70  return 'localStorage' in window && window['localStorage'] !== null && window.localStorage.getItem;
71  }
72  catch(e) {
73  return false;
74  }
75 }
76 
77 
78 function storeLink(link)
79 {
80  if (!$("#nav-sync").hasClass('sync') && localStorageSupported()) {
81  window.localStorage.setItem('navpath',link);
82  }
83 }
84 
85 function deleteLink()
86 {
87  if (localStorageSupported()) {
88  window.localStorage.setItem('navpath','');
89  }
90 }
91 
92 function cachedLink()
93 {
94  if (localStorageSupported()) {
95  return window.localStorage.getItem('navpath');
96  } else {
97  return '';
98  }
99 }
100 
101 function getScript(scriptName,func,show)
102 {
103  var head = document.getElementsByTagName("head")[0];
104  var script = document.createElement('script');
105  script.id = scriptName;
106  script.type = 'text/javascript';
107  script.onload = func;
108  script.src = scriptName+'.js';
109  if ($.browser.msie && $.browser.version<=8) {
110  // script.onload does not work with older versions of IE
111  script.onreadystatechange = function() {
112  if (script.readyState=='complete' || script.readyState=='loaded') {
113  func(); if (show) showRoot();
114  }
115  }
116  }
117  head.appendChild(script);
118 }
119 
120 function createIndent(o,domNode,node,level)
121 {
122  var level=-1;
123  var n = node;
124  while (n.parentNode) { level++; n=n.parentNode; }
125  var imgNode = document.createElement("img");
126  imgNode.style.paddingLeft=(16*level).toString()+'px';
127  imgNode.width = 16;
128  imgNode.height = 22;
129  imgNode.border = 0;
130  if (node.childrenData) {
131  node.plus_img = imgNode;
132  node.expandToggle = document.createElement("a");
133  node.expandToggle.href = "javascript:void(0)";
134  node.expandToggle.onclick = function() {
135  if (node.expanded) {
136  $(node.getChildrenUL()).slideUp("fast");
137  node.plus_img.src = node.relpath+"ftv2pnode.png";
138  node.expanded = false;
139  } else {
140  expandNode(o, node, false, false);
141  }
142  }
143  node.expandToggle.appendChild(imgNode);
144  domNode.appendChild(node.expandToggle);
145  imgNode.src = node.relpath+"ftv2pnode.png";
146  } else {
147  imgNode.src = node.relpath+"ftv2node.png";
148  domNode.appendChild(imgNode);
149  }
150 }
151 
152 var animationInProgress = false;
153 
154 function gotoAnchor(anchor,aname,updateLocation)
155 {
156  var pos, docContent = $('#doc-content');
157  if (anchor.parent().attr('class')=='memItemLeft' ||
158  anchor.parent().attr('class')=='fieldtype' ||
159  anchor.parent().is(':header'))
160  {
161  pos = anchor.parent().position().top;
162  } else if (anchor.position()) {
163  pos = anchor.position().top;
164  }
165  if (pos) {
166  var dist = Math.abs(Math.min(
167  pos-docContent.offset().top,
168  docContent[0].scrollHeight-
169  docContent.height()-docContent.scrollTop()));
170  animationInProgress=true;
171  docContent.animate({
172  scrollTop: pos + docContent.scrollTop() - docContent.offset().top
173  },Math.max(50,Math.min(500,dist)),function(){
174  if (updateLocation) window.location.href=aname;
175  animationInProgress=false;
176  });
177  }
178 }
179 
180 function newNode(o, po, text, link, childrenData, lastNode)
181 {
182  var node = new Object();
183  node.children = Array();
184  node.childrenData = childrenData;
185  node.depth = po.depth + 1;
186  node.relpath = po.relpath;
187  node.isLast = lastNode;
188 
189  node.li = document.createElement("li");
190  po.getChildrenUL().appendChild(node.li);
191  node.parentNode = po;
192 
193  node.itemDiv = document.createElement("div");
194  node.itemDiv.className = "item";
195 
196  node.labelSpan = document.createElement("span");
197  node.labelSpan.className = "label";
198 
199  createIndent(o,node.itemDiv,node,0);
200  node.itemDiv.appendChild(node.labelSpan);
201  node.li.appendChild(node.itemDiv);
202 
203  var a = document.createElement("a");
204  node.labelSpan.appendChild(a);
205  node.label = document.createTextNode(text);
206  node.expanded = false;
207  a.appendChild(node.label);
208  if (link) {
209  var url;
210  if (link.substring(0,1)=='^') {
211  url = link.substring(1);
212  link = url;
213  } else {
214  url = node.relpath+link;
215  }
216  a.className = stripPath(link.replace('#',':'));
217  if (link.indexOf('#')!=-1) {
218  var aname = '#'+link.split('#')[1];
219  var srcPage = stripPath($(location).attr('pathname'));
220  var targetPage = stripPath(link.split('#')[0]);
221  a.href = srcPage!=targetPage ? url : "javascript:void(0)";
222  a.onclick = function(){
223  storeLink(link);
224  if (!$(a).parent().parent().hasClass('selected'))
225  {
226  $('.item').removeClass('selected');
227  $('.item').removeAttr('id');
228  $(a).parent().parent().addClass('selected');
229  $(a).parent().parent().attr('id','selected');
230  }
231  var anchor = $(aname);
232  gotoAnchor(anchor,aname,true);
233  };
234  } else {
235  a.href = url;
236  a.onclick = function() { storeLink(link); }
237  }
238  } else {
239  if (childrenData != null)
240  {
241  a.className = "nolink";
242  a.href = "javascript:void(0)";
243  a.onclick = node.expandToggle.onclick;
244  }
245  }
246 
247  node.childrenUL = null;
248  node.getChildrenUL = function() {
249  if (!node.childrenUL) {
250  node.childrenUL = document.createElement("ul");
251  node.childrenUL.className = "children_ul";
252  node.childrenUL.style.display = "none";
253  node.li.appendChild(node.childrenUL);
254  }
255  return node.childrenUL;
256  };
257 
258  return node;
259 }
260 
261 function showRoot()
262 {
263  var headerHeight = $("#top").height();
264  var footerHeight = $("#nav-path").height();
265  var windowHeight = $(window).height() - headerHeight - footerHeight;
266  (function (){ // retry until we can scroll to the selected item
267  try {
268  var navtree=$('#nav-tree');
269  navtree.scrollTo('#selected',0,{offset:-windowHeight/2});
270  } catch (err) {
271  setTimeout(arguments.callee, 0);
272  }
273  })();
274 }
275 
276 function expandNode(o, node, imm, showRoot)
277 {
278  if (node.childrenData && !node.expanded) {
279  if (typeof(node.childrenData)==='string') {
280  var varName = node.childrenData;
281  getScript(node.relpath+varName,function(){
282  node.childrenData = getData(varName);
283  expandNode(o, node, imm, showRoot);
284  }, showRoot);
285  } else {
286  if (!node.childrenVisited) {
287  getNode(o, node);
288  } if (imm || ($.browser.msie && $.browser.version>8)) {
289  // somehow slideDown jumps to the start of tree for IE9 :-(
290  $(node.getChildrenUL()).show();
291  } else {
292  $(node.getChildrenUL()).slideDown("fast");
293  }
294  if (node.isLast) {
295  node.plus_img.src = node.relpath+"ftv2mlastnode.png";
296  } else {
297  node.plus_img.src = node.relpath+"ftv2mnode.png";
298  }
299  node.expanded = true;
300  }
301  }
302 }
303 
304 function glowEffect(n,duration)
305 {
306  n.addClass('glow').delay(duration).queue(function(next){
307  $(this).removeClass('glow');next();
308  });
309 }
310 
311 function highlightAnchor()
312 {
313  var aname = $(location).attr('hash');
314  var anchor = $(aname);
315  if (anchor.parent().attr('class')=='memItemLeft'){
316  var rows = $('.memberdecls tr[class$="'+
317  window.location.hash.substring(1)+'"]');
318  glowEffect(rows.children(),300); // member without details
319  } else if (anchor.parents().slice(2).prop('tagName')=='TR') {
320  glowEffect(anchor.parents('div.memitem'),1000); // enum value
321  } else if (anchor.parent().attr('class')=='fieldtype'){
322  glowEffect(anchor.parent().parent(),1000); // struct field
323  } else if (anchor.parent().is(":header")) {
324  glowEffect(anchor.parent(),1000); // section header
325  } else {
326  glowEffect(anchor.next(),1000); // normal member
327  }
328  gotoAnchor(anchor,aname,false);
329 }
330 
331 function selectAndHighlight(hash,n)
332 {
333  var a;
334  if (hash) {
335  var link=stripPath($(location).attr('pathname'))+':'+hash.substring(1);
336  a=$('.item a[class$="'+link+'"]');
337  }
338  if (a && a.length) {
339  a.parent().parent().addClass('selected');
340  a.parent().parent().attr('id','selected');
341  highlightAnchor();
342  } else if (n) {
343  $(n.itemDiv).addClass('selected');
344  $(n.itemDiv).attr('id','selected');
345  }
346  if ($('#nav-tree-contents .item:first').hasClass('selected')) {
347  $('#nav-sync').css('top','30px');
348  } else {
349  $('#nav-sync').css('top','5px');
350  }
351  showRoot();
352 }
353 
354 function showNode(o, node, index, hash)
355 {
356  if (node && node.childrenData) {
357  if (typeof(node.childrenData)==='string') {
358  var varName = node.childrenData;
359  getScript(node.relpath+varName,function(){
360  node.childrenData = getData(varName);
361  showNode(o,node,index,hash);
362  },true);
363  } else {
364  if (!node.childrenVisited) {
365  getNode(o, node);
366  }
367  $(node.getChildrenUL()).show();
368  if (node.isLast) {
369  node.plus_img.src = node.relpath+"ftv2mlastnode.png";
370  } else {
371  node.plus_img.src = node.relpath+"ftv2mnode.png";
372  }
373  node.expanded = true;
374  var n = node.children[o.breadcrumbs[index]];
375  if (index+1<o.breadcrumbs.length) {
376  showNode(o,n,index+1,hash);
377  } else {
378  if (typeof(n.childrenData)==='string') {
379  var varName = n.childrenData;
380  getScript(n.relpath+varName,function(){
381  n.childrenData = getData(varName);
382  node.expanded=false;
383  showNode(o,node,index,hash); // retry with child node expanded
384  },true);
385  } else {
386  var rootBase = stripPath(o.toroot.replace(/\..+$/, ''));
387  if (rootBase=="index" || rootBase=="pages" || rootBase=="search") {
388  expandNode(o, n, true, true);
389  }
390  selectAndHighlight(hash,n);
391  }
392  }
393  }
394  } else {
395  selectAndHighlight(hash);
396  }
397 }
398 
399 function getNode(o, po)
400 {
401  po.childrenVisited = true;
402  var l = po.childrenData.length-1;
403  for (var i in po.childrenData) {
404  var nodeData = po.childrenData[i];
405  po.children[i] = newNode(o, po, nodeData[0], nodeData[1], nodeData[2],
406  i==l);
407  }
408 }
409 
410 function gotoNode(o,subIndex,root,hash,relpath)
411 {
412  var nti = navTreeSubIndices[subIndex][root+hash];
413  o.breadcrumbs = $.extend(true, [], nti ? nti : navTreeSubIndices[subIndex][root]);
414  if (!o.breadcrumbs && root!=NAVTREE[0][1]) { // fallback: show index
415  navTo(o,NAVTREE[0][1],"",relpath);
416  $('.item').removeClass('selected');
417  $('.item').removeAttr('id');
418  }
419  if (o.breadcrumbs) {
420  o.breadcrumbs.unshift(0); // add 0 for root node
421  showNode(o, o.node, 0, hash);
422  }
423 }
424 
425 function navTo(o,root,hash,relpath)
426 {
427  var link = cachedLink();
428  if (link) {
429  var parts = link.split('#');
430  root = parts[0];
431  if (parts.length>1) hash = '#'+parts[1];
432  else hash='';
433  }
434  if (hash.match(/^#l\d+$/)) {
435  var anchor=$('a[name='+hash.substring(1)+']');
436  glowEffect(anchor.parent(),1000); // line number
437  hash=''; // strip line number anchors
438  //root=root.replace(/_source\./,'.'); // source link to doc link
439  }
440  var url=root+hash;
441  var i=-1;
442  while (NAVTREEINDEX[i+1]<=url) i++;
443  if (i==-1) { i=0; root=NAVTREE[0][1]; } // fallback: show index
444  if (navTreeSubIndices[i]) {
445  gotoNode(o,i,root,hash,relpath)
446  } else {
447  getScript(relpath+'navtreeindex'+i,function(){
448  navTreeSubIndices[i] = eval('NAVTREEINDEX'+i);
449  if (navTreeSubIndices[i]) {
450  gotoNode(o,i,root,hash,relpath);
451  }
452  },true);
453  }
454 }
455 
456 function showSyncOff(n,relpath)
457 {
458  n.html('<img src="'+relpath+'sync_off.png" title="'+SYNCOFFMSG+'"/>');
459 }
460 
461 function showSyncOn(n,relpath)
462 {
463  n.html('<img src="'+relpath+'sync_on.png" title="'+SYNCONMSG+'"/>');
464 }
465 
466 function toggleSyncButton(relpath)
467 {
468  var navSync = $('#nav-sync');
469  if (navSync.hasClass('sync')) {
470  navSync.removeClass('sync');
471  showSyncOff(navSync,relpath);
472  storeLink(stripPath2($(location).attr('pathname'))+$(location).attr('hash'));
473  } else {
474  navSync.addClass('sync');
475  showSyncOn(navSync,relpath);
476  deleteLink();
477  }
478 }
479 
480 function initNavTree(toroot,relpath)
481 {
482  var o = new Object();
483  o.toroot = toroot;
484  o.node = new Object();
485  o.node.li = document.getElementById("nav-tree-contents");
486  o.node.childrenData = NAVTREE;
487  o.node.children = new Array();
488  o.node.childrenUL = document.createElement("ul");
489  o.node.getChildrenUL = function() { return o.node.childrenUL; };
490  o.node.li.appendChild(o.node.childrenUL);
491  o.node.depth = 0;
492  o.node.relpath = relpath;
493  o.node.expanded = false;
494  o.node.isLast = true;
495  o.node.plus_img = document.createElement("img");
496  o.node.plus_img.src = relpath+"ftv2pnode.png";
497  o.node.plus_img.width = 16;
498  o.node.plus_img.height = 22;
499 
500  if (localStorageSupported()) {
501  var navSync = $('#nav-sync');
502  if (cachedLink()) {
503  showSyncOff(navSync,relpath);
504  navSync.removeClass('sync');
505  } else {
506  showSyncOn(navSync,relpath);
507  }
508  navSync.click(function(){ toggleSyncButton(relpath); });
509  }
510 
511  navTo(o,toroot,window.location.hash,relpath);
512 
513  $(window).bind('hashchange', function(){
514  if (window.location.hash && window.location.hash.length>1){
515  var a;
516  if ($(location).attr('hash')){
517  var clslink=stripPath($(location).attr('pathname'))+':'+
518  $(location).attr('hash').substring(1);
519  a=$('.item a[class$="'+clslink+'"]');
520  }
521  if (a==null || !$(a).parent().parent().hasClass('selected')){
522  $('.item').removeClass('selected');
523  $('.item').removeAttr('id');
524  }
525  var link=stripPath2($(location).attr('pathname'));
526  navTo(o,link,$(location).attr('hash'),relpath);
527  } else if (!animationInProgress) {
528  $('#doc-content').scrollTop(0);
529  $('.item').removeClass('selected');
530  $('.item').removeAttr('id');
531  navTo(o,toroot,window.location.hash,relpath);
532  }
533  })
534 
535  $(window).load(showRoot);
536 }
537 
static const double m
mass of electron in grams