cpython/Lib/profiling/sampling/_heatmap_assets/heatmap_index.js
Hugo van Kemenade 5b5263648f
Some checks are pending
Tests / Check if Autoconf files are up to date (push) Blocked by required conditions
Tests / Windows MSI (push) Blocked by required conditions
Tests / (push) Blocked by required conditions
Tests / Change detection (push) Waiting to run
Tests / Docs (push) Blocked by required conditions
Tests / Check if generated files are up to date (push) Blocked by required conditions
Tests / Ubuntu SSL tests with OpenSSL (push) Blocked by required conditions
Tests / Ubuntu SSL tests with AWS-LC (push) Blocked by required conditions
Tests / Android (aarch64) (push) Blocked by required conditions
Tests / Android (x86_64) (push) Blocked by required conditions
Tests / iOS (push) Blocked by required conditions
Tests / WASI (push) Blocked by required conditions
Tests / Hypothesis tests on Ubuntu (push) Blocked by required conditions
Tests / Address sanitizer (push) Blocked by required conditions
Tests / Sanitizers (push) Blocked by required conditions
Tests / Cross build Linux (push) Blocked by required conditions
Tests / CIFuzz (push) Blocked by required conditions
Tests / All required checks pass (push) Blocked by required conditions
Lint / lint (push) Waiting to run
mypy / Run mypy on Lib/_pyrepl (push) Waiting to run
mypy / Run mypy on Lib/test/libregrtest (push) Waiting to run
mypy / Run mypy on Lib/tomllib (push) Waiting to run
mypy / Run mypy on Tools/build (push) Waiting to run
mypy / Run mypy on Tools/cases_generator (push) Waiting to run
mypy / Run mypy on Tools/check-c-api-docs (push) Waiting to run
mypy / Run mypy on Tools/clinic (push) Waiting to run
mypy / Run mypy on Tools/jit (push) Waiting to run
mypy / Run mypy on Tools/peg_generator (push) Waiting to run
gh-142927: Tachyon: Start with user's default light/dark theme (#142987)
2025-12-20 02:36:09 +01:00

104 lines
3.6 KiB
JavaScript

// Tachyon Profiler - Heatmap Index JavaScript
// Index page specific functionality
// ============================================================================
// Heatmap Bar Coloring
// ============================================================================
function applyHeatmapBarColors() {
const bars = document.querySelectorAll('.heatmap-bar[data-intensity]');
bars.forEach(bar => {
const intensity = parseFloat(bar.getAttribute('data-intensity')) || 0;
const color = intensityToColor(intensity);
bar.style.backgroundColor = color;
});
}
// ============================================================================
// Theme Support
// ============================================================================
function toggleTheme() {
toggleAndSaveTheme();
applyHeatmapBarColors();
}
// ============================================================================
// Type Section Toggle (stdlib, project, etc)
// ============================================================================
function toggleTypeSection(header) {
const section = header.parentElement;
const content = section.querySelector('.type-content');
const icon = header.querySelector('.type-icon');
if (content.style.display === 'none') {
content.style.display = 'block';
icon.textContent = '\u25BC';
} else {
content.style.display = 'none';
icon.textContent = '\u25B6';
}
}
// ============================================================================
// Folder Toggle
// ============================================================================
function toggleFolder(header) {
const folder = header.parentElement;
const content = folder.querySelector('.folder-content');
const icon = header.querySelector('.folder-icon');
if (content.style.display === 'none') {
content.style.display = 'block';
icon.textContent = '\u25BC';
folder.classList.remove('collapsed');
} else {
content.style.display = 'none';
icon.textContent = '\u25B6';
folder.classList.add('collapsed');
}
}
// ============================================================================
// Expand/Collapse All
// ============================================================================
function expandAll() {
// Expand all type sections
document.querySelectorAll('.type-section').forEach(section => {
const content = section.querySelector('.type-content');
const icon = section.querySelector('.type-icon');
content.style.display = 'block';
icon.textContent = '\u25BC';
});
// Expand all folders
document.querySelectorAll('.folder-node').forEach(folder => {
const content = folder.querySelector('.folder-content');
const icon = folder.querySelector('.folder-icon');
content.style.display = 'block';
icon.textContent = '\u25BC';
folder.classList.remove('collapsed');
});
}
function collapseAll() {
document.querySelectorAll('.folder-node').forEach(folder => {
const content = folder.querySelector('.folder-content');
const icon = folder.querySelector('.folder-icon');
content.style.display = 'none';
icon.textContent = '\u25B6';
folder.classList.add('collapsed');
});
}
// ============================================================================
// Initialization
// ============================================================================
document.addEventListener('DOMContentLoaded', function() {
restoreUIState();
applyHeatmapBarColors();
});