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