Skip to content

Commit bb427a5

Browse files
committed
add collapsing of the sidebar and ignore empty metadata and platform names
1 parent 5ed12c4 commit bb427a5

File tree

3 files changed

+160
-8
lines changed

3 files changed

+160
-8
lines changed

api-docs/cppdocs/Doxyfile-HTML

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -913,6 +913,8 @@ EXCLUDE_SYMBOLS = BinaryNinja::LowLevelILInstructionAccessor \
913913
BinaryNinja::MediumLevelILInstructionAccessor* \
914914
BinaryNinja::HighLevelILInstructionAccessor \
915915
BinaryNinja::HighLevelILInstructionAccessor* \
916+
metadata \
917+
platform
916918

917919

918920
#EXCLUDE_SYMBOLS = QProgressIndicator #Broke Exhale
@@ -1505,7 +1507,7 @@ ENUM_VALUES_PER_LINE = 4
15051507
# Minimum value: 0, maximum value: 1500, default value: 250.
15061508
# This tag requires that the tag GENERATE_HTML is set to YES.
15071509

1508-
TREEVIEW_WIDTH = 250
1510+
TREEVIEW_WIDTH = 400
15091511

15101512
# If the EXT_LINKS_IN_WINDOW option is set to YES, doxygen will open links to
15111513
# external symbols imported via tag files in a separate window.

api-docs/cppdocs/binaryninja-darkmode.js

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,3 +98,87 @@
9898
// Initialize on page load
9999
init();
100100
})();
101+
102+
/**
103+
* Sidebar Collapse Functionality
104+
*/
105+
(function() {
106+
'use strict';
107+
108+
const COOKIE_NAME = 'bn-docs-sidebar-collapsed';
109+
const COOKIE_DAYS = 365;
110+
111+
function getCookie(name) {
112+
const value = `; ${document.cookie}`;
113+
const parts = value.split(`; ${name}=`);
114+
if (parts.length === 2) return parts.pop().split(';').shift();
115+
return null;
116+
}
117+
118+
function setCookie(name, value, days) {
119+
const date = new Date();
120+
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
121+
const expires = `expires=${date.toUTCString()}`;
122+
document.cookie = `${name}=${value};${expires};path=/`;
123+
}
124+
125+
function toggleSidebar() {
126+
const sideNav = document.getElementById('side-nav');
127+
const docContent = document.getElementById('doc-content');
128+
const container = document.getElementById('container');
129+
const button = document.getElementById('sidebar-toggle');
130+
const top = document.getElementById('top');
131+
const titlearea = document.getElementById('titlearea');
132+
133+
if (!sideNav) return;
134+
135+
const isCollapsed = sideNav.classList.toggle('collapsed');
136+
if (docContent) docContent.classList.toggle('sidebar-collapsed', isCollapsed);
137+
if (container) container.classList.toggle('sidebar-collapsed', isCollapsed);
138+
if (top) top.classList.toggle('collapsed', isCollapsed);
139+
if (titlearea) titlearea.classList.toggle('collapsed', isCollapsed);
140+
if (button) button.textContent = isCollapsed ? '→' : '←';
141+
142+
setCookie(COOKIE_NAME, isCollapsed ? '1' : '0', COOKIE_DAYS);
143+
}
144+
145+
function init() {
146+
// Wait for DOM to be ready
147+
if (document.readyState === 'loading') {
148+
document.addEventListener('DOMContentLoaded', init);
149+
return;
150+
}
151+
152+
const sideNav = document.getElementById('side-nav');
153+
if (!sideNav) return;
154+
155+
// Create collapse button
156+
const button = document.createElement('button');
157+
button.id = 'sidebar-toggle';
158+
button.className = 'sidebar-toggle';
159+
button.textContent = '←';
160+
button.title = 'Toggle sidebar';
161+
button.addEventListener('click', toggleSidebar);
162+
163+
// Insert button at the beginning of side-nav
164+
sideNav.insertBefore(button, sideNav.firstChild);
165+
166+
// Restore collapsed state from cookie
167+
const isCollapsed = getCookie(COOKIE_NAME) === '1';
168+
if (isCollapsed) {
169+
sideNav.classList.add('collapsed');
170+
const docContent = document.getElementById('doc-content');
171+
const container = document.getElementById('container');
172+
const top = document.getElementById('top');
173+
const titlearea = document.getElementById('titlearea');
174+
if (docContent) docContent.classList.add('sidebar-collapsed');
175+
if (container) container.classList.add('sidebar-collapsed');
176+
if (top) top.classList.add('collapsed');
177+
if (titlearea) titlearea.classList.add('collapsed');
178+
button.textContent = '→';
179+
}
180+
}
181+
182+
window.bnToggleSidebar = toggleSidebar;
183+
init();
184+
})();

