annotate code-docs/resize.js @ 3:5c2683745b33 vamp-plugin-sdk-v2.4

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