fix: use app flag for at-a-glance active state instead of exported method

This commit is contained in:
Julian Lam
2022-12-07 15:11:23 -05:00
parent 8a83690596
commit e3dd1d62d9
2 changed files with 3 additions and 7 deletions

View File

@@ -8,11 +8,6 @@ define('forum/infinitescroll', ['hooks', 'alerts'], function (hooks, alerts) {
let loadingMore = false;
let container;
let scrollTimeout = 0;
let glance;
require(['forum/topic/glance'], (_glance) => {
glance = _glance;
});
scroll.init = function (el, cb) {
const $body = $('body');
@@ -44,8 +39,7 @@ define('forum/infinitescroll', ['hooks', 'alerts'], function (hooks, alerts) {
function onScroll() {
const bsEnv = utils.findBootstrapEnvironment();
const mobileComposerOpen = (bsEnv === 'xs' || bsEnv === 'sm') && $('html').hasClass('composing');
const glanceActive = glance.isActive();
if (loadingMore || mobileComposerOpen || glanceActive) {
if (loadingMore || mobileComposerOpen || app.flags._glance) {
return;
}
const currentScrollTop = $(window).scrollTop();

View File

@@ -112,6 +112,7 @@ function toggle(state) {
topicEl.classList[state ? 'add' : 'remove']('minimal');
if (state) {
app.flags._glance = true;
generatePlaceholders();
registerScrollEvent();
} else {
@@ -119,6 +120,7 @@ function toggle(state) {
deregisterScrollEvent();
navigator.scrollToIndex(navigator.getIndex() - 1, true, 0);
delete app.flags._glance;
}
}