api-docs/cppdocs/binaryninja-docs.css

Lines changed: 73 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
--line-height-content: 27px;
6666

6767
/* Layout */
68-
--sidebar-width: 335px;
68+
--sidebar-width: 450px;
6969
--top-height: 120px;
7070
--content-maxwidth: 1050px;
7171
--spacing-small: 5px;
@@ -763,13 +763,13 @@ table.memberdecls .memItemLeft {
763763
white-space: normal;
764764
word-wrap: break-word;
765765
overflow-wrap: break-word;
766-
padding: var(--spacing-small) var(--spacing-medium);
766+
padding: 2px var(--spacing-small);
767767
border-bottom: 1px solid var(--border-color);
768768
width: 40%;
769769
}
770770

771771
table.memberdecls .memItemRight {
772-
padding: var(--spacing-small) var(--spacing-medium);
772+
padding: 2px var(--spacing-small);
773773
border-bottom: 1px solid var(--border-color);
774774
word-wrap: break-word;
775775
overflow-wrap: break-word;
@@ -848,7 +848,7 @@ table.memname {
848848
table.memname td {
849849
vertical-align: top;
850850
font-family: var(--font-family-monospace);
851-
padding: 0 10px 0 0;
851+
padding: 0 5px 0 0;
852852
}
853853

854854
/* Keep function name on first column from wrapping */
@@ -997,7 +997,7 @@ dl.bug {
997997
* MEMBER DOCUMENTATION
998998
* ============================================================================ */
999999
.memitem {
1000-
margin-bottom: var(--spacing-large);
1000+
margin-bottom: var(--spacing-medium);
10011001
position: relative;
10021002
}
10031003

@@ -1019,14 +1019,14 @@ dl.bug {
10191019
border: 1px solid var(--border-color);
10201020
border-top: none;
10211021
border-radius: 0 0 var(--border-radius-small) var(--border-radius-small);
1022-
padding: var(--spacing-medium);
1022+
padding: var(--spacing-small) var(--spacing-medium);
10231023
background-color: var(--page-bg);
10241024
}
10251025

10261026
.memproto {
10271027
background-color: var(--fragment-bg);
10281028
border: 1px solid var(--border-color);
1029-
padding: var(--spacing-small) var(--spacing-medium);
1029+
padding: 3px var(--spacing-small);
10301030
border-radius: var(--border-radius-small);
10311031
}
10321032

@@ -1230,3 +1230,69 @@ html.dark-mode .darkmode_inverted_image img,
12301230
html.dark-mode .darkmode_inverted_image object[type="image/svg+xml"] {
12311231
filter: brightness(89%) hue-rotate(180deg) invert();
12321232
}
1233+
1234+
/* ============================================================================
1235+
* SIDEBAR COLLAPSE
1236+
* ============================================================================ */
1237+
1238+
.sidebar-toggle {
1239+
position: absolute;
1240+
top: 10px;
1241+
right: 10px;
1242+
z-index: 1000;
1243+
width: 30px;
1244+
height: 30px;
1245+
border: 1px solid var(--border-color);
1246+
background-color: var(--page-bg);
1247+
color: var(--page-text);
1248+
cursor: pointer;
1249+
font-size: 18px;
1250+
font-weight: bold;
1251+
border-radius: 3px;
1252+
display: flex;
1253+
align-items: center;
1254+
justify-content: center;
1255+
transition: all 0.2s ease;
1256+
}
1257+
1258+
.sidebar-toggle:hover {
1259+
background-color: var(--table-header-bg);
1260+
border-color: var(--link-color);
1261+
}
1262+
1263+
/* Collapsed sidebar state */
1264+
#side-nav.collapsed {
1265+
width: 0 !important;
1266+
min-width: 0 !important;
1267+
max-width: 0 !important;
1268+
overflow: visible;
1269+
}
1270+
1271+
#side-nav.collapsed .sidebar-toggle {
1272+
left: 10px;
1273+
right: auto;
1274+
}
1275+
1276+
/* Hide header/top when collapsed */
1277+
#top.collapsed,
1278+
#titlearea.collapsed {
1279+
display: none !important;
1280+
}
1281+
1282+
#doc-content.sidebar-collapsed,
1283+
#container.sidebar-collapsed {
1284+
margin-left: 0 !important;
1285+
}
1286+
1287+
#doc-content.sidebar-collapsed {
1288+
width: 100% !important;
1289+
}
1290+
1291+
.ui-resizable-handle {
1292+
transition: left 0.3s ease;
1293+
}
1294+
1295+
#side-nav.collapsed ~ #splitbar {
1296+
left: 0 !important;
1297+
display: none;
1298+
}

0 commit comments

Comments
 (0)