2 // generate a table of contents in the side-nav based on the h1/h2 tags of the current page.
3 function generate_autotoc() {
4 var headers = $("h1, h2");
5 if(headers.length > 1) {
6 var toc = $("#side-nav").append('<div id="nav-toc" class="toc"><h3>Table of contents</h3></div>');
8 var footer = $("#nav-path");
9 var footerHeight = footer.height();
10 toc = toc.append('<ul></ul>');
12 var indices = new Array();
16 var h1counts = $("h1").length;
17 headers.each(function(i) {
18 var current = $(this);
19 var levelTag = current[0].tagName.charAt(1);
22 var cur_id = current.attr("id");
24 indices[levelTag-1]+=1;
25 var prefix = indices[0];
27 prefix+="."+indices[1];
30 // Uncomment to add number prefixes
31 // current.html(prefix + " " + current.html());
32 for(var l = levelTag; l < 2; ++l){
36 if(cur_id == undefined) {
37 current.attr('id', 'title' + i);
38 current.addClass('anchor');
39 toc.append("<li class='level" + levelTag + "'><a id='link" + i + "' href='#title" +
40 i + "' title='" + current.prop("tagName") + "'>" + current.text() + "</a></li>");
42 toc.append("<li class='level" + levelTag + "'><a id='" + cur_id + "' href='#title" +
43 i + "' title='" + current.prop("tagName") + "'>" + current.text() + "</a></li>");
51 var global_navtree_object;
53 // Overloaded to remove links to sections/subsections
54 function getNode(o, po)
56 po.childrenVisited = true;
57 var l = po.childrenData.length-1;
58 for (var i in po.childrenData) {
59 var nodeData = po.childrenData[i];
60 if((!nodeData[1]) || (nodeData[1].indexOf('#')==-1)) // <- we added this line
61 po.children[i] = newNode(o, po, nodeData[0], nodeData[1], nodeData[2], i==l);
66 @licstart The following is the entire license notice for the JavaScript code in this file.
70 Copyright (C) 1997-2020 by Dimitri van Heesch
72 Permission is hereby granted, free of charge, to any person obtaining a copy of this software
73 and associated documentation files (the "Software"), to deal in the Software without restriction,
74 including without limitation the rights to use, copy, modify, merge, publish, distribute,
75 sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
76 furnished to do so, subject to the following conditions:
78 The above copyright notice and this permission notice shall be included in all copies or
79 substantial portions of the Software.
81 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
82 BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
83 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
84 DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
85 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
87 @licend The above is the entire license notice for the JavaScript code in this file
89 // We need to override entire resizable just so we can change the height to account for the TOC.
90 function initResizable()
92 var cookie_namespace = 'doxygen';
93 var sidenav,navtree,content,header,collapsed,collapsedWidth=0,barWidth=6,desktop_vp=768,titleHeight;
95 function readCookie(cookie)
97 var myCookie = cookie_namespace+"_"+cookie+"=";
98 if (document.cookie) {
99 var index = document.cookie.indexOf(myCookie);
101 var valStart = index + myCookie.length;
102 var valEnd = document.cookie.indexOf(";", valStart);
104 valEnd = document.cookie.length;
106 var val = document.cookie.substring(valStart, valEnd);
113 function writeCookie(cookie, val, expiration)
115 if (val==undefined) return;
116 if (expiration == null) {
117 var date = new Date();
118 date.setTime(date.getTime()+(10*365*24*60*60*1000)); // default expiration is one week
119 expiration = date.toGMTString();
121 document.cookie = cookie_namespace + "_" + cookie + "=" + val + "; expires=" + expiration+"; path=/";
124 function resizeWidth()
126 var windowWidth = $(window).width() + "px";
127 var sidenavWidth = $(sidenav).outerWidth();
128 content.css({marginLeft:parseInt(sidenavWidth)+"px"});
129 writeCookie('width',sidenavWidth-barWidth, null);
132 function restoreWidth(navWidth)
134 var windowWidth = $(window).width() + "px";
135 content.css({marginLeft:parseInt(navWidth)+barWidth+"px"});
136 sidenav.css({width:navWidth + "px"});
139 function resizeHeight()
141 var headerHeight = header.outerHeight();
142 var footerHeight = footer.outerHeight();
143 var windowHeight = $(window).height() - headerHeight - footerHeight;
144 //==========================================================================
146 // This small section is the only portion modified within initResizable().
147 // The rest is copy-pasted from the doxygen-generated resize.js.
149 // Adjust nav height to make room for TOC.
150 var toc = $("#nav-toc");
151 var tocHeight = toc.height();
152 var navHeight = windowHeight;
153 // tocHeight is not always defined (e.g. if empty)
155 navHeight = windowHeight - tocHeight;
157 //==========================================================================
159 content.css({height:windowHeight + "px"});
160 navtree.css({height:navHeight + "px"});
161 sidenav.css({height:windowHeight + "px"});
163 var width=$(window).width();
164 if (width!=collapsedWidth) {
165 if (width<desktop_vp && collapsedWidth>=desktop_vp) {
169 } else if (width>desktop_vp && collapsedWidth<desktop_vp) {
174 collapsedWidth=width;
176 if (location.hash.slice(1)) {
177 (document.getElementById(location.hash.slice(1))||document.body).scrollIntoView();
181 function collapseExpand()
183 if (sidenav.width()>0) {
188 var width = readCookie('width');
189 if (width>200 && width<$(window).width()) { restoreWidth(width); } else { restoreWidth(200); }
194 sidenav = $("#side-nav");
195 content = $("#doc-content");
196 navtree = $("#nav-tree");
197 footer = $("#nav-path");
199 $(".side-nav-resizable").resizable({resize: function(e, ui) { resizeWidth(); } });
200 $(sidenav).resizable({ minWidth: 0 });
201 $(window).resize(function() { resizeHeight(); });
202 var device = navigator.userAgent.toLowerCase();
203 var touch_device = device.match(/(iphone|ipod|ipad|android)/);
204 if (touch_device) { /* wider split bar for touch only devices */
205 $(sidenav).css({ paddingRight:'20px' });
206 $('.ui-resizable-e').css({ width:'20px' });
207 $('#nav-sync').css({ right:'34px' });
210 var width = readCookie('width');
211 if (width) { restoreWidth(width); } else { resizeWidth(); }
213 var url = location.href;
214 var i=url.indexOf("#");
215 if (i>=0) window.location.hash=url.substr(i);
216 var _preventDefault = function(evt) { evt.preventDefault(); };
217 $("#splitbar").bind("dragstart", _preventDefault).bind("selectstart", _preventDefault);
218 $(".ui-resizable-handle").dblclick(collapseExpand);
219 $(window).on('load',resizeHeight);
222 // Overloaded to save the root node into global_navtree_object
223 function initNavTree(toroot,relpath)
225 var o = new Object();
226 global_navtree_object = o; // <- we added this line
228 o.node = new Object();
229 o.node.li = document.getElementById("nav-tree-contents");
230 o.node.childrenData = NAVTREE;
231 o.node.children = new Array();
232 o.node.childrenUL = document.createElement("ul");
233 o.node.getChildrenUL = function() { return o.node.childrenUL; };
234 o.node.li.appendChild(o.node.childrenUL);
236 o.node.relpath = relpath;
237 o.node.expanded = false;
238 o.node.isLast = true;
239 o.node.plus_img = document.createElement("img");
240 o.node.plus_img.src = relpath+"ftv2pnode.png";
241 o.node.plus_img.width = 16;
242 o.node.plus_img.height = 22;
244 if (localStorageSupported()) {
245 var navSync = $('#nav-sync');
247 showSyncOff(navSync,relpath);
248 navSync.removeClass('sync');
250 showSyncOn(navSync,relpath);
252 navSync.click(function(){ toggleSyncButton(relpath); });
255 navTo(o,toroot,window.location.hash,relpath);
257 $(window).bind('hashchange', function(){
258 if (window.location.hash && window.location.hash.length>1){
260 if ($(location).attr('hash')){
261 var clslink=stripPath($(location).attr('pathname'))+':'+
262 $(location).attr('hash').substring(1);
263 a=$('.item a[class$="'+clslink+'"]');
265 if (a==null || !$(a).parent().parent().hasClass('selected')){
266 $('.item').removeClass('selected');
267 $('.item').removeAttr('id');
269 var link=stripPath2($(location).attr('pathname'));
270 navTo(o,link,$(location).attr('hash'),relpath);
271 } else if (!animationInProgress) {
272 $('#doc-content').scrollTop(0);
273 $('.item').removeClass('selected');
274 $('.item').removeAttr('id');
275 navTo(o,toroot,window.location.hash,relpath);
279 $(window).on("load", showRoot);
282 // return false if the the node has no children at all, or has only section/subsection children
283 function checkChildrenData(node) {
284 if (!(typeof(node.childrenData)==='string')) {
285 for (var i in node.childrenData) {
286 var url = node.childrenData[i][1];
287 if(url.indexOf("#")==-1)
292 return (node.childrenData);
296 // 1 - remove the root node
297 // 2 - remove the section/subsection children
298 function createIndent(o,domNode,node,level)
300 var level=-2; // <- we replaced level=-1 by level=-2
302 while (n.parentNode) { level++; n=n.parentNode; }
303 if (checkChildrenData(node)) { // <- we modified this line to use checkChildrenData(node) instead of node.childrenData
304 var imgNode = document.createElement("span");
305 imgNode.className = 'arrow';
306 imgNode.style.paddingLeft=(16*level).toString()+'px';
307 imgNode.innerHTML=arrowRight;
308 node.plus_img = imgNode;
309 node.expandToggle = document.createElement("a");
310 node.expandToggle.href = "javascript:void(0)";
311 node.expandToggle.onclick = function() {
313 $(node.getChildrenUL()).slideUp("fast");
314 node.plus_img.innerHTML=arrowRight;
315 node.expanded = false;
317 expandNode(o, node, false, false);
320 node.expandToggle.appendChild(imgNode);
321 domNode.appendChild(node.expandToggle);
323 var span = document.createElement("span");
324 span.className = 'arrow';
325 span.style.width = 16*(level+1)+'px';
326 span.innerHTML = ' ';
327 domNode.appendChild(span);
331 // Overloaded to automatically expand the selected node
332 function selectAndHighlight(hash,n)
336 var link=stripPath($(location).attr('pathname'))+':'+hash.substring(1);
337 a=$('.item a[class$="'+link+'"]');
340 a.parent().parent().addClass('selected');
341 a.parent().parent().attr('id','selected');
344 $(n.itemDiv).addClass('selected');
345 $(n.itemDiv).attr('id','selected');
347 if ($('#nav-tree-contents .item:first').hasClass('selected')) {
348 $('#nav-sync').css('top','30px');
350 $('#nav-sync').css('top','5px');
352 expandNode(global_navtree_object, n, true, true); // <- we added this line
357 $(document).ready(function() {
361 (function (){ // wait until the first "selected" element has been created
364 // this line will triger an exception if there is no #selected element, i.e., before the tree structure is complete.
365 document.getElementById("selected").className = "item selected";
367 // ok, the default tree has been created, we can keep going...
369 // expand the "Chapters" node
370 if(window.location.href.indexOf('unsupported')==-1)
371 expandNode(global_navtree_object, global_navtree_object.node.children[0].children[2], true, true);
373 expandNode(global_navtree_object, global_navtree_object.node.children[0].children[1], true, true);
375 // Hide the root node "Eigen"
376 $(document.getElementsByClassName('index.html')[0]).parent().parent().css({display:"none"});
379 setTimeout(arguments.callee, 10);