Chris@1: var cookie_namespace = 'doxygen'; Chris@1: var sidenav,navtree,content,header; Chris@1: Chris@1: function readCookie(cookie) Chris@1: { Chris@1: var myCookie = cookie_namespace+"_"+cookie+"="; Chris@1: if (document.cookie) Chris@1: { Chris@1: var index = document.cookie.indexOf(myCookie); Chris@1: if (index != -1) Chris@1: { Chris@1: var valStart = index + myCookie.length; Chris@1: var valEnd = document.cookie.indexOf(";", valStart); Chris@1: if (valEnd == -1) Chris@1: { Chris@1: valEnd = document.cookie.length; Chris@1: } Chris@1: var val = document.cookie.substring(valStart, valEnd); Chris@1: return val; Chris@1: } Chris@1: } Chris@1: return 0; Chris@1: } Chris@1: Chris@1: function writeCookie(cookie, val, expiration) Chris@1: { Chris@1: if (val==undefined) return; Chris@1: if (expiration == null) Chris@1: { Chris@1: var date = new Date(); Chris@1: date.setTime(date.getTime()+(10*365*24*60*60*1000)); // default expiration is one week Chris@1: expiration = date.toGMTString(); Chris@1: } Chris@1: document.cookie = cookie_namespace + "_" + cookie + "=" + val + "; expires=" + expiration+"; path=/"; Chris@1: } Chris@1: Chris@1: function resizeWidth() Chris@1: { Chris@1: var windowWidth = $(window).width() + "px"; Chris@1: var sidenavWidth = $(sidenav).width(); Chris@1: content.css({marginLeft:parseInt(sidenavWidth)+6+"px"}); //account for 6px-wide handle-bar Chris@1: writeCookie('width',sidenavWidth, null); Chris@1: } Chris@1: Chris@1: function restoreWidth(navWidth) Chris@1: { Chris@1: var windowWidth = $(window).width() + "px"; Chris@1: content.css({marginLeft:parseInt(navWidth)+6+"px"}); Chris@1: sidenav.css({width:navWidth + "px"}); Chris@1: } Chris@1: Chris@1: function resizeHeight() Chris@1: { Chris@1: var headerHeight = header.height(); Chris@1: var footerHeight = footer.height(); Chris@1: var windowHeight = $(window).height() - headerHeight - footerHeight; Chris@1: content.css({height:windowHeight + "px"}); Chris@1: navtree.css({height:windowHeight + "px"}); Chris@1: sidenav.css({height:windowHeight + "px",top: headerHeight+"px"}); Chris@1: } Chris@1: Chris@1: function initResizable() 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@1: $(window).resize(function() { resizeHeight(); }); 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@1: } Chris@1: Chris@1: