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