1
0
mirror of synced 2025-12-19 18:10:59 -05:00
Files
docs/javascripts/release-notes.js

19 lines
590 B
JavaScript

export default function releaseNotes () {
const patches = Array.from(document.querySelectorAll('.js-release-notes-patch'))
if (patches.length === 0) return
const observer = new IntersectionObserver((entries) => {
for (const entry of entries) {
const { version } = entry.target.dataset
const patchLink = document.querySelector(`.js-release-notes-patch-link[data-version="${version}"]`)
patchLink.classList.toggle('selected', entry.isIntersecting)
}
}, {
rootMargin: '-40% 0px -50%'
})
patches.forEach(patch => {
observer.observe(patch)
})
}