Node.js based forum software built for the modern web
feat: client-side hooks for navigator scroll action
Julian Lam135fe55bed88
diff --git a/public/src/modules/navigator.js b/public/src/modules/navigator.jsindex 0b55e8ee4b..3d3e904c7f 100644--- a/public/src/modules/navigator.js+++ b/public/src/modules/navigator.js@@ -561,12 +561,14 @@ define('navigator', ['forum/pagination', 'components', 'hooks', 'alerts'], functnavigator.scrollToElement(scrollTo, highlight, duration, topicIndex);};- navigator.scrollToElement = function (scrollTo, highlight, duration, newIndex = null) {+ navigator.scrollToElement = async (scrollTo, highlight, duration, newIndex = null) => {if (!scrollTo.length) {navigator.scrollActive = false;return;}+ await hooks.fire('filter:navigator.scroll', { scrollTo, highlight, duration, newIndex });+const postHeight = scrollTo.outerHeight(true);const navbarHeight = components.get('navbar').outerHeight(true);const topicHeaderHeight = $('.topic-header').outerHeight(true) || 0;@@ -584,6 +586,8 @@ define('navigator', ['forum/pagination', 'components', 'hooks', 'alerts'], funct// Re-enable onScroll behavioursetTimeout(() => { // fixes race condition from jQuery — onAnimateComplete called too quickly$(window).on('scroll', navigator.delayedUpdate);++ hooks.fire('action:navigator.scrolled', { scrollTo, highlight, duration, newIndex });}, 50);}function onAnimateComplete() {