MCPcopy Index your code
hub / github.com/python/cpython / toggleSidebar

Function toggleSidebar

Lib/profiling/sampling/_flamegraph_assets/flamegraph.js:124–150  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

122}
123
124function toggleSidebar() {
125 const sidebar = document.getElementById('sidebar');
126 if (sidebar) {
127 const isCollapsing = !sidebar.classList.contains('collapsed');
128
129 if (isCollapsing) {
130 // Save current width before collapsing
131 const currentWidth = sidebar.offsetWidth;
132 sidebar.dataset.expandedWidth = currentWidth;
133 localStorage.setItem('flamegraph-sidebar-width', currentWidth);
134 } else {
135 // Restore width when expanding
136 const savedWidth = sidebar.dataset.expandedWidth || localStorage.getItem('flamegraph-sidebar-width');
137 if (savedWidth) {
138 sidebar.style.width = savedWidth + 'px';
139 }
140 }
141
142 sidebar.classList.toggle('collapsed');
143 localStorage.setItem('flamegraph-sidebar', sidebar.classList.contains('collapsed') ? 'collapsed' : 'expanded');
144
145 // Resize chart after sidebar animation
146 setTimeout(() => {
147 resizeChart();
148 }, 300);
149 }
150}
151
152function resizeChart() {
153 if (window.flamegraphChart && window.flamegraphData) {

Callers

nothing calls this directly

Calls 4

resizeChartFunction · 0.85
getElementByIdMethod · 0.80
containsMethod · 0.45
toggleMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…