cannam@50: var cookie_namespace = 'doxygen'; cannam@50: var sidenav,navtree,content,header; cannam@50: cannam@50: function readCookie(cookie) cannam@50: { cannam@50: var myCookie = cookie_namespace+"_"+cookie+"="; cannam@50: if (document.cookie) cannam@50: { cannam@50: var index = document.cookie.indexOf(myCookie); cannam@50: if (index != -1) cannam@50: { cannam@50: var valStart = index + myCookie.length; cannam@50: var valEnd = document.cookie.indexOf(";", valStart); cannam@50: if (valEnd == -1) cannam@50: { cannam@50: valEnd = document.cookie.length; cannam@50: } cannam@50: var val = document.cookie.substring(valStart, valEnd); cannam@50: return val; cannam@50: } cannam@50: } cannam@50: return 0; cannam@50: } cannam@50: cannam@50: function writeCookie(cookie, val, expiration) cannam@50: { cannam@50: if (val==undefined) return; cannam@50: if (expiration == null) cannam@50: { cannam@50: var date = new Date(); cannam@50: date.setTime(date.getTime()+(10*365*24*60*60*1000)); // default expiration is one week cannam@50: expiration = date.toGMTString(); cannam@50: } cannam@50: document.cookie = cookie_namespace + "_" + cookie + "=" + val + "; expires=" + expiration+"; path=/"; cannam@50: } cannam@50: cannam@50: function resizeWidth() cannam@50: { cannam@50: var windowWidth = $(window).width() + "px"; cannam@50: var sidenavWidth = $(sidenav).width(); cannam@50: content.css({marginLeft:parseInt(sidenavWidth)+6+"px"}); //account for 6px-wide handle-bar cannam@50: writeCookie('width',sidenavWidth, null); cannam@50: } cannam@50: cannam@50: function restoreWidth(navWidth) cannam@50: { cannam@50: var windowWidth = $(window).width() + "px"; cannam@50: content.css({marginLeft:parseInt(navWidth)+6+"px"}); cannam@50: sidenav.css({width:navWidth + "px"}); cannam@50: } cannam@50: cannam@50: function resizeHeight() cannam@50: { cannam@50: var headerHeight = header.height(); cannam@50: var footerHeight = footer.height(); cannam@50: var windowHeight = $(window).height() - headerHeight - footerHeight; cannam@50: content.css({height:windowHeight + "px"}); cannam@50: navtree.css({height:windowHeight + "px"}); cannam@50: sidenav.css({height:windowHeight + "px",top: headerHeight+"px"}); cannam@50: } cannam@50: cannam@50: function initResizable() cannam@50: { cannam@50: header = $("#top"); cannam@50: sidenav = $("#side-nav"); cannam@50: content = $("#doc-content"); cannam@50: navtree = $("#nav-tree"); cannam@50: footer = $("#nav-path"); cannam@50: $(".side-nav-resizable").resizable({resize: function(e, ui) { resizeWidth(); } }); cannam@50: $(window).resize(function() { resizeHeight(); }); cannam@50: var width = readCookie('width'); cannam@50: if (width) { restoreWidth(width); } else { resizeWidth(); } cannam@50: resizeHeight(); cannam@50: var url = location.href; cannam@50: var i=url.indexOf("#"); cannam@50: if (i>=0) window.location.hash=url.substr(i); cannam@50: var _preventDefault = function(evt) { evt.preventDefault(); }; cannam@50: $("#splitbar").bind("dragstart", _preventDefault).bind("selectstart", _preventDefault); cannam@50: } cannam@50: cannam@50: