gbdk-2020 | GameBoy Development Kit |
| download: https://git.y1.nz/archives/gbdk.tar.gz | |
| README | Files | Log | Refs | LICENSE |
docs/api/resize.js
1 /*
2 @licstart The following is the entire license notice for the JavaScript code in this file.
3
4 The MIT License (MIT)
5
6 Copyright (C) 1997-2020 by Dimitri van Heesch
7
8 Permission is hereby granted, free of charge, to any person obtaining a copy of this software
9 and associated documentation files (the "Software"), to deal in the Software without restriction,
10 including without limitation the rights to use, copy, modify, merge, publish, distribute,
11 sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
12 furnished to do so, subject to the following conditions:
13
14 The above copyright notice and this permission notice shall be included in all copies or
15 substantial portions of the Software.
16
17 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
18 BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
20 DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
23 @licend The above is the entire license notice for the JavaScript code in this file
24 */
25 function initResizable()
26 {
27 var cookie_namespace = 'doxygen';
28 var sidenav,navtree,content,header,collapsed,collapsedWidth=0,barWidth=6,desktop_vp=768,titleHeight;
29
30 function readCookie(cookie)
31 {
32 var myCookie = cookie_namespace+"_"+cookie+"=";
33 if (document.cookie) {
34 var index = document.cookie.indexOf(myCookie);
35 if (index != -1) {
36 var valStart = index + myCookie.length;
37 var valEnd = document.cookie.indexOf(";", valStart);
38 if (valEnd == -1) {
39 valEnd = document.cookie.length;
40 }
41 var val = document.cookie.substring(valStart, valEnd);
42 return val;
43 }
44 }
45 return 0;
46 }
47
48 function writeCookie(cookie, val, expiration)
49 {
50 if (val==undefined) return;
51 if (expiration == null) {
52 var date = new Date();
53 date.setTime(date.getTime()+(10*365*24*60*60*1000)); // default expiration is one week
54 expiration = date.toGMTString();
55 }
56 document.cookie = cookie_namespace + "_" + cookie + "=" + val + "; SameSite=Lax; expires=" + expiration+"; path=/";
57 }
58
59 function resizeWidth()
60 {
61 var windowWidth = $(window).width() + "px";
62 var sidenavWidth = $(sidenav).outerWidth();
63 content.css({marginLeft:parseInt(sidenavWidth)+"px"});
64 writeCookie('width',sidenavWidth-barWidth, null);
65 }
66
67 function restoreWidth(navWidth)
68 {
69 var windowWidth = $(window).width() + "px";
70 content.css({marginLeft:parseInt(navWidth)+barWidth+"px"});
71 sidenav.css({width:navWidth + "px"});
72 }
73
74 function resizeHeight()
75 {
76 var headerHeight = header.outerHeight();
77 var footerHeight = footer.outerHeight();
78 var windowHeight = $(window).height();
79 var contentHeight,navtreeHeight,sideNavHeight;
80 if (typeof page_layout==='undefined' || page_layout==0) { /* DISABLE_INDEX=NO */
81 contentHeight = windowHeight - headerHeight - footerHeight;
82 navtreeHeight = contentHeight;
83 sideNavHeight = contentHeight;
84 } else if (page_layout==1) { /* DISABLE_INDEX=YES */
85 contentHeight = windowHeight - footerHeight;
86 navtreeHeight = windowHeight - headerHeight;
87 sideNavHeight = windowHeight;
88 }
89 content.css({height:contentHeight + "px"});
90 navtree.css({height:navtreeHeight + "px"});
91 sidenav.css({height:sideNavHeight + "px"});
92 var width=$(window).width();
93 if (width!=collapsedWidth) {
94 if (width<desktop_vp && collapsedWidth>=desktop_vp) {
95 if (!collapsed) {
96 collapseExpand();
97 }
98 } else if (width>desktop_vp && collapsedWidth<desktop_vp) {
99 if (collapsed) {
100 collapseExpand();
101 }
102 }
103 collapsedWidth=width;
104 }
105 if (location.hash.slice(1)) {
106 (document.getElementById(location.hash.slice(1))||document.body).scrollIntoView();
107 }
108 }
109
110 function collapseExpand()
111 {
112 if (sidenav.width()>0) {
113 restoreWidth(0);
114 collapsed=true;
115 }
116 else {
117 var width = readCookie('width');
118 if (width>200 && width<$(window).width()) { restoreWidth(width); } else { restoreWidth(200); }
119 collapsed=false;
120 }
121 }
122
123 header = $("#top");
124 sidenav = $("#side-nav");
125 content = $("#doc-content");
126 navtree = $("#nav-tree");
127 footer = $("#nav-path");
128 $(".side-nav-resizable").resizable({resize: function(e, ui) { resizeWidth(); } });
129 $(sidenav).resizable({ minWidth: 0 });
130 $(window).resize(function() { resizeHeight(); });
131 var device = navigator.userAgent.toLowerCase();
132 var touch_device = device.match(/(iphone|ipod|ipad|android)/);
133 if (touch_device) { /* wider split bar for touch only devices */
134 $(sidenav).css({ paddingRight:'20px' });
135 $('.ui-resizable-e').css({ width:'20px' });
136 $('#nav-sync').css({ right:'34px' });
137 barWidth=20;
138 }
139 var width = readCookie('width');
140 if (width) { restoreWidth(width); } else { resizeWidth(); }
141 resizeHeight();
142 var url = location.href;
143 var i=url.indexOf("#");
144 if (i>=0) window.location.hash=url.substr(i);
145 var _preventDefault = function(evt) { evt.preventDefault(); };
146 $("#splitbar").bind("dragstart", _preventDefault).bind("selectstart", _preventDefault);
147 $(".ui-resizable-handle").dblclick(collapseExpand);
148 $(window).on('load',resizeHeight);
149 }
150 /* @license-end */
This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.