brintos

brintos / llvm-project-archived public Read only

0
0
Text · 959 B · 0f05eb7 Raw
31 lines · javascript
1document.addEventListener("DOMContentLoaded", function() {2  const resizer = document.getElementById('resizer');3  const sidebar = document.querySelector('.sidebar');4 5  let isResizing = false;6  resizer.addEventListener('mousedown', (e) => { isResizing = true; });7 8  document.addEventListener('mousemove', (e) => {9    if (!isResizing)10      return;11    const newWidth = e.clientX;12    if (newWidth > 100 && newWidth < window.innerWidth - 100) {13      sidebar.style.width = `${newWidth}px`;14    }15  });16 17  document.addEventListener('mouseup', () => { isResizing = false; });18 19  document.querySelectorAll('pre code').forEach((el) => {20    hljs.highlightElement(el);21    el.classList.remove("hljs");22  });23 24  document.querySelectorAll('.sidebar-item-container').forEach(item => {25    item.addEventListener('click', function() {26      const anchor = item.getElementsByTagName("a");27      window.location.hash = anchor[0].getAttribute('href');28    });29  });30})31