').css({visibility: 'hidden', width: 100, overflow: 'scroll', scrollbarWidth: 'thin'}).appendTo('body');
let widthWithScroll = $('
').css({width: '100%'}).appendTo(outer).outerWidth();
outer.remove();
return 100 - widthWithScroll;
}
const scrollbarWidth = getScrollBarWidth();
function adjustSyncIconPosition() {
if (!fullSidebar) {
const nt = document.getElementById("nav-tree");
const hasVerticalScrollbar = nt.scrollHeight > nt.clientHeight;
$("#nav-sync").css({right:parseInt(hasVerticalScrollbar?scrollbarWidth:0)});
}
}
const getData = function(varName) {
const i = varName.lastIndexOf('/');
const n = i>=0 ? varName.substring(i+1) : varName;
const e = n.replace(/-/g,'_');
return window[e];
}
const stripPath = function(uri) {
return uri.substring(uri.lastIndexOf('/')+1);
}
const stripPath2 = function(uri) {
const i = uri.lastIndexOf('/');
const s = uri.substring(i+1);
const m = uri.substring(0,i+1).match(/\/d\w\/d\w\w\/$/);
return m ? uri.substring(i-6) : s;
}
const hashValue = function() {
return $(location).attr('hash').substring(1).replace(/[^\w-]/g,'');
}
const hashUrl = function() {
return '#'+hashValue();
}
const pathName = function() {
return $(location).attr('pathname').replace(/[^-A-Za-z0-9+&@#/%?=~_|!:,.;()]/g, '');
}
const storeLink = function(link) {
if (!$("#nav-sync").hasClass('sync')) {
Cookie.writeSetting(NAVPATH_COOKIE_NAME,link,0);
}
}
const deleteLink = function() {
Cookie.eraseSetting(NAVPATH_COOKIE_NAME);
}
const cachedLink = function() {
return Cookie.readSetting(NAVPATH_COOKIE_NAME,'');
}
const getScript = function(scriptName,func) {
const head = document.getElementsByTagName("head")[0];
const script = document.createElement('script');
script.id = scriptName;
script.type = 'text/javascript';
script.onload = function() { func(); adjustSyncIconPosition(); }
script.src = scriptName+'.js';
head.appendChild(script);
}
const createIndent = function(o,domNode,node) {
let level=-1;
let n = node;
while (n.parentNode) { level++; n=n.parentNode; }
if (node.childrenData) {
const imgNode = document.createElement("span");
imgNode.className = 'arrow';
imgNode.style.paddingLeft=(16*level).toString()+'px';
imgNode.innerHTML=ARROW_RIGHT;
node.plus_img = imgNode;
node.expandToggle = document.createElement("a");
node.expandToggle.href = "javascript:void(0)";
node.expandToggle.onclick = function() {
if (node.expanded) {
$(node.getChildrenUL()).slideUp("fast",adjustSyncIconPosition);
$(node.plus_img.childNodes[0]).removeClass('opened').addClass('closed');
node.expanded = false;
} else {
expandNode(o, node, false, true);
}
}
node.expandToggle.appendChild(imgNode);
domNode.appendChild(node.expandToggle);
} else {
let span = document.createElement("span");
span.className = 'arrow';
span.style.width = 16*(level+1)+'px';
span.innerHTML = ' ';
domNode.appendChild(span);
}
}
let animationInProgress = false;
const gotoAnchor = function(anchor,aname) {
let pos, docContent = $('#doc-content');
let ancParent = $(anchor.parent());
if (ancParent.hasClass('memItemLeft') || ancParent.hasClass('memtitle') ||
ancParent.hasClass('fieldname') || ancParent.hasClass('fieldtype') ||
ancParent.is(':header')) {
pos = ancParent.offset().top;
} else if (anchor.position()) {
pos = anchor.offset().top;
}
if (pos) {
const dcOffset = docContent.offset().top;
const dcHeight = docContent.height();
const dcScrHeight = docContent[0].scrollHeight
const dcScrTop = docContent.scrollTop();
let dist = Math.abs(Math.min(pos-dcOffset,dcScrHeight-dcHeight-dcScrTop));
animationInProgress = true;
docContent.animate({
scrollTop: pos + dcScrTop - dcOffset
},Math.max(50,Math.min(500,dist)),function() {
animationInProgress=false;
if (anchor.parent().attr('class')=='memItemLeft') {
let rows = $('.memberdecls tr[class$="'+hashValue()+'"]');
glowEffect(rows.children(),300); // member without details
} else if (anchor.parent().attr('class')=='fieldname') {
glowEffect(anchor.parent().parent(),1000); // enum value
} else if (anchor.parent().attr('class')=='fieldtype') {
glowEffect(anchor.parent().parent(),1000); // struct field
} else if (anchor.parent().is(":header")) {
glowEffect(anchor.parent(),1000); // section header
} else {
glowEffect(anchor.next(),1000); // normal member
}
});
}
}
function htmlToNode(html) {
const template = document.createElement('template');
template.innerHTML = html;
const nNodes = template.content.childNodes.length;
if (nNodes !== 1) {
throw new Error(`html parameter must represent a single node; got ${nNodes}. `);
}
return template.content.firstChild;
}
const newNode = function(o, po, text, link, childrenData, lastNode) {
const node = {
children : [],
childrenData : childrenData,
depth : po.depth + 1,
relpath : po.relpath,
isLast : lastNode,
li : document.createElement("li"),
parentNode : po,
itemDiv : document.createElement("div"),
labelSpan : document.createElement("span"),
expanded : false,
childrenUL : null,
getChildrenUL : function() {
if (!this.childrenUL) {
this.childrenUL = document.createElement("ul");
this.childrenUL.className = "children_ul";
this.childrenUL.style.display = "none";
this.li.appendChild(node.childrenUL);
}
return node.childrenUL;
},
};
node.itemDiv.className = "item";
node.labelSpan.className = "label";
createIndent(o,node.itemDiv,node);
node.itemDiv.appendChild(node.labelSpan);
node.li.appendChild(node.itemDiv);
const a = document.createElement("a");
node.labelSpan.appendChild(a);
po.getChildrenUL().appendChild(node.li);
a.appendChild(htmlToNode('
'+text+''));
if (link) {
let url;
if (link.substring(0,1)=='^') {
url = link.substring(1);
link = url;
} else {
url = node.relpath+link;
}
a.className = stripPath(link.replace('#',':'));
if (link.indexOf('#')!=-1) {
const aname = '#'+link.split('#')[1];
const srcPage = stripPath(pathName());
const targetPage = stripPath(link.split('#')[0]);
a.href = srcPage!=targetPage ? url : aname;
a.onclick = function() {
storeLink(link);
aPPar = $(a).parent().parent();
if (!aPPar.hasClass('selected')) {
$('.item').removeClass('selected');
$('.item').removeAttr('id');
aPPar.addClass('selected');
aPPar.attr('id','selected');
}
const anchor = $(aname);
gotoAnchor(anchor,aname);
};
} else {
a.href = url;
a.onclick = () => storeLink(link);
}
} else if (childrenData != null) {
a.className = "nolink";
a.href = "javascript:void(0)";
a.onclick = node.expandToggle.onclick;
}
return node;
}
const showRoot = function() {
const headerHeight = $("#top").height();
const footerHeight = $("#nav-path").height();
const windowHeight = $(window).height() - headerHeight - footerHeight;
(function() { // retry until we can scroll to the selected item
try {
const navtree=$('#nav-tree');
navtree.scrollTo('#selected',100,{offset:-windowHeight/2});
} catch (err) {
setTimeout(arguments.callee, 0);
}
})();
}
const expandNode = function(o, node, imm, setFocus) {
if (node.childrenData && !node.expanded) {
if (typeof(node.childrenData)==='string') {
const varName = node.childrenData;
getScript(node.relpath+varName,function() {
node.childrenData = getData(varName);
expandNode(o, node, imm, setFocus);
});
} else {
if (!node.childrenVisited) {
getNode(o, node);
}
$(node.getChildrenUL()).slideDown("fast",adjustSyncIconPosition);
$(node.plus_img.childNodes[0]).addClass('opened').removeClass('closed');
node.expanded = true;
if (setFocus) {
$(node.expandToggle).focus();
}
}
}
}
const glowEffect = function(n,duration) {
n.addClass('glow').delay(duration).queue(function(next) {
$(this).removeClass('glow');next();
});
}
const highlightAnchor = function() {
const aname = hashUrl();
const anchor = $(aname);
gotoAnchor(anchor,aname);
}
const selectAndHighlight = function(hash,n) {
let a;
if (hash) {
const link=stripPath(pathName())+':'+hash.substring(1);
a=$('.item a[class$="'+link+'"]');
}
if (a && a.length) {
a.parent().parent().addClass('selected');
a.parent().parent().attr('id','selected');
highlightAnchor();
} else if (n) {
$(n.itemDiv).addClass('selected');
$(n.itemDiv).attr('id','selected');
}
let topOffset=5;
if ($('#nav-tree-contents .item:first').hasClass('selected')) {
topOffset+=25;
}
showRoot();
}
const showNode = function(o, node, index, hash) {
if (node && node.childrenData) {
if (typeof(node.childrenData)==='string') {
const varName = node.childrenData;
getScript(node.relpath+varName,function() {
node.childrenData = getData(varName);
showNode(o,node,index,hash);
});
} else {
if (!node.childrenVisited) {
getNode(o, node);
}
$(node.getChildrenUL()).css({'display':'block'});
$(node.plus_img.childNodes[0]).removeClass('closed').addClass('opened');
node.expanded = true;
const n = node.children[o.breadcrumbs[index]];
if (index+1
0) { // try root page without hash as fallback
gotoUrl(o,root,'',relpath);
} else {
o.breadcrumbs = $.extend(true, [], nti);
if (!o.breadcrumbs && root!=NAVTREE[0][1]) { // fallback: show index
navTo(o,NAVTREE[0][1],"",relpath);
$('.item').removeClass('selected');
$('.item').removeAttr('id');
}
if (o.breadcrumbs) {
o.breadcrumbs.unshift(0); // add 0 for root node
showNode(o, o.node, 0, hash);
}
}
}
const gotoUrl = function(o,root,hash,relpath) {
const url=root+hash;
let i=-1;
while (NAVTREEINDEX[i+1]<=url) i++;
if (i==-1) { i=0; root=NAVTREE[0][1]; } // fallback: show index
if (navTreeSubIndices[i]) {
gotoNode(o,i,root,hash,relpath)
} else {
getScript(relpath+'navtreeindex'+i,function() {
navTreeSubIndices[i] = window['NAVTREEINDEX'+i];
if (navTreeSubIndices[i]) {
gotoNode(o,i,root,hash,relpath);
}
});
}
}
const navTo = function(o,root,hash,relpath) {
const link = cachedLink();
if (link) {
const parts = link.split('#');
root = parts[0];
hash = parts.length>1 ? '#'+parts[1].replace(/[^\w-]/g,'') : '';
}
if (hash.match(/^#l\d+$/)) {
const anchor=$('a[name='+hash.substring(1)+']');
glowEffect(anchor.parent(),1000); // line number
hash=''; // strip line number anchors
}
gotoUrl(o,root,hash,relpath);
}
const showSyncOff = function(n,relpath) {
n.html('
');
}
const showSyncOn = function(n,relpath) {
n.html('
');
}
const o = {
toroot : toroot,
node : {
childrenData : NAVTREE,
children : [],
childrenUL : document.createElement("ul"),
getChildrenUL : function() { return this.childrenUL },
li : document.getElementById("nav-tree-contents"),
depth : 0,
relpath : relpath,
expanded : false,
isLast : true,
plus_img : document.createElement("span"),
},
};
o.node.li.appendChild(o.node.childrenUL);
o.node.plus_img.className = 'arrow';
o.node.plus_img.innerHTML = ARROW_RIGHT;
const navSync = $('#nav-sync');
if (cachedLink()) {
showSyncOff(navSync,relpath);
navSync.removeClass('sync');
} else {
showSyncOn(navSync,relpath);
}
navSync.click(() => {
const navSync = $('#nav-sync');
if (navSync.hasClass('sync')) {
navSync.removeClass('sync');
showSyncOff(navSync,relpath);
storeLink(stripPath2(pathName())+hashUrl());
} else {
navSync.addClass('sync');
showSyncOn(navSync,relpath);
deleteLink();
}
});
navTo(o,toroot,hashUrl(),relpath);
showRoot();
$(window).bind('hashchange', () => {
if (!animationInProgress) {
if (window.location.hash && window.location.hash.length>1) {
let a;
if ($(location).attr('hash')) {
const clslink=stripPath(pathName())+':'+hashValue();
a=$('.item a[class$="'+clslink.replace(/ try to keep right panel width
const shrinkLeft = Math.min(deficit, leftPanelWidth-minPanelWidth);
leftPanelWidth -= shrinkLeft;
const remainingDeficit = deficit - shrinkLeft;
const shrinkRight = Math.min(remainingDeficit, rightPanelWidth-minPanelWidth);
rightPanelWidth -= shrinkRight;
} else { // dragging right handle -> try to keep left panel width
const shrinkRight = Math.min(deficit, rightPanelWidth-minPanelWidth);
rightPanelWidth -= shrinkRight;
const remainingDeficit = deficit - shrinkRight;
const shrinkLeft = Math.min(remainingDeficit, leftPanelWidth-minPanelWidth);
leftPanelWidth -= shrinkLeft;
}
} else {
rightPanelWidth = pagenav.length ? Math.max(minPanelWidth,rightPanelWidth) : 0;
leftPanelWidth = Math.max(minPanelWidth,leftPanelWidth);
}
return { leftPanelWidth, rightPanelWidth }
}
function updateWidths(sidenavWidth,pagenavWidth,dragLeft)
{
const widths = constrainPanelWidths(sidenavWidth,pagenavWidth,dragLeft);
const widthStr = parseInt(widths.leftPanelWidth)+"px";
content.css({marginLeft:widthStr});
if (fullSidebar) {
footer.css({marginLeft:widthStr});
if (mainnav) {
mainnav.css({marginLeft:widthStr});
}
}
sidenav.css({width:widthStr});
if (pagenav.length) {
container.css({gridTemplateColumns:'auto '+parseInt(widths.rightPanelWidth)+'px'});
pagenav.css({width:parseInt(widths.rightPanelWidth-1)+'px'});
}
return widths;
}
function resizeWidth(dragLeft) {
const sidenavWidth = $(sidenav).outerWidth()-barWidth;
const pagenavWidth = pagenav.length ? $(pagenav).outerWidth() : 0;
const widths = updateWidths(sidenavWidth,pagenavWidth,dragLeft);
Cookie.writeSetting(RESIZE_COOKIE_NAME,widths.leftPanelWidth-barWidth);
if (pagenav.length) {
Cookie.writeSetting(PAGENAV_COOKIE_NAME,widths.rightPanelWidth);
}
}
function restoreWidth(sidenavWidth,pagenavWidth) {
updateWidths(sidenavWidth,pagenavWidth,false);
showHideNavBar();
}
function resizeHeight() {
const headerHeight = header.outerHeight();
const windowHeight = $(window).height();
let contentHeight;
const footerHeight = footer.outerHeight();
let navtreeHeight,sideNavHeight;
if (!fullSidebar) {
contentHeight = windowHeight - headerHeight - footerHeight - 1;
navtreeHeight = contentHeight;
sideNavHeight = contentHeight;
} else if (fullSidebar) {
contentHeight = windowHeight - footerHeight - 1;
navtreeHeight = windowHeight - headerHeight - 1;
sideNavHeight = windowHeight - 1;
if (mainnav) {
contentHeight -= mainnav.outerHeight();
}
}
navtree.css({height:navtreeHeight + "px"});
sidenav.css({height:sideNavHeight + "px"});
content.css({height:contentHeight + "px"});
resizeWidth(false);
showHideNavBar();
if (location.hash.slice(1)) {
(document.getElementById(location.hash.slice(1))||document.body).scrollIntoView();
}
}
header = $("#top");
content = $("#doc-content");
footer = $("#nav-path");
sidenav = $("#side-nav");
if (document.getElementById('main-nav')) {
mainnav = $("#main-nav");
}
navtree = $("#nav-tree");
pagenav = $("#page-nav");
container = $("#container");
$(".side-nav-resizable").resizable({resize: function(e, ui) { resizeWidth(true); } });
$(sidenav).resizable({ minWidth: 0 });
if (pagenav.length) {
pagehandle = $("#page-nav-resize-handle");
pagehandle.on('mousedown touchstart',function(e) {
$('body').addClass('resizing');
pagehandle.addClass('dragging');
$(document).on('mousemove touchmove',function(e) {
const clientX = e.clientX || e.originalEvent.touches[0].clientX;
let pagenavWidth = container[0].offsetWidth-clientX+barWidth/2;
const sidenavWidth = sidenav.width();
const widths = constrainPanelWidths(sidenavWidth,pagenavWidth,false);
container.css({gridTemplateColumns:'auto '+parseInt(widths.rightPanelWidth)+'px'});
pagenav.css({width:parseInt(widths.rightPanelWidth-1)+'px'});
content.css({marginLeft:parseInt(widths.leftPanelWidth)+'px'});
Cookie.writeSetting(PAGENAV_COOKIE_NAME,pagenavWidth);
});
$(document).on('mouseup touchend', function(e) {
$('body').removeClass('resizing');
pagehandle.removeClass('dragging');
$(document).off('mousemove mouseup touchmove touchend');
});
});
} else {
container.css({gridTemplateColumns:'auto'});
}
const width = parseInt(Cookie.readSetting(RESIZE_COOKIE_NAME,250));
const pagenavWidth = parseInt(Cookie.readSetting(PAGENAV_COOKIE_NAME,250));
if (width) { restoreWidth(width+barWidth,pagenavWidth); } else { resizeWidth(); }
const url = location.href;
const i=url.indexOf("#");
if (i>=0) window.location.hash=url.substr(i);
const _preventDefault = function(evt) { evt.preventDefault(); };
$("#splitbar").bind("dragstart", _preventDefault).bind("selectstart", _preventDefault);
$(window).ready(function() {
let lastWidth = -1;
let lastHeight = -1;
$(window).resize(function() {
const newWidth = $(this).width(), newHeight = $(this).height();
if (newWidth!=lastWidth || newHeight!=lastHeight) {
resizeHeight();
navtree_trampoline.updateContentTop();
lastWidth = newWidth;
lastHeight = newHeight;
}
});
resizeHeight();
lastWidth = $(window).width();
lastHeight = $(window).height();
content.scroll(function() {
navtree_trampoline.updateContentTop();
});
});
}
function initPageToc() {
const topMapping = [];
const toc_contents = $('#page-nav-contents');
const content=$('').addClass('page-outline');
var entityMap = {
'&': '&',
'<': '<',
'>': '>',
'"': '"',
"'": ''',
'/': '/',
'`': '`',
'=': '='
};
function escapeHtml (string) {
return String(string).replace(/[&<>"'`=\/]/g, function (s) {
return entityMap[s];
});
}
// for ClassDef/GroupDef/ModuleDef/ConceptDef/DirDef
const groupSections = [];
let currentGroup = null;
$('h2.groupheader, h2.memtitle').each(function(){
const $element = $(this);
if ($element.hasClass('groupheader')) {
currentGroup = { groupHeader: $element, memTitles: [] };
groupSections.push(currentGroup);
} else if ($element.hasClass('memtitle') && currentGroup) {
currentGroup.memTitles.push($element);
}
});
groupSections.forEach(function(item){
const title = item.groupHeader.text().trim();
let id = item.groupHeader.attr('id');
const table = item.groupHeader.parents('table.memberdecls');
let rows = $();
if (table.length>0) {
rows = table.find("tr[class^='memitem:'] td.memItemRight, tr[class^='memitem:'] td.memItemLeft.anon, tr[class=groupHeader] td");
}
function hasSubItems() {
return item.memTitles.length>0 || rows.toArray().some(function(el) { return $(el).is(':visible'); });
}
const li = $('- ').attr('id','nav-'+id);
const div = $('