Files
clang-p2996/clang-tools-extra/clang-doc/assets/mustache-index.js
Paul Kirth 22d10f0a50 [clang-doc] Add Mustache template assets (#138059)
This patch adds the various assets used with the HTML Mustache backend.
This includes templates for a variety of different language constructs,
as well as the CSS. Split from #133161.

Co-authored-by: Peter Chou <peter.chou@mail.utoronto.ca>
2025-05-06 20:31:54 -07:00

31 lines
959 B
JavaScript

document.addEventListener("DOMContentLoaded", function() {
const resizer = document.getElementById('resizer');
const sidebar = document.querySelector('.sidebar');
let isResizing = false;
resizer.addEventListener('mousedown', (e) => { isResizing = true; });
document.addEventListener('mousemove', (e) => {
if (!isResizing)
return;
const newWidth = e.clientX;
if (newWidth > 100 && newWidth < window.innerWidth - 100) {
sidebar.style.width = `${newWidth}px`;
}
});
document.addEventListener('mouseup', () => { isResizing = false; });
document.querySelectorAll('pre code').forEach((el) => {
hljs.highlightElement(el);
el.classList.remove("hljs");
});
document.querySelectorAll('.sidebar-item-container').forEach(item => {
item.addEventListener('click', function() {
const anchor = item.getElementsByTagName("a");
window.location.hash = anchor[0].getAttribute('href');
});
});
})