annotate C++/api/html/resize.js @ 610:01986636257a

Second check-in of Alex Brandmeyer's C++ implementation of CARFAC. Addressed style issues and completed implementation of remaining functions. Still needs proper testing of the output stages against the MATLAB version, and runtime functions need improvements in efficiency.
author alexbrandmeyer
date Thu, 16 May 2013 17:33:23 +0000
parents 76c6b3fd0a05
children
rev   line source
flatmax@592 1 var cookie_namespace = 'doxygen';
flatmax@592 2 var sidenav,navtree,content,header;
flatmax@592 3
flatmax@592 4 function readCookie(cookie)
flatmax@592 5 {
flatmax@592 6 var myCookie = cookie_namespace+"_"+cookie+"=";
flatmax@592 7 if (document.cookie)
flatmax@592 8 {
flatmax@592 9 var index = document.cookie.indexOf(myCookie);
flatmax@592 10 if (index != -1)
flatmax@592 11 {
flatmax@592 12 var valStart = index + myCookie.length;
flatmax@592 13 var valEnd = document.cookie.indexOf(";", valStart);
flatmax@592 14 if (valEnd == -1)
flatmax@592 15 {
flatmax@592 16 valEnd = document.cookie.length;
flatmax@592 17 }
flatmax@592 18 var val = document.cookie.substring(valStart, valEnd);
flatmax@592 19 return val;
flatmax@592 20 }
flatmax@592 21 }
flatmax@592 22 return 0;
flatmax@592 23 }
flatmax@592 24
flatmax@592 25 function writeCookie(cookie, val, expiration)
flatmax@592 26 {
flatmax@592 27 if (val==undefined) return;
flatmax@592 28 if (expiration == null)
flatmax@592 29 {
flatmax@592 30 var date = new Date();
flatmax@592 31 date.setTime(date.getTime()+(10*365*24*60*60*1000)); // default expiration is one week
flatmax@592 32 expiration = date.toGMTString();
flatmax@592 33 }
flatmax@592 34 document.cookie = cookie_namespace + "_" + cookie + "=" + val + "; expires=" + expiration+"; path=/";
flatmax@592 35 }
flatmax@592 36
flatmax@592 37 function resizeWidth()
flatmax@592 38 {
flatmax@592 39 var windowWidth = $(window).width() + "px";
flatmax@592 40 var sidenavWidth = $(sidenav).width();
flatmax@592 41 content.css({marginLeft:parseInt(sidenavWidth)+6+"px"}); //account for 6px-wide handle-bar
flatmax@592 42 writeCookie('width',sidenavWidth, null);
flatmax@592 43 }
flatmax@592 44
flatmax@592 45 function restoreWidth(navWidth)
flatmax@592 46 {
flatmax@592 47 var windowWidth = $(window).width() + "px";
flatmax@592 48 content.css({marginLeft:parseInt(navWidth)+6+"px"});
flatmax@592 49 sidenav.css({width:navWidth + "px"});
flatmax@592 50 }
flatmax@592 51
flatmax@592 52 function resizeHeight()
flatmax@592 53 {
flatmax@592 54 var headerHeight = header.height();
flatmax@592 55 var footerHeight = footer.height();
flatmax@592 56 var windowHeight = $(window).height() - headerHeight - footerHeight;
flatmax@592 57 content.css({height:windowHeight + "px"});
flatmax@592 58 navtree.css({height:windowHeight + "px"});
flatmax@592 59 sidenav.css({height:windowHeight + "px",top: headerHeight+"px"});
flatmax@592 60 }
flatmax@592 61
flatmax@592 62 function initResizable()
flatmax@592 63 {
flatmax@592 64 header = $("#top");
flatmax@592 65 sidenav = $("#side-nav");
flatmax@592 66 content = $("#doc-content");
flatmax@592 67 navtree = $("#nav-tree");
flatmax@592 68 footer = $("#nav-path");
flatmax@592 69 $(".side-nav-resizable").resizable({resize: function(e, ui) { resizeWidth(); } });
flatmax@592 70 $(window).resize(function() { resizeHeight(); });
flatmax@592 71 var width = readCookie('width');
flatmax@592 72 if (width) { restoreWidth(width); } else { resizeWidth(); }
flatmax@592 73 resizeHeight();
flatmax@592 74 var url = location.href;
flatmax@592 75 var i=url.indexOf("#");
flatmax@592 76 if (i>=0) window.location.hash=url.substr(i);
flatmax@592 77 var _preventDefault = function(evt) { evt.preventDefault(); };
flatmax@592 78 $("#splitbar").bind("dragstart", _preventDefault).bind("selectstart", _preventDefault);
flatmax@592 79 }
flatmax@592 80
flatmax@592 81