1 function initResizable()
3 var cookie_namespace = 'doxygen';
4 var sidenav,navtree,content,header,collapsed,collapsedWidth=0,barWidth=6,desktop_vp=768,titleHeight;
6 function readCookie(cookie)
8 var myCookie = cookie_namespace+"_"+cookie+"=";
10 var index = document.cookie.indexOf(myCookie);
12 var valStart = index + myCookie.length;
13 var valEnd = document.cookie.indexOf(";", valStart);
15 valEnd = document.cookie.length;
17 var val = document.cookie.substring(valStart, valEnd);
24 function writeCookie(cookie, val, expiration)
26 if (val==undefined) return;
27 if (expiration == null) {
28 var date = new Date();
29 date.setTime(date.getTime()+(10*365*24*60*60*1000)); // default expiration is one week
30 expiration = date.toGMTString();
32 document.cookie = cookie_namespace + "_" + cookie + "=" + val + "; expires=" + expiration+"; path=/";
35 function resizeWidth()
37 var windowWidth = $(window).width() + "px";
38 var sidenavWidth = $(sidenav).outerWidth();
39 content.css({marginLeft:parseInt(sidenavWidth)+"px"});
40 writeCookie('width',sidenavWidth-barWidth, null);
43 function restoreWidth(navWidth)
45 var windowWidth = $(window).width() + "px";
46 content.css({marginLeft:parseInt(navWidth)+barWidth+"px"});
47 sidenav.css({width:navWidth + "px"});
50 function resizeHeight()
52 var headerHeight = header.outerHeight();
53 var footerHeight = footer.outerHeight();
54 var windowHeight = $(window).height() - headerHeight - footerHeight;
55 content.css({height:windowHeight + "px"});
56 navtree.css({height:windowHeight + "px"});
57 sidenav.css({height:windowHeight + "px"});
58 var width=$(window).width();
59 if (width!=collapsedWidth) {
60 if (width<desktop_vp && collapsedWidth>=desktop_vp) {
64 } else if (width>desktop_vp && collapsedWidth<desktop_vp) {
73 function collapseExpand()
75 if (sidenav.width()>0) {
80 var width = readCookie('width');
81 if (width>200 && width<$(window).width()) { restoreWidth(width); } else { restoreWidth(200); }
87 sidenav = $("#side-nav");
88 content = $("#doc-content");
89 navtree = $("#nav-tree");
90 footer = $("#nav-path");
91 $(".side-nav-resizable").resizable({resize: function(e, ui) { resizeWidth(); } });
92 $(sidenav).resizable({ minWidth: 0 });
93 $(window).resize(function() { resizeHeight(); });
94 var device = navigator.userAgent.toLowerCase();
95 var touch_device = device.match(/(iphone|ipod|ipad|android)/);
96 if (touch_device) { /* wider split bar for touch only devices */
97 $(sidenav).css({ paddingRight:'20px' });
98 $('.ui-resizable-e').css({ width:'20px' });
99 $('#nav-sync').css({ right:'34px' });
102 var width = readCookie('width');
103 if (width) { restoreWidth(width); } else { resizeWidth(); }
105 var url = location.href;
106 var i=url.indexOf("#");
107 if (i>=0) window.location.hash=url.substr(i);
108 var _preventDefault = function(evt) { evt.preventDefault(); };
109 $("#splitbar").bind("dragstart", _preventDefault).bind("selectstart", _preventDefault);
110 $(".ui-resizable-handle").dblclick(collapseExpand);
111 $(window).load(resizeHeight);