Chris@6: function initResizable() Chris@6: { Chris@6: var cookie_namespace = 'doxygen'; Chris@6: var sidenav,navtree,content,header,collapsed,collapsedWidth=0,barWidth=6,desktop_vp=768,titleHeight; Chris@1: Chris@6: function readCookie(cookie) Chris@1: { Chris@6: var myCookie = cookie_namespace+"_"+cookie+"="; Chris@6: if (document.cookie) { Chris@6: var index = document.cookie.indexOf(myCookie); Chris@6: if (index != -1) { Chris@6: var valStart = index + myCookie.length; Chris@6: var valEnd = document.cookie.indexOf(";", valStart); Chris@6: if (valEnd == -1) { Chris@6: valEnd = document.cookie.length; Chris@6: } Chris@6: var val = document.cookie.substring(valStart, valEnd); Chris@6: return val; Chris@1: } Chris@6: } Chris@6: return 0; Chris@6: } Chris@6: Chris@6: function writeCookie(cookie, val, expiration) Chris@6: { Chris@6: if (val==undefined) return; Chris@6: if (expiration == null) { Chris@6: var date = new Date(); Chris@6: date.setTime(date.getTime()+(10*365*24*60*60*1000)); // default expiration is one week Chris@6: expiration = date.toGMTString(); Chris@6: } Chris@6: document.cookie = cookie_namespace + "_" + cookie + "=" + val + "; expires=" + expiration+"; path=/"; Chris@6: } Chris@6: Chris@6: function resizeWidth() Chris@6: { Chris@6: var windowWidth = $(window).width() + "px"; Chris@6: var sidenavWidth = $(sidenav).outerWidth(); Chris@6: content.css({marginLeft:parseInt(sidenavWidth)+"px"}); Chris@6: writeCookie('width',sidenavWidth-barWidth, null); Chris@6: } Chris@6: Chris@6: function restoreWidth(navWidth) Chris@6: { Chris@6: var windowWidth = $(window).width() + "px"; Chris@6: content.css({marginLeft:parseInt(navWidth)+barWidth+"px"}); Chris@6: sidenav.css({width:navWidth + "px"}); Chris@6: } Chris@6: Chris@6: function resizeHeight() Chris@6: { Chris@6: var headerHeight = header.outerHeight(); Chris@6: var footerHeight = footer.outerHeight(); Chris@6: var windowHeight = $(window).height() - headerHeight - footerHeight; Chris@6: content.css({height:windowHeight + "px"}); Chris@6: navtree.css({height:windowHeight + "px"}); Chris@6: sidenav.css({height:windowHeight + "px"}); Chris@6: var width=$(window).width(); Chris@6: if (width!=collapsedWidth) { Chris@6: if (width=desktop_vp) { Chris@6: if (!collapsed) { Chris@6: collapseExpand(); Chris@6: } Chris@6: } else if (width>desktop_vp && collapsedWidth0) { Chris@6: restoreWidth(0); Chris@6: collapsed=true; Chris@6: } Chris@6: else { Chris@6: var width = readCookie('width'); Chris@6: if (width>200 && width<$(window).width()) { restoreWidth(width); } else { restoreWidth(200); } Chris@6: collapsed=false; Chris@6: } Chris@1: } Chris@1: Chris@1: header = $("#top"); Chris@1: sidenav = $("#side-nav"); Chris@1: content = $("#doc-content"); Chris@1: navtree = $("#nav-tree"); Chris@1: footer = $("#nav-path"); Chris@1: $(".side-nav-resizable").resizable({resize: function(e, ui) { resizeWidth(); } }); Chris@6: $(sidenav).resizable({ minWidth: 0 }); Chris@1: $(window).resize(function() { resizeHeight(); }); Chris@6: var device = navigator.userAgent.toLowerCase(); Chris@6: var touch_device = device.match(/(iphone|ipod|ipad|android)/); Chris@6: if (touch_device) { /* wider split bar for touch only devices */ Chris@6: $(sidenav).css({ paddingRight:'20px' }); Chris@6: $('.ui-resizable-e').css({ width:'20px' }); Chris@6: $('#nav-sync').css({ right:'34px' }); Chris@6: barWidth=20; Chris@6: } Chris@1: var width = readCookie('width'); Chris@1: if (width) { restoreWidth(width); } else { resizeWidth(); } Chris@1: resizeHeight(); Chris@1: var url = location.href; Chris@1: var i=url.indexOf("#"); Chris@1: if (i>=0) window.location.hash=url.substr(i); Chris@1: var _preventDefault = function(evt) { evt.preventDefault(); }; Chris@1: $("#splitbar").bind("dragstart", _preventDefault).bind("selectstart", _preventDefault); Chris@6: $(".ui-resizable-handle").dblclick(collapseExpand); Chris@6: $(window).load(resizeHeight); Chris@1: } Chris@1: Chris@1: