MCPcopy Create free account
hub / github.com/bloomberg/quantum / initNavTree

Function initNavTree

docs/navtree.js:484–539  ·  view source on GitHub ↗
(toroot,relpath)

Source from the content-addressed store, hash-verified

482}
483
484function initNavTree(toroot,relpath)
485{
486 var o = new Object();
487 o.toroot = toroot;
488 o.node = new Object();
489 o.node.li = document.getElementById("nav-tree-contents");
490 o.node.childrenData = NAVTREE;
491 o.node.children = new Array();
492 o.node.childrenUL = document.createElement("ul");
493 o.node.getChildrenUL = function() { return o.node.childrenUL; };
494 o.node.li.appendChild(o.node.childrenUL);
495 o.node.depth = 0;
496 o.node.relpath = relpath;
497 o.node.expanded = false;
498 o.node.isLast = true;
499 o.node.plus_img = document.createElement("span");
500 o.node.plus_img.className = 'arrow';
501 o.node.plus_img.innerHTML = arrowRight;
502
503 if (localStorageSupported()) {
504 var navSync = $('#nav-sync');
505 if (cachedLink()) {
506 showSyncOff(navSync,relpath);
507 navSync.removeClass('sync');
508 } else {
509 showSyncOn(navSync,relpath);
510 }
511 navSync.click(function(){ toggleSyncButton(relpath); });
512 }
513
514 $(window).load(function(){
515 navTo(o,toroot,hashUrl(),relpath);
516 showRoot();
517 });
518
519 $(window).bind('hashchange', function(){
520 if (window.location.hash && window.location.hash.length>1){
521 var a;
522 if ($(location).attr('hash')){
523 var clslink=stripPath(pathName())+':'+hashValue();
524 a=$('.item a[class$="'+clslink.replace(/</g,'\\3c ')+'"]');
525 }
526 if (a==null || !$(a).parent().parent().hasClass('selected')){
527 $('.item').removeClass('selected');
528 $('.item').removeAttr('id');
529 }
530 var link=stripPath2(pathName());
531 navTo(o,link,hashUrl(),relpath);
532 } else if (!animationInProgress) {
533 $('#doc-content').scrollTop(0);
534 $('.item').removeClass('selected');
535 $('.item').removeAttr('id');
536 navTo(o,toroot,hashUrl(),relpath);
537 }
538 })
539}
540/* @license-end */

Callers

nothing calls this directly

Calls 12

localStorageSupportedFunction · 0.85
cachedLinkFunction · 0.85
showSyncOffFunction · 0.85
showSyncOnFunction · 0.85
toggleSyncButtonFunction · 0.85
navToFunction · 0.85
hashUrlFunction · 0.85
showRootFunction · 0.85
stripPathFunction · 0.85
pathNameFunction · 0.85
hashValueFunction · 0.85
stripPath2Function · 0.85

Tested by

no test coverage detected