annotate trunk/C++/api/html/resize.js @ 612:b8a27b613867

Added AGC::designAGC() This new method is not debugged ... that is the next step.
author flatmax
date Tue, 02 Apr 2013 08:38:23 +0000
parents 359bcd461dd1
children
rev   line source
flatmax@597 1 var cookie_namespace = 'doxygen';
flatmax@597 2 var sidenav,navtree,content,header;
flatmax@597 3
flatmax@597 4 function readCookie(cookie)
flatmax@597 5 {
flatmax@597 6 var myCookie = cookie_namespace+"_"+cookie+"=";
flatmax@597 7 if (document.cookie)
flatmax@597 8 {
flatmax@597 9 var index = document.cookie.indexOf(myCookie);
flatmax@597 10 if (index != -1)
flatmax@597 11 {
flatmax@597 12 var valStart = index + myCookie.length;
flatmax@597 13 var valEnd = document.cookie.indexOf(";", valStart);
flatmax@597 14 if (valEnd == -1)
flatmax@597 15 {
flatmax@597 16 valEnd = document.cookie.length;
flatmax@597 17 }
flatmax@597 18 var val = document.cookie.substring(valStart, valEnd);
flatmax@597 19 return val;
flatmax@597 20 }
flatmax@597 21 }
flatmax@597 22 return 0;
flatmax@597 23 }
flatmax@597 24
flatmax@597 25 function writeCookie(cookie, val, expiration)
flatmax@597 26 {
flatmax@597 27 if (val==undefined) return;
flatmax@597 28 if (expiration == null)
flatmax@597 29 {
flatmax@597 30 var date = new Date();
flatmax@597 31 date.setTime(date.getTime()+(10*365*24*60*60*1000)); // default expiration is one week
flatmax@597 32 expiration = date.toGMTString();
flatmax@597 33 }
flatmax@597 34 document.cookie = cookie_namespace + "_" + cookie + "=" + val + "; expires=" + expiration+"; path=/";
flatmax@597 35 }
flatmax@597 36
flatmax@597 37 function resizeWidth()
flatmax@597 38 {
flatmax@597 39 var windowWidth = $(window).width() + "px";
flatmax@597 40 var sidenavWidth = $(sidenav).width();
flatmax@597 41 content.css({marginLeft:parseInt(sidenavWidth)+6+"px"}); //account for 6px-wide handle-bar
flatmax@597 42 writeCookie('width',sidenavWidth, null);
flatmax@597 43 }
flatmax@597 44
flatmax@597 45 function restoreWidth(navWidth)
flatmax@597 46 {
flatmax@597 47 var windowWidth = $(window).width() + "px";
flatmax@597 48 content.css({marginLeft:parseInt(navWidth)+6+"px"});
flatmax@597 49 sidenav.css({width:navWidth + "px"});
flatmax@597 50 }
flatmax@597 51
flatmax@597 52 function resizeHeight()
flatmax@597 53 {
flatmax@597 54 var headerHeight = header.height();
flatmax@597 55 var footerHeight = footer.height();
flatmax@597 56 var windowHeight = $(window).height() - headerHeight - footerHeight;
flatmax@597 57 content.css({height:windowHeight + "px"});
flatmax@597 58 navtree.css({height:windowHeight + "px"});
flatmax@597 59 sidenav.css({height:windowHeight + "px",top: headerHeight+"px"});
flatmax@597 60 }
flatmax@597 61
flatmax@597 62 function initResizable()
flatmax@597 63 {
flatmax@597 64 header = $("#top");
flatmax@597 65 sidenav = $("#side-nav");
flatmax@597 66 content = $("#doc-content");
flatmax@597 67 navtree = $("#nav-tree");
flatmax@597 68 footer = $("#nav-path");
flatmax@597 69 $(".side-nav-resizable").resizable({resize: function(e, ui) { resizeWidth(); } });
flatmax@597 70 $(window).resize(function() { resizeHeight(); });
flatmax@597 71 var width = readCookie('width');
flatmax@597 72 if (width) { restoreWidth(width); } else { resizeWidth(); }
flatmax@597 73 resizeHeight();
flatmax@597 74 var url = location.href;
flatmax@597 75 var i=url.indexOf("#");
flatmax@597 76 if (i>=0) window.location.hash=url.substr(i);
flatmax@597 77 var _preventDefault = function(evt) { evt.preventDefault(); };
flatmax@597 78 $("#splitbar").bind("dragstart", _preventDefault).bind("selectstart", _preventDefault);
flatmax@597 79 }
flatmax@597 80
flatmax@597 81