1
0
mirror of synced 2025-12-22 19:34:15 -05:00
Files
docs/javascripts/release-notes.js
Mike Surowiec a88e99c83a Reactify: release notes (#19799)
* reactify release-notes pages

* update GHAE/ES react release notes to not rely on javascripts/release-notes.js
2021-06-09 20:44:32 +00:00

20 lines
616 B
JavaScript

export default function releaseNotes () {
if (window.next) return
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)
})
}