navtree.js 42 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163
  1. /*
  2. @licstart The following is the entire license notice for the JavaScript code in this file.
  3. The MIT License (MIT)
  4. Copyright (C) 1997-2020 by Dimitri van Heesch
  5. Permission is hereby granted, free of charge, to any person obtaining a copy of this software
  6. and associated documentation files (the "Software"), to deal in the Software without restriction,
  7. including without limitation the rights to use, copy, modify, merge, publish, distribute,
  8. sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
  9. furnished to do so, subject to the following conditions:
  10. The above copyright notice and this permission notice shall be included in all copies or
  11. substantial portions of the Software.
  12. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
  13. BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  14. NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  15. DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  16. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  17. @licend The above is the entire license notice for the JavaScript code in this file
  18. */
  19. let initResizableFunc;
  20. function initNavTree(toroot,relpath,allMembersFile) {
  21. let navTreeSubIndices = [];
  22. const ARROW_DOWN = '<span class="arrowhead opened"></span>';
  23. const ARROW_RIGHT = '<span class="arrowhead closed"></span>';
  24. const NAVPATH_COOKIE_NAME = ''+'navpath';
  25. const fullSidebar = document.querySelector('meta[name="doxygen-page-layout"]') !== null;
  26. // Helper functions to replace jQuery
  27. const $ = (selector) => document.querySelector(selector);
  28. const $$ = (selector) => Array.from(document.querySelectorAll(selector));
  29. const hasClass = (el, className) => el ? el.classList.contains(className) : false;
  30. const offsetTop = (el) => el ? (el.getBoundingClientRect().top + window.pageYOffset) : 0;
  31. const slideUp = function(el, duration, callback) {
  32. if (!el) return;
  33. el.style.overflow = 'hidden';
  34. el.style.transition = `height ${duration}ms ease`;
  35. el.style.height = el.scrollHeight + 'px';
  36. setTimeout(() => {
  37. el.style.height = '0';
  38. setTimeout(() => {
  39. el.style.display = 'none';
  40. el.style.transition = '';
  41. el.style.overflow = '';
  42. el.style.height = '';
  43. if (callback) callback();
  44. }, duration);
  45. }, 10);
  46. };
  47. const slideDown = function(el, duration, callback) {
  48. if (!el) return;
  49. el.style.display = 'block';
  50. const height = el.scrollHeight;
  51. el.style.overflow = 'hidden';
  52. el.style.height = '0';
  53. el.style.transition = `height ${duration}ms ease`;
  54. setTimeout(() => {
  55. el.style.height = height + 'px';
  56. setTimeout(() => {
  57. el.style.transition = '';
  58. el.style.overflow = '';
  59. el.style.height = '';
  60. if (callback) callback();
  61. }, duration);
  62. }, 10);
  63. };
  64. const animateScrolling = function(el, targetPos, duration, callback) {
  65. if (!el) return;
  66. const start = performance.now();
  67. const startVal = el.scrollTop;
  68. const tick = (now) => {
  69. const elapsed = now - start;
  70. const progress = Math.min(elapsed / duration, 1);
  71. const endVal = targetPos;
  72. el.scrollTop = startVal + (endVal - startVal) * progress;
  73. if (progress < 1) {
  74. requestAnimationFrame(tick);
  75. } else if (callback) {
  76. callback();
  77. }
  78. };
  79. requestAnimationFrame(tick);
  80. };
  81. function getScrollBarWidth () {
  82. const outer = document.createElement('div');
  83. outer.style.visibility='hidden';
  84. outer.style.width='100px';
  85. outer.style.overflow='scroll';
  86. outer.style.scrollbarWidth='thin';
  87. document.body.appendChild(outer);
  88. const inner = document.createElement('div');
  89. inner.style.width='100%';
  90. outer.appendChild(inner);
  91. const widthWithScroll = inner.offsetWidth;
  92. document.body.removeChild(outer);
  93. return 100 - widthWithScroll;
  94. }
  95. const scrollbarWidth = getScrollBarWidth();
  96. function adjustSyncIconPosition() {
  97. if (!fullSidebar) {
  98. const nt = document.getElementById("nav-tree");
  99. const hasVerticalScrollbar = nt.scrollHeight > nt.clientHeight;
  100. const navSync = $("#nav-sync");
  101. navSync.style.right = (hasVerticalScrollbar ? scrollbarWidth : 0) + 'px';
  102. }
  103. }
  104. const getData = function(varName) {
  105. const i = varName.lastIndexOf('/');
  106. const n = i>=0 ? varName.substring(i+1) : varName;
  107. const e = n.replace(/-/g,'_');
  108. const r = (e[0] >= '0' && e[0] <= '9') ? '_' + e : e;
  109. return window[r];
  110. }
  111. const stripPath = (uri) => uri.substring(uri.lastIndexOf('/')+1);
  112. const stripPath2 = function(uri) {
  113. const i = uri.lastIndexOf('/');
  114. const s = uri.substring(i+1);
  115. const m = uri.substring(0,i+1).match(/\/d\w\/d\w\w\/$/);
  116. return m ? uri.substring(i-6) : s;
  117. }
  118. const hashValue = () => location.hash.substring(1).replace(/[^\w-]/g,'');
  119. const hashUrl = () => '#'+hashValue();
  120. const pathName = () => location.pathname.replace(/[^-A-Za-z0-9+&@#/%?=~_|!:,.;()]/g, '');
  121. const storeLink = function(link) {
  122. const navSync = $("#nav-sync");
  123. if (!hasClass(navSync, 'sync')) {
  124. Cookie.writeSetting(NAVPATH_COOKIE_NAME,link,0);
  125. }
  126. }
  127. const deleteLink = function() {
  128. Cookie.eraseSetting(NAVPATH_COOKIE_NAME);
  129. }
  130. const cachedLink = () => Cookie.readSetting(NAVPATH_COOKIE_NAME,'');
  131. const getScript = function(scriptName,func) {
  132. const head = document.getElementsByTagName("head")[0];
  133. const script = document.createElement('script');
  134. script.id = scriptName;
  135. script.type = 'text/javascript';
  136. script.onload = function() { func(); adjustSyncIconPosition(); }
  137. script.src = scriptName+'.js';
  138. head.appendChild(script);
  139. }
  140. const createIndent = function(o,domNode,node) {
  141. let level=-1;
  142. let n = node;
  143. while (n.parentNode) { level++; n=n.parentNode; }
  144. if (node.childrenData) {
  145. const imgNode = document.createElement("span");
  146. imgNode.className = 'arrow';
  147. imgNode.style.paddingLeft=(16*level).toString()+'px';
  148. imgNode.innerHTML=ARROW_RIGHT;
  149. node.plus_img = imgNode;
  150. node.expandToggle = document.createElement("a");
  151. node.expandToggle.href = "javascript:void(0)";
  152. node.expandToggle.onclick = function() {
  153. if (node.expanded) {
  154. slideUp(node.getChildrenUL(), 200, adjustSyncIconPosition);
  155. const child0 = node.plus_img.childNodes[0]
  156. if (child0) {
  157. child0.classList.remove('opened');
  158. child0.classList.add('closed');
  159. }
  160. node.expanded = false;
  161. } else {
  162. expandNode(o, node, false, true);
  163. }
  164. }
  165. node.expandToggle.appendChild(imgNode);
  166. domNode.appendChild(node.expandToggle);
  167. } else {
  168. let span = document.createElement("span");
  169. span.className = 'arrow';
  170. span.style.width = 16*(level+1)+'px';
  171. span.innerHTML = '&#160;';
  172. domNode.appendChild(span);
  173. }
  174. }
  175. let animationInProgress = false;
  176. const gotoAnchor = function(anchor,aname) {
  177. if (!anchor) return;
  178. let pos, docContent = $('#doc-content');
  179. if (!docContent) return;
  180. const anchorParent = anchor.parentElement;
  181. if (!anchorParent) return;
  182. const parentClass = anchorParent.className;
  183. if (hasClass(anchorParent, 'memItemLeft') || hasClass(anchorParent, 'memtitle') ||
  184. hasClass(anchorParent, 'fieldname') || hasClass(anchorParent, 'fieldtype') ||
  185. anchorParent.tagName.match(/^H[1-6]$/)) {
  186. pos = offsetTop(anchorParent); // goto anchor's parent
  187. } else {
  188. pos = offsetTop(anchor); // goto anchor
  189. }
  190. if (pos) {
  191. const dcOffset = offsetTop(docContent);
  192. const dcHeight = docContent.clientHeight;
  193. const dcScrHeight = docContent.scrollHeight;
  194. const dcScrTop = docContent.scrollTop;
  195. let dist = Math.abs(Math.min(pos-dcOffset,dcScrHeight-dcHeight-dcScrTop));
  196. animationInProgress = true;
  197. animateScrolling(docContent, pos+dcScrTop-dcOffset, Math.max(50,Math.min(500,dist)), function() {
  198. animationInProgress=false;
  199. if (parentClass=='memItemLeft') {
  200. const rows = $$('.memberdecls tr[class$="'+hashValue()+'"]');
  201. rows.forEach(row => {
  202. const children = Array.from(row.children);
  203. children.forEach(child => glowEffect(child, 300));
  204. });
  205. } else if (parentClass=='fieldname') {
  206. glowEffect(anchorParent.parentElement, 1000); // enum value
  207. } else if (parentClass=='fieldtype') {
  208. glowEffect(anchorParent.parentElement, 1000); // struct field
  209. } else if (anchorParent.tagName.match(/^H[1-6]$/)) {
  210. glowEffect(anchorParent, 1000); // section header
  211. } else {
  212. glowEffect(anchor.nextElementSibling, 1000); // normal member
  213. }
  214. });
  215. }
  216. }
  217. function htmlToNode(html) {
  218. const template = document.createElement('template');
  219. template.innerHTML = html;
  220. const nNodes = template.content.childNodes.length;
  221. if (nNodes !== 1) {
  222. throw new Error(`html parameter must represent a single node; got ${nNodes}. `);
  223. }
  224. return template.content.firstChild;
  225. }
  226. const newNode = function(o, po, text, link, childrenData, lastNode) {
  227. const node = {
  228. children : [],
  229. childrenData : childrenData,
  230. depth : po.depth + 1,
  231. relpath : po.relpath,
  232. isLast : lastNode,
  233. li : document.createElement("li"),
  234. parentNode : po,
  235. itemDiv : document.createElement("div"),
  236. labelSpan : document.createElement("span"),
  237. expanded : false,
  238. childrenUL : null,
  239. getChildrenUL : function() {
  240. if (!this.childrenUL) {
  241. this.childrenUL = document.createElement("ul");
  242. this.childrenUL.className = "children_ul";
  243. this.childrenUL.style.display = "none";
  244. this.li.appendChild(node.childrenUL);
  245. }
  246. return node.childrenUL;
  247. },
  248. };
  249. node.itemDiv.className = "item";
  250. node.labelSpan.className = "label";
  251. createIndent(o,node.itemDiv,node);
  252. node.itemDiv.appendChild(node.labelSpan);
  253. node.li.appendChild(node.itemDiv);
  254. const a = document.createElement("a");
  255. node.labelSpan.appendChild(a);
  256. po.getChildrenUL().appendChild(node.li);
  257. a.appendChild(htmlToNode('<span>'+text+'</span>'));
  258. if (link) {
  259. let url;
  260. if (link.substring(0,1)=='^') {
  261. url = link.substring(1);
  262. link = url;
  263. } else {
  264. url = node.relpath+link;
  265. }
  266. a.className = stripPath(link.replace('#',':'));
  267. if (link.indexOf('#')!=-1) {
  268. const aname = '#'+link.split('#')[1];
  269. const srcPage = stripPath(pathName());
  270. const targetPage = stripPath(link.split('#')[0]);
  271. a.href = srcPage!=targetPage ? url : aname;
  272. a.onclick = function() {
  273. storeLink(link);
  274. const aPPar = a.parentElement.parentElement;
  275. if (!hasClass(aPPar, 'selected')) {
  276. $$('.item').forEach(item => {
  277. item.classList.remove('selected');
  278. item.removeAttribute('id');
  279. });
  280. aPPar.classList.add('selected');
  281. aPPar.setAttribute('id', 'selected');
  282. }
  283. const anchor = document.querySelector(aname);
  284. gotoAnchor(anchor,aname);
  285. };
  286. } else {
  287. a.href = url;
  288. a.onclick = () => storeLink(link);
  289. }
  290. } else if (childrenData != null) {
  291. a.className = "nolink";
  292. a.href = "javascript:void(0)";
  293. a.onclick = node.expandToggle.onclick;
  294. }
  295. return node;
  296. }
  297. const showRoot = function() {
  298. const top = $("#top");
  299. const navPath = $("#nav-path");
  300. const headerHeight = top ? top.clientHeight : 0;
  301. const footerHeight = navPath ? navPath.clientHeight : 0;
  302. const windowHeight = window.innerHeight - headerHeight - footerHeight;
  303. (function retry() { // retry until we can scroll to the selected item
  304. try {
  305. const navtree = $('#nav-tree');
  306. if (navtree) {
  307. const selected = navtree.querySelector('#selected');
  308. if (selected) {
  309. const offset = -windowHeight/2;
  310. const targetPos = selected.offsetTop + offset;
  311. animateScrolling(navtree, Math.max(0, targetPos), 100);
  312. }
  313. }
  314. } catch (err) {
  315. setTimeout(retry, 0);
  316. }
  317. })();
  318. }
  319. const expandNode = function(o, node, imm, setFocus) {
  320. if (node.childrenData && !node.expanded) {
  321. if (typeof(node.childrenData)==='string') {
  322. const varName = node.childrenData;
  323. getScript(node.relpath+varName,function() {
  324. node.childrenData = getData(varName);
  325. expandNode(o, node, imm, setFocus);
  326. });
  327. } else {
  328. if (!node.childrenVisited) {
  329. getNode(o, node);
  330. }
  331. slideDown(node.getChildrenUL(), 200, adjustSyncIconPosition);
  332. const child0 = node.plus_img.childNodes[0]
  333. if (child0) {
  334. child0.classList.add('opened');
  335. child0.classList.remove('closed');
  336. }
  337. node.expanded = true;
  338. if (setFocus) {
  339. node.expandToggle.focus();
  340. }
  341. }
  342. }
  343. }
  344. const glowEffect = function(n, duration) {
  345. if (!n) return;
  346. n.classList.add('glow');
  347. setTimeout(() => {
  348. n.classList.remove('glow');
  349. }, duration);
  350. }
  351. const highlightAnchor = function() {
  352. const aname = hashUrl();
  353. const anchor = document.querySelector(aname);
  354. gotoAnchor(anchor,aname);
  355. }
  356. const selectAndHighlight = function(hash,n) {
  357. let a;
  358. if (hash) {
  359. const link=stripPath(pathName())+':'+hash.substring(1);
  360. a=document.querySelector('.item a[class$="'+link+'"]');
  361. }
  362. if (a) {
  363. const parent = a.parentElement.parentElement;
  364. if (parent) {
  365. parent.classList.add('selected');
  366. parent.setAttribute('id', 'selected');
  367. }
  368. highlightAnchor();
  369. } else if (n && n.itemDiv) {
  370. n.itemDiv.classList.add('selected');
  371. n.itemDiv.setAttribute('id', 'selected');
  372. }
  373. let topOffset=5;
  374. const firstItem = document.querySelector('#nav-tree-contents .item:first-child');
  375. if (firstItem && hasClass(firstItem, 'selected')) {
  376. topOffset+=25;
  377. }
  378. showRoot();
  379. }
  380. const showNode = function(o, node, index, hash) {
  381. if (node && node.childrenData) {
  382. if (typeof(node.childrenData)==='string') {
  383. const varName = node.childrenData;
  384. getScript(node.relpath+varName,function() {
  385. node.childrenData = getData(varName);
  386. showNode(o,node,index,hash);
  387. });
  388. } else {
  389. if (!node.childrenVisited) {
  390. getNode(o, node);
  391. }
  392. const childUL = node.getChildrenUL();
  393. if (childUL) {
  394. childUL.style.display='block';
  395. }
  396. const child0 = node.plus_img.childNodes[0];
  397. if (child0) {
  398. child0.classList.remove('closed');
  399. child0.classList.add('opened');
  400. }
  401. node.expanded = true;
  402. const n = node.children[o.breadcrumbs[index]];
  403. if (index+1<o.breadcrumbs.length) {
  404. showNode(o,n,index+1,hash);
  405. } else if (typeof(n.childrenData)==='string') {
  406. const varName = n.childrenData;
  407. getScript(n.relpath+varName,function() {
  408. n.childrenData = getData(varName);
  409. node.expanded=false;
  410. showNode(o,node,index,hash); // retry with child node expanded
  411. });
  412. } else {
  413. const rootBase = stripPath(o.toroot.replace(/\..+$/, ''));
  414. if (rootBase=="index" || rootBase=="pages" || rootBase=="search") {
  415. expandNode(o, n, true, false);
  416. }
  417. selectAndHighlight(hash,n);
  418. }
  419. }
  420. } else {
  421. selectAndHighlight(hash);
  422. }
  423. }
  424. const getNode = function(o, po) {
  425. po.childrenVisited = true;
  426. const l = po.childrenData.length-1;
  427. for (let i in po.childrenData) {
  428. const nodeData = po.childrenData[i];
  429. po.children[i] = newNode(o, po, nodeData[0], nodeData[1], nodeData[2], i==l);
  430. }
  431. }
  432. const gotoNode = function(o,subIndex,root,hash,relpath) {
  433. const nti = navTreeSubIndices[subIndex][root+hash];
  434. if (nti==undefined && hash.length>0) { // try root page without hash as fallback
  435. gotoUrl(o,root,'',relpath);
  436. } else {
  437. o.breadcrumbs = nti ? JSON.parse(JSON.stringify(nti)) : null;
  438. if (!o.breadcrumbs && root!=NAVTREE[0][1]) { // fallback: show index
  439. navTo(o,NAVTREE[0][1],"",relpath);
  440. $$('.item').forEach(item => {
  441. item.classList.remove('selected');
  442. item.removeAttribute('id');
  443. });
  444. }
  445. if (o.breadcrumbs) {
  446. o.breadcrumbs.unshift(0); // add 0 for root node
  447. showNode(o, o.node, 0, hash);
  448. }
  449. }
  450. }
  451. const gotoUrl = function(o,root,hash,relpath) {
  452. const url=root+hash;
  453. let i=-1;
  454. while (NAVTREEINDEX[i+1]<=url) i++;
  455. if (i==-1) { i=0; root=NAVTREE[0][1]; } // fallback: show index
  456. if (navTreeSubIndices[i]) {
  457. gotoNode(o,i,root,hash,relpath)
  458. } else {
  459. getScript(relpath+'navtreeindex'+i,function() {
  460. navTreeSubIndices[i] = window['NAVTREEINDEX'+i];
  461. if (navTreeSubIndices[i]) {
  462. gotoNode(o,i,root,hash,relpath);
  463. }
  464. });
  465. }
  466. }
  467. const navTo = function(o,root,hash,relpath) {
  468. const link = cachedLink();
  469. if (link) {
  470. const parts = link.split('#');
  471. root = parts[0];
  472. hash = parts.length>1 ? '#'+parts[1].replace(/[^\w-]/g,'') : '';
  473. }
  474. if (hash.match(/^#l\d+$/)) {
  475. const anchor = document.querySelector('a[name='+hash.substring(1)+']');
  476. if (anchor && anchor.parentElement) {
  477. glowEffect(anchor.parentElement, 1000); // line number
  478. }
  479. hash=''; // strip line number anchors
  480. }
  481. gotoUrl(o,root,hash,relpath);
  482. }
  483. const showSyncOff = function(n,relpath) {
  484. if (n) n.innerHTML = '<div class="nav-sync-icon" title="'+SYNCOFFMSG+'"><span class="sync-icon-left"></span><span class="sync-icon-right"></span></div>';
  485. }
  486. const showSyncOn = function(n,relpath) {
  487. if (n) n.innerHTML = '<div class="nav-sync-icon active" title="'+SYNCONMSG+'"><span class="sync-icon-left"></span><span class="sync-icon-right"></span></div>';
  488. }
  489. const o = {
  490. toroot : toroot,
  491. node : {
  492. childrenData : NAVTREE,
  493. children : [],
  494. childrenUL : document.createElement("ul"),
  495. getChildrenUL : function() { return this.childrenUL },
  496. li : document.getElementById("nav-tree-contents"),
  497. depth : 0,
  498. relpath : relpath,
  499. expanded : false,
  500. isLast : true,
  501. plus_img : document.createElement("span"),
  502. },
  503. };
  504. o.node.li.appendChild(o.node.childrenUL);
  505. o.node.plus_img.className = 'arrow';
  506. o.node.plus_img.innerHTML = ARROW_RIGHT;
  507. const navSync = $('#nav-sync');
  508. if (cachedLink()) {
  509. showSyncOff(navSync,relpath);
  510. navSync.classList.remove('sync');
  511. } else {
  512. showSyncOn(navSync,relpath);
  513. }
  514. if (navSync) {
  515. navSync.addEventListener('click', () => {
  516. const navSync = $('#nav-sync');
  517. if (hasClass(navSync, 'sync')) {
  518. navSync.classList.remove('sync');
  519. showSyncOff(navSync,relpath);
  520. storeLink(stripPath2(pathName())+hashUrl());
  521. } else {
  522. navSync.classList.add('sync');
  523. showSyncOn(navSync,relpath);
  524. deleteLink();
  525. }
  526. });
  527. }
  528. navTo(o,toroot,hashUrl(),relpath);
  529. showRoot();
  530. window.addEventListener('hashchange', () => {
  531. if (!animationInProgress) {
  532. if (window.location.hash && window.location.hash.length>1) {
  533. let a;
  534. if (location.hash) {
  535. const clslink=stripPath(pathName())+':'+hashValue();
  536. a=document.querySelector('.item a[class$="'+clslink.replace(/</g,'\\3c ')+'"]');
  537. }
  538. if (a==null || !hasClass(a.parentElement.parentElement, 'selected')) {
  539. $$('.item').forEach(item => {
  540. item.classList.remove('selected');
  541. item.removeAttribute('id');
  542. });
  543. }
  544. const link=stripPath2(pathName());
  545. navTo(o,link,hashUrl(),relpath);
  546. } else {
  547. const docContent = $('#doc-content');
  548. if (docContent) docContent.scrollTop = 0;
  549. $$('.item').forEach(item => {
  550. item.classList.remove('selected');
  551. item.removeAttribute('id');
  552. });
  553. navTo(o,toroot,hashUrl(),relpath);
  554. }
  555. }
  556. });
  557. window.addEventListener('resize', function() { adjustSyncIconPosition(); });
  558. let navtree_trampoline = {
  559. updateContentTop : function() {}
  560. }
  561. function initResizable() {
  562. let sidenav,mainnav,pagenav,container,navtree,content,header,footer,barWidth=6;
  563. const RESIZE_COOKIE_NAME = ''+'width';
  564. const PAGENAV_COOKIE_NAME = ''+'pagenav';
  565. const fullSidebar = document.querySelector('meta[name="doxygen-page-layout"]') !== null;
  566. function showHideNavBar() {
  567. const bar = document.querySelector('div.sm-dox');
  568. if (fullSidebar && mainnav && bar) {
  569. if (mainnav.clientWidth < 768) {
  570. bar.style.display = 'none';
  571. } else {
  572. bar.style.display = '';
  573. }
  574. }
  575. }
  576. function constrainPanelWidths(leftPanelWidth,rightPanelWidth,dragLeft) {
  577. const contentWidth = container.clientWidth - leftPanelWidth - rightPanelWidth;
  578. const minContentWidth = 250;
  579. const minPanelWidth = barWidth;
  580. if (contentWidth<minContentWidth) // need to shrink panels
  581. {
  582. const deficit = minContentWidth - contentWidth;
  583. if (dragLeft) { // dragging left handle -> try to keep right panel width
  584. const shrinkLeft = Math.min(deficit, leftPanelWidth-minPanelWidth);
  585. leftPanelWidth -= shrinkLeft;
  586. const remainingDeficit = deficit - shrinkLeft;
  587. const shrinkRight = Math.min(remainingDeficit, rightPanelWidth-minPanelWidth);
  588. rightPanelWidth -= shrinkRight;
  589. } else { // dragging right handle -> try to keep left panel width
  590. const shrinkRight = Math.min(deficit, rightPanelWidth-minPanelWidth);
  591. rightPanelWidth -= shrinkRight;
  592. const remainingDeficit = deficit - shrinkRight;
  593. const shrinkLeft = Math.min(remainingDeficit, leftPanelWidth-minPanelWidth);
  594. leftPanelWidth -= shrinkLeft;
  595. }
  596. } else {
  597. rightPanelWidth = pagenav ? Math.max(minPanelWidth,rightPanelWidth) : 0;
  598. leftPanelWidth = Math.max(minPanelWidth,leftPanelWidth);
  599. }
  600. return { leftPanelWidth, rightPanelWidth }
  601. }
  602. function updateWidths(sidenavWidth,pagenavWidth,dragLeft)
  603. {
  604. const widths = constrainPanelWidths(sidenavWidth,pagenavWidth,dragLeft);
  605. const widthStr = parseFloat(widths.leftPanelWidth)+"px";
  606. content.style.marginLeft = widthStr;
  607. if (fullSidebar) {
  608. footer.style.marginLeft = widthStr;
  609. if (mainnav) {
  610. mainnav.style.marginLeft = widthStr;
  611. }
  612. }
  613. sidenav.style.width = widthStr;
  614. if (pagenav) {
  615. container.style.gridTemplateColumns = 'auto '+parseFloat(widths.rightPanelWidth)+'px';
  616. if (!dragLeft) {
  617. pagenav.style.width = parseFloat(widths.rightPanelWidth-1)+'px';
  618. }
  619. }
  620. return widths;
  621. }
  622. function resizeWidth(dragLeft) {
  623. const sidenavWidth = sidenav.offsetWidth - barWidth;
  624. let pagenavWidth = pagenav ? pagenav.offsetWidth : 0;
  625. const widths = updateWidths(sidenavWidth,pagenavWidth,dragLeft);
  626. Cookie.writeSetting(RESIZE_COOKIE_NAME,widths.leftPanelWidth-barWidth);
  627. if (pagenav) {
  628. Cookie.writeSetting(PAGENAV_COOKIE_NAME,widths.rightPanelWidth);
  629. }
  630. }
  631. function restoreWidth(sidenavWidth,pagenavWidth) {
  632. updateWidths(sidenavWidth,pagenavWidth,false);
  633. showHideNavBar();
  634. }
  635. function resizeHeight() {
  636. const headerHeight = header.offsetHeight;
  637. const windowHeight = window.innerHeight;
  638. let contentHeight;
  639. const footerHeight = footer.offsetHeight;
  640. let navtreeHeight,sideNavHeight;
  641. if (!fullSidebar) {
  642. contentHeight = windowHeight - headerHeight - footerHeight - 1;
  643. navtreeHeight = contentHeight;
  644. sideNavHeight = contentHeight;
  645. } else if (fullSidebar) {
  646. contentHeight = windowHeight - footerHeight - 1;
  647. navtreeHeight = windowHeight - headerHeight - 1;
  648. sideNavHeight = windowHeight - 1;
  649. if (mainnav) {
  650. contentHeight -= mainnav.offsetHeight;
  651. }
  652. }
  653. navtree.style.height = navtreeHeight + "px";
  654. sidenav.style.height = sideNavHeight + "px";
  655. content.style.height = contentHeight + "px";
  656. resizeWidth(false);
  657. showHideNavBar();
  658. if (location.hash.slice(1)) {
  659. (document.getElementById(location.hash.slice(1))||document.body).scrollIntoView();
  660. }
  661. }
  662. header = $("#top");
  663. content = $("#doc-content");
  664. footer = $("#nav-path");
  665. sidenav = $("#side-nav");
  666. if (document.getElementById('main-nav')) {
  667. mainnav = $("#main-nav");
  668. }
  669. navtree = $("#nav-tree");
  670. pagenav = $("#page-nav");
  671. container = $("#container");
  672. // Native JavaScript implementation for resizable side navigation
  673. const splitbar = $("#splitbar");
  674. if (splitbar) {
  675. // Add the ui-resizable-e class to make the splitbar visible and styled correctly
  676. splitbar.classList.add('ui-resizable-e');
  677. splitbar.style.zIndex = 90;
  678. let isResizing = false;
  679. let startX = 0;
  680. let startWidth = 0;
  681. const startResize = (e) => {
  682. startX = e.clientX ?? e.touches?.[0]?.clientX;
  683. startWidth = sidenav.offsetWidth - barWidth;
  684. document.body.classList.add('resizing');
  685. document.body.style.cursor = 'col-resize';
  686. const doResize = (e) => {
  687. const clientX = e.clientX ?? e.touches?.[0]?.clientX;
  688. if (clientX === undefined) return;
  689. const delta = clientX - startX;
  690. const newWidth = startWidth + delta;
  691. sidenav.style.width = newWidth + 'px';
  692. resizeWidth(true);
  693. };
  694. const stopResize = () => {
  695. document.body.classList.remove('resizing');
  696. document.body.style.cursor = 'auto';
  697. document.removeEventListener('mousemove', doResize);
  698. document.removeEventListener('touchmove', doResize);
  699. document.removeEventListener('mouseup', stopResize);
  700. document.removeEventListener('touchend', stopResize);
  701. };
  702. document.addEventListener('mousemove', doResize);
  703. document.addEventListener('touchmove', doResize);
  704. document.addEventListener('mouseup', stopResize);
  705. document.addEventListener('touchend', stopResize);
  706. };
  707. splitbar.addEventListener('mousedown', startResize);
  708. splitbar.addEventListener('touchstart', startResize, { passive: false });
  709. }
  710. if (pagenav) {
  711. const pagehandle = $("#page-nav-resize-handle");
  712. if (pagehandle) {
  713. const startDrag = (e) => {
  714. document.body.classList.add('resizing');
  715. pagehandle.classList.add('dragging');
  716. const mouseMoveHandler = (e) => {
  717. const clientX = e.clientX ?? e.touches?.[0]?.clientX;
  718. if (clientX === undefined) return;
  719. let pagenavWidth = container.offsetWidth - clientX + barWidth/2;
  720. const sidenavWidth = sidenav.clientWidth;
  721. const widths = constrainPanelWidths(sidenavWidth,pagenavWidth,false);
  722. container.style.gridTemplateColumns = 'auto '+parseFloat(widths.rightPanelWidth)+'px';
  723. pagenav.style.width = parseFloat(widths.rightPanelWidth-1)+'px';
  724. content.style.marginLeft = parseFloat(widths.leftPanelWidth - barWidth)+'px';
  725. Cookie.writeSetting(PAGENAV_COOKIE_NAME,pagenavWidth);
  726. };
  727. const mouseUpHandler = (e) => {
  728. document.body.classList.remove('resizing');
  729. pagehandle.classList.remove('dragging');
  730. document.removeEventListener('mousemove', mouseMoveHandler);
  731. document.removeEventListener('mouseup', mouseUpHandler);
  732. document.removeEventListener('touchmove', mouseMoveHandler);
  733. document.removeEventListener('touchend', mouseUpHandler);
  734. };
  735. document.addEventListener('mousemove', mouseMoveHandler);
  736. document.addEventListener('touchmove', mouseMoveHandler);
  737. document.addEventListener('mouseup', mouseUpHandler);
  738. document.addEventListener('touchend', mouseUpHandler);
  739. };
  740. pagehandle.addEventListener('mousedown', startDrag);
  741. pagehandle.addEventListener('touchstart', startDrag, { passive: false });
  742. }
  743. } else {
  744. container.style.gridTemplateColumns = 'auto';
  745. }
  746. const width = parseInt(Cookie.readSetting(RESIZE_COOKIE_NAME,250));
  747. const pagenavWidth = parseInt(Cookie.readSetting(PAGENAV_COOKIE_NAME,250));
  748. if (width) { restoreWidth(width+barWidth,pagenavWidth); } else { resizeWidth(); }
  749. const url = location.href;
  750. const i=url.indexOf("#");
  751. if (i>=0) window.location.hash=url.substr(i);
  752. let lastWidth = -1;
  753. let lastHeight = -1;
  754. window.addEventListener('resize', function() {
  755. const newWidth = window.innerWidth;
  756. const newHeight = window.innerHeight;
  757. if (newWidth!=lastWidth || newHeight!=lastHeight) {
  758. resizeHeight();
  759. navtree_trampoline.updateContentTop();
  760. lastWidth = newWidth;
  761. lastHeight = newHeight;
  762. }
  763. });
  764. resizeHeight();
  765. lastWidth = window.innerWidth;
  766. lastHeight = window.innerHeight;
  767. if (content) {
  768. content.addEventListener('scroll', function() {
  769. navtree_trampoline.updateContentTop();
  770. });
  771. }
  772. }
  773. function initPageToc() {
  774. const topMapping = [];
  775. const toc_contents = $('#page-nav-contents');
  776. const content = document.createElement('ul');
  777. content.className = 'page-outline';
  778. var entityMap = {
  779. '&': '&amp;',
  780. '<': '&lt;',
  781. '>': '&gt;',
  782. '"': '&quot;',
  783. "'": '&#39;',
  784. '/': '&#x2F;',
  785. '`': '&#x60;',
  786. '=': '&#x3D;'
  787. };
  788. function escapeHtml (string) {
  789. return String(string).replace(/[&<>"'`=\/]/g, function (s) {
  790. return entityMap[s];
  791. });
  792. }
  793. // for ClassDef/GroupDef/ModuleDef/ConceptDef/DirDef
  794. const groupSections = [];
  795. let currentGroup = null;
  796. $$('h2.groupheader, h2.memtitle').forEach(function(element){
  797. if (hasClass(element, 'groupheader')) {
  798. currentGroup = { groupHeader: element, memTitles: [] };
  799. groupSections.push(currentGroup);
  800. } else if (hasClass(element, 'memtitle') && currentGroup) {
  801. currentGroup.memTitles.push(element);
  802. }
  803. });
  804. groupSections.forEach(function(item){
  805. const title = item.groupHeader.textContent.trim();
  806. let id = item.groupHeader.getAttribute('id');
  807. let table = item.groupHeader.closest('table.memberdecls');
  808. let rows = [];
  809. if (table) {
  810. rows = Array.from(table.querySelectorAll("tr[class^='memitem:'] td.memItemRight, tr[class^='memitem:'] td.memItemLeft.anon, tr[class=groupHeader] td"));
  811. }
  812. function hasSubItems() {
  813. return item.memTitles.length>0 || rows.some(function(el) {
  814. return el.offsetParent !== null; // check if visible
  815. });
  816. }
  817. const li = document.createElement('li');
  818. li.setAttribute('id', 'nav-'+id);
  819. const div = document.createElement('div');
  820. div.classList.add('item');
  821. const span = document.createElement('span');
  822. span.classList.add('arrow');
  823. span.style.paddingLeft='0px';
  824. if (hasSubItems()) {
  825. const arrowSpan = document.createElement('span');
  826. arrowSpan.classList.add('arrowhead', 'opened');
  827. span.appendChild(arrowSpan);
  828. }
  829. const ahref = document.createElement('a');
  830. ahref.setAttribute('href', '#'+id);
  831. ahref.textContent = title;
  832. div.appendChild(span);
  833. div.appendChild(ahref);
  834. li.appendChild(div);
  835. content.appendChild(li);
  836. topMapping.push(id);
  837. const ulStack = [];
  838. ulStack.push(content);
  839. if (hasSubItems()) {
  840. let last_id = undefined;
  841. let inMemberGroup = false;
  842. // declaration sections have rows for items
  843. rows.forEach(function(td) {
  844. let tr = td.parentElement;
  845. const firstChild = td.childNodes[0];
  846. const is_anon_enum = firstChild && firstChild.textContent.trim()=='{';
  847. if (hasClass(tr, 'template')) {
  848. tr = tr.previousElementSibling;
  849. }
  850. id = tr.getAttribute('id');
  851. let text = is_anon_enum ? 'anonymous enum' : (td.querySelector(':first-child') ? td.querySelector(':first-child').textContent : '');
  852. let isMemberGroupHeader = hasClass(tr, 'groupHeader');
  853. if (tr.offsetParent !== null && last_id!=id && id!==undefined && id!==null) {
  854. if (isMemberGroupHeader && inMemberGroup) {
  855. ulStack.pop();
  856. inMemberGroup=false;
  857. }
  858. const li2 = document.createElement('li');
  859. li2.setAttribute('id', 'nav-'+id);
  860. const div2 = document.createElement('div');
  861. div2.classList.add('item');
  862. const span2 = document.createElement('span');
  863. span2.classList.add('arrow');
  864. span2.style.paddingLeft = parseInt(ulStack.length*16)+'px';
  865. const ahref = document.createElement('a');
  866. ahref.setAttribute('href', '#'+id);
  867. ahref.textContent = escapeHtml(text);
  868. div2.appendChild(span2);
  869. div2.appendChild(ahref);
  870. li2.appendChild(div2);
  871. topMapping.push(id);
  872. if (isMemberGroupHeader) {
  873. const arrowSpan = document.createElement('span');
  874. arrowSpan.classList.add('arrowhead','opened');
  875. span2.appendChild(arrowSpan);
  876. ulStack[ulStack.length-1].appendChild(li2);
  877. const ul2 = document.createElement('ul');
  878. ulStack.push(ul2);
  879. li2.appendChild(ul2);
  880. inMemberGroup=true;
  881. } else {
  882. ulStack[ulStack.length-1].appendChild(li2);
  883. }
  884. last_id=id;
  885. }
  886. });
  887. // detailed documentation has h2.memtitle sections for items
  888. item.memTitles.forEach(function(data) {
  889. const childNodes = Array.from(data.childNodes);
  890. const firstChild = data.children[0];
  891. let text = '';
  892. childNodes.forEach(node => {
  893. if (node !== firstChild) {
  894. text += node.textContent || '';
  895. }
  896. });
  897. const name = text.replace(/\(\)(\s*\[\d+\/\d+\])?$/, '') // func() [2/8] -> func
  898. const permalinkAnchor = data.querySelector('span.permalink a');
  899. id = permalinkAnchor ? permalinkAnchor.getAttribute('href') : undefined;
  900. if (id!==undefined && name!==undefined) {
  901. const li2 = document.createElement('li');
  902. li2.setAttribute('id', 'nav-'+id.substring(1));
  903. const div2 = document.createElement('div');
  904. div2.classList.add('item');
  905. const span2 = document.createElement('span');
  906. span2.classList.add('arrow');
  907. span2.style.paddingLeft = parseInt(ulStack.length*16)+'px';
  908. const ahref = document.createElement('a');
  909. ahref.setAttribute('href', id);
  910. ahref.textContent = escapeHtml(name);
  911. div2.appendChild(span2);
  912. div2.appendChild(ahref);
  913. li2.appendChild(div2);
  914. ulStack[ulStack.length-1].appendChild(li2);
  915. topMapping.push(id.substring(1));
  916. }
  917. });
  918. }
  919. });
  920. if (allMembersFile.length) { // add entry linking to all members page
  921. const url = location.href;
  922. let srcBaseUrl = '';
  923. let dstBaseUrl = '';
  924. if (relpath.length) { // CREATE_SUBDIRS=YES -> find target location
  925. srcBaseUrl = url.substring(0, url.lastIndexOf('/')) + '/' + relpath;
  926. dstBaseUrl = allMembersFile.substr(0, allMembersFile.lastIndexOf('/'))+'/';
  927. }
  928. const pageName = url.split('/').pop().split('#')[0].replace(/(\.[^/.]+)$/, '-members$1');
  929. const li = document.createElement('li');
  930. const div = document.createElement('div');
  931. div.classList.add('item');
  932. const span = document.createElement('span');
  933. span.classList.add('arrow');
  934. span.style.paddingLeft='0px';
  935. const ahref = document.createElement('a');
  936. ahref.setAttribute('href', srcBaseUrl+dstBaseUrl+pageName);
  937. ahref.classList.add('noscroll');
  938. ahref.textContent = LISTOFALLMEMBERS;
  939. div.appendChild(span);
  940. div.appendChild(ahref);
  941. li.appendChild(div);
  942. content.appendChild(li);
  943. }
  944. if (groupSections.length==0) {
  945. // for PageDef
  946. const sectionTree = [], sectionStack = [];
  947. $$('h1.doxsection, h2.doxsection, h3.doxsection, h4.doxsection, h5.doxsection, h6.doxsection').forEach(function(element){
  948. const level = parseInt(element.tagName[1]);
  949. const anchorEl = element.querySelector('a.anchor');
  950. const anchor = anchorEl ? anchorEl.getAttribute('id') : null;
  951. // Note: innerHTML is used here to preserve HTML formatting in section headings
  952. // This content is generated by doxygen, not from user input
  953. const node = { text: element.innerHTML, id: anchor, children: [] };
  954. while (sectionStack.length && sectionStack[sectionStack.length - 1].level >= level) sectionStack.pop();
  955. (sectionStack.length ? sectionStack[sectionStack.length - 1].children : sectionTree).push(node);
  956. sectionStack.push({ ...node, level });
  957. });
  958. if (sectionTree.length>0) {
  959. function render(nodes, level=0) {
  960. nodes.map(n => {
  961. const li = document.createElement('li');
  962. li.setAttribute('id', 'nav-'+n.id);
  963. const div = document.createElement('div');
  964. div.classList.add('item');
  965. const span = document.createElement('span');
  966. span.classList.add('arrow');
  967. span.setAttribute('style', 'padding-left:'+parseInt(level*16)+'px;');
  968. if (n.children.length > 0) {
  969. const arrowSpan = document.createElement('span');
  970. arrowSpan.classList.add('arrowhead','opened');
  971. span.appendChild(arrowSpan);
  972. }
  973. const url = document.createElement('a');
  974. url.setAttribute('href', '#'+n.id);
  975. // innerHTML used to preserve HTML formatting from doxygen-generated content
  976. url.innerHTML = n.text;
  977. div.appendChild(span);
  978. div.appendChild(url);
  979. li.appendChild(div);
  980. content.appendChild(li);
  981. topMapping.push(n.id);
  982. render(n.children,level+1);
  983. });
  984. }
  985. render(sectionTree);
  986. }
  987. }
  988. if (toc_contents) {
  989. toc_contents.appendChild(content);
  990. }
  991. $$(".page-outline a[href]:not(.noscroll)").forEach(function(anchor) {
  992. anchor.addEventListener('click', function(e) {
  993. e.preventDefault();
  994. const aname = this.getAttribute("href");
  995. gotoAnchor(document.querySelector(aname), aname);
  996. });
  997. });
  998. let lastScrollSourceOffset = -1;
  999. let lastScrollTargetOffset = -1;
  1000. let lastScrollTargetId = '';
  1001. navtree_trampoline.updateContentTop = function() {
  1002. const pagenavcontents = $("#page-nav-contents");
  1003. if (pagenavcontents) {
  1004. const content = $("#doc-content");
  1005. const height = content ? content.clientHeight : 0;
  1006. const navy = pagenavcontents ? offsetTop(pagenavcontents) : 0;
  1007. const yc = content ? offsetTop(content) : 0;
  1008. let offsets = []
  1009. for (let i=0;i<topMapping.length;i++) {
  1010. const heading = document.getElementById(topMapping[i]);
  1011. if (heading && heading.parentElement && hasClass(heading.parentElement, 'doxsection')) {
  1012. offsets.push({id:topMapping[i],y:offsetTop(heading.parentElement)-yc});
  1013. } else if (heading) {
  1014. offsets.push({id:topMapping[i],y:offsetTop(heading)-yc});
  1015. }
  1016. }
  1017. offsets.push({id:'',y:1e10});
  1018. let scrollTarget = undefined, numItems=0;
  1019. for (let i=0;i<offsets.length-1;i++) {
  1020. const ys = offsets[i].y;
  1021. const ye = offsets[i+1].y;
  1022. const id = offsets[i].id;
  1023. const nav = document.getElementById('nav-'+id);
  1024. const margin = 10; // #pixels before content show as visible
  1025. if ((ys>margin || ye>margin) && (ys<height-margin || ye<height-margin)) {
  1026. if (!scrollTarget) scrollTarget=nav;
  1027. if (nav) nav.classList.add('vis'); // mark navigation entry as visible within content area
  1028. numItems+=1;
  1029. } else {
  1030. if (nav) nav.classList.remove('vis');
  1031. }
  1032. }
  1033. const contentsDiv = document.querySelector('div.contents');
  1034. const contentScrollOffset = contentsDiv ? offsetTop(contentsDiv) : 0;
  1035. if (scrollTarget && lastScrollTargetId!=scrollTarget.getAttribute('id')) { // new item to scroll to
  1036. const scrollDown = contentScrollOffset<lastScrollSourceOffset;
  1037. const range = 22*numItems;
  1038. const my = range/2-height/2;
  1039. const pageOutline = document.querySelector('ul.page-outline');
  1040. const ulOffset = pageOutline ? offsetTop(pageOutline)-navy : 0;
  1041. const targetPos = offsetTop(scrollTarget)-navy-ulOffset;
  1042. const targetOffset=targetPos+my;
  1043. if ( (scrollDown && targetOffset>lastScrollTargetOffset) ||
  1044. (!scrollDown && targetOffset<lastScrollTargetOffset))
  1045. { // force panel to scroll in the same direction as content window
  1046. if (pagenavcontents) {
  1047. pagenavcontents.scrollTo({
  1048. left: 0,
  1049. top: targetOffset,
  1050. behavior: 'smooth'
  1051. });
  1052. }
  1053. lastScrollTargetOffset = targetOffset;
  1054. }
  1055. lastScrollTargetId = scrollTarget.getAttribute('id');
  1056. }
  1057. lastScrollSourceOffset = contentScrollOffset;
  1058. }
  1059. }
  1060. // TODO: find out how to avoid a timeout
  1061. setTimeout(() => {
  1062. navtree_trampoline.updateContentTop();
  1063. },200);
  1064. }
  1065. if (document.readyState === 'loading') {
  1066. document.addEventListener('DOMContentLoaded', function() {
  1067. initPageToc();
  1068. initResizable();
  1069. });
  1070. } else {
  1071. initPageToc();
  1072. initResizable();
  1073. }
  1074. initResizableFunc = initResizable;
  1075. }
  1076. /* @license-end */