chore: module cleanup

This commit is contained in:
Julian Lam
2022-12-07 15:15:03 -05:00
parent e3dd1d62d9
commit e0280136e4
2 changed files with 5 additions and 5 deletions

View File

@@ -66,7 +66,7 @@ define('forum/topic', [
addPostsPreviewHandler();
setupQuickReply();
handleBookmark(tid);
glance.init();
glance.default();
$(window).on('scroll', utils.debounce(updateTopicTitle, 250));

View File

@@ -10,7 +10,7 @@ let trackBottom;
let trackHeight;
let knobEl;
export function init() {
export default function init() {
const topicEl = document.querySelector('[component="topic"]');
const navigatorEl = document.querySelector('[component="topic/navigator"]');
@@ -24,7 +24,7 @@ export function init() {
console.debug('[glance] At-a-glance navigator enabled.');
}
export function isActive() {
function isActive() {
const topicEl = document.querySelector('[component="topic"]');
return ajaxify.data.template.topic && topicEl && topicEl.classList.contains('minimal');
}
@@ -105,8 +105,8 @@ function onKnobMove(e) {
function toggle(state) {
const topicEl = document.querySelector('[component="topic"]');
if (!state) {
state = !isActive();
if (state === undefined) {
state = app.flags._glance !== true;
}
topicEl.classList[state ? 'add' : 'remove']('minimal');