Node.js based forum software built for the modern web
update unread anchor
Barış Soner Uşaklı1b4a24b997f9
diff --git a/public/language/en-GB/topic.json b/public/language/en-GB/topic.jsonindex d5551ddd8e..7d9878bccc 100644--- a/public/language/en-GB/topic.json+++ b/public/language/en-GB/topic.json@@ -238,5 +238,6 @@"navigator.unread": "%1 unread","upvote-post": "Upvote post","downvote-post": "Downvote post",- "post-tools": "Post tools"+ "post-tools": "Post tools",+ "unread-posts-link": "Unread posts link"}diff --git a/public/src/modules/navigator.js b/public/src/modules/navigator.jsindex 3cf81cbe9c..5111b47e95 100644--- a/public/src/modules/navigator.js+++ b/public/src/modules/navigator.js@@ -372,13 +372,23 @@ define('navigator', [const anchorEl = unreadEl.querySelector('.meta a');remaining = Math.min(remaining, ajaxify.data.postcount - index);+ function toggleAnchor(text) {+ anchorEl.innerText = text;+ anchorEl.setAttribute('aria-disabled', text ? 'false' : 'true');+ if (text) {+ anchorEl.removeAttribute('tabindex');+ } else {+ anchorEl.setAttribute('tabindex', -1);+ }+ }+if (remaining > 0 && (trackHeight - thumbBottom) >= thumbHeight) {const text = await translator.translate(`[[topic:navigator.unread, ${remaining}]]`);anchorEl.href = `${config.relative_path}/topic/${ajaxify.data.slug}/${Math.min(index + 1, ajaxify.data.postcount)}`;- anchorEl.innerText = text;+ toggleAnchor(text);} else {anchorEl.href = ajaxify.data.url;- anchorEl.innerText = '';+ toggleAnchor('');}}