mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-03-11 15:10:45 +01:00
feat(glance-nav): anchor and text update for unread indicator
This commit is contained in:
@@ -101,13 +101,15 @@ async function updateUnreadIndicator() {
|
||||
const percentage = 1 - (index / ajaxify.data.postcount);
|
||||
unreadEl.style.height = `${trackHeight * percentage}px`;
|
||||
|
||||
const metaEl = unreadEl.querySelector('.meta');
|
||||
const anchorEl = unreadEl.querySelector('.meta a');
|
||||
const remaining = ajaxify.data.postcount - index;
|
||||
if (remaining > 0) {
|
||||
const text = await translate(`[[topic:navigator.unread, ${remaining}]]`);
|
||||
metaEl.innerText = text;
|
||||
anchorEl.href = `${config.relative_path}/topic/${ajaxify.data.slug}/${Math.min(index + 1, ajaxify.data.postcount)}`;
|
||||
anchorEl.innerText = text;
|
||||
} else {
|
||||
metaEl.innerText = '';
|
||||
anchorEl.href = ajaxify.data.url;
|
||||
anchorEl.innerText = '';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user