2 @licstart The following is the entire license notice for the JavaScript code in this file.
6 Copyright (C) 1997-2020 by Dimitri van Heesch
8 Permission is hereby granted, free of charge, to any person obtaining a copy of this software
9 and associated documentation files (the "Software"), to deal in the Software without restriction,
10 including without limitation the rights to use, copy, modify, merge, publish, distribute,
11 sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
12 furnished to do so, subject to the following conditions:
14 The above copyright notice and this permission notice shall be included in all copies or
15 substantial portions of the Software.
17 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
18 BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
20 DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 @licend The above is the entire license notice for the JavaScript code in this file
26function initResizable(treeview) {
27 let sidenav,navtree,content,header,footer,barWidth=6;
28 const RESIZE_COOKIE_NAME = ''+'width';
30 function resizeWidth() {
31 const sidenavWidth = $(sidenav).outerWidth();
32 content.css({marginLeft:parseInt(sidenavWidth)+"px"});
33 if (typeof page_layout!=='undefined' && page_layout==1) {
34 footer.css({marginLeft:parseInt(sidenavWidth)+"px"});
36 Cookie.writeSetting(RESIZE_COOKIE_NAME,sidenavWidth-barWidth);
39 function restoreWidth(navWidth) {
40 content.css({marginLeft:parseInt(navWidth)+barWidth+"px"});
41 if (typeof page_layout!=='undefined' && page_layout==1) {
42 footer.css({marginLeft:parseInt(navWidth)+barWidth+"px"});
44 sidenav.css({width:navWidth + "px"});
47 function resizeHeight(treeview) {
48 const headerHeight = header.outerHeight();
49 const windowHeight = $(window).height();
53 const footerHeight = footer.outerHeight();
54 let navtreeHeight,sideNavHeight;
55 if (typeof page_layout==='undefined' || page_layout==0) { /* DISABLE_INDEX=NO */
56 contentHeight = windowHeight - headerHeight - footerHeight;
57 navtreeHeight = contentHeight;
58 sideNavHeight = contentHeight;
59 } else if (page_layout==1) { /* DISABLE_INDEX=YES */
60 contentHeight = windowHeight - footerHeight;
61 navtreeHeight = windowHeight - headerHeight;
62 sideNavHeight = windowHeight;
64 navtree.css({height:navtreeHeight + "px"});
65 sidenav.css({height:sideNavHeight + "px"});
69 contentHeight = windowHeight - headerHeight;
71 content.css({height:contentHeight + "px"});
72 if (location.hash.slice(1)) {
73 (document.getElementById(location.hash.slice(1))||document.body).scrollIntoView();
77 function collapseExpand() {
79 if (sidenav.width()>0) {
82 const width = Cookie.readSetting(RESIZE_COOKIE_NAME,250);
83 newWidth = (width>250 && width<$(window).width()) ? width : 250;
85 restoreWidth(newWidth);
86 const sidenavWidth = $(sidenav).outerWidth();
87 Cookie.writeSetting(RESIZE_COOKIE_NAME,sidenavWidth-barWidth);
91 content = $("#doc-content");
92 footer = $("#nav-path");
93 sidenav = $("#side-nav");
95// title = $("#titlearea");
96// titleH = $(title).height();
97// let animating = false;
98// content.on("scroll", function() {
99// slideOpts = { duration: 200,
101// contentHeight = $(window).height() - header.outerHeight();
102// content.css({ height : contentHeight + "px" });
104// done: function() { animating=false; }
106// if (content.scrollTop()>titleH && title.css('display')!='none' && !animating) {
107// title.slideUp(slideOpts);
109// } else if (content.scrollTop()<=titleH && title.css('display')=='none' && !animating) {
110// title.slideDown(slideOpts);
115 navtree = $("#nav-tree");
116 $(".side-nav-resizable").resizable({resize: function(e, ui) { resizeWidth(); } });
117 $(sidenav).resizable({ minWidth: 0 });
119 $(window).resize(function() { resizeHeight(treeview); });
122 const device = navigator.userAgent.toLowerCase();
123 const touch_device = device.match(/(iphone|ipod|ipad|android)/);
124 if (touch_device) { /* wider split bar for touch only devices */
125 $(sidenav).css({ paddingRight:'20px' });
126 $('.ui-resizable-e').css({ width:'20px' });
127 $('#nav-sync').css({ right:'34px' });
130 const width = Cookie.readSetting(RESIZE_COOKIE_NAME,250);
131 if (width) { restoreWidth(width); } else { resizeWidth(); }
133 resizeHeight(treeview);
134 const url = location.href;
135 const i=url.indexOf("#");
136 if (i>=0) window.location.hash=url.substr(i);
137 const _preventDefault = function(evt) { evt.preventDefault(); };
140 $("#splitbar").bind("dragstart", _preventDefault).bind("selectstart", _preventDefault);
141 $(".ui-resizable-handle").dblclick(collapseExpand);
142 // workaround for firefox
143 $("body").css({overflow: "hidden"});
145 $(window).on('load',function() { resizeHeight(treeview); });