-
-
- Most recent
- Score
-
+
+
Sort by
+
+ Most recent
+ Score
+
@@ -471,7 +472,7 @@
-
+
@@ -1793,7 +1794,8 @@
}
}
- function toggleOptionsPanel() {
+ let currentOptionsPanel = ''
+ function toggleOptionsPanel(type) {
const animInOptions = {
duration: 200,
fill: 'forwards',
@@ -1815,7 +1817,7 @@
transform: 'translateY(0)'
}
], animInOptions)
- } else {
+ } else if (currentOptionsPanel === type) {
getRef('options_panel').animate(slideOutUp, animOutOptions)
.onfinish = () => {
getRef('options_panel').classList.add('hide-completely')
@@ -1828,17 +1830,18 @@
}
], animOutOptions).onfinish = e => e.target.cancel()
}
+ currentOptionsPanel = type
}
function toggleFilterPanel() {
getRef('filter_panel').classList.remove('hide-completely')
getRef('article_outline_panel').classList.add('hide-completely')
- toggleOptionsPanel()
+ toggleOptionsPanel('filter')
}
function toggleOutlinePanel() {
getRef('filter_panel').classList.add('hide-completely')
getRef('article_outline_panel').classList.remove('hide-completely')
- toggleOptionsPanel()
+ toggleOptionsPanel('outline')
}
getRef('article_outline').addEventListener('click', e => {
if (e.target.closest('.outline-button')) {
@@ -1850,15 +1853,15 @@
})
}
})
- function activeHeading(target) {
+ const activeHeading = debounce((target) => {
[...getRef('article_outline').children].forEach(elem => elem.classList.remove('outline-button--active'))
target.classList.add('outline-button--active')
target.scrollIntoView({ behavior: "smooth", block: "end", inline: "center" });
getRef('options_panel').scrollTo({
behavior: 'smooth',
- left: target.getBoundingClientRect().left - getRef('options_panel').getBoundingClientRect().left + getRef('options_panel').scrollLeft
+ left: target.getBoundingClientRect().left - getRef('options_panel').getBoundingClientRect().left + getRef('options_panel').scrollLeft - ((getRef('options_panel').getBoundingClientRect().width / 2) - target.getBoundingClientRect().width / 2)
})
- }
+ }, 150)
const headingIntersectionObserver = new IntersectionObserver(entries => {
entries.forEach(entry => {