diff --git a/files/assets/js/post_navigation.js b/files/assets/js/post_navigation.js index 9ba036b2d..7dbab00d4 100644 --- a/files/assets/js/post_navigation.js +++ b/files/assets/js/post_navigation.js @@ -2,11 +2,18 @@ let post_permalinks = sessionStorage.getItem("post_permalinks") if (post_permalinks) { post_permalinks = post_permalinks.split(', '); - const current_index = post_permalinks.indexOf(`'${location.href}'`) + let current_index = post_permalinks.indexOf(`'${location.href}'`) if (current_index > -1) { - const permalink_after = post_permalinks[current_index+1] + let permalink_after = post_permalinks[current_index+1] if (permalink_after) { + let pid = permalink_after.split('/').slice(-2, -1)[0] + while (comments[pid]) { + current_index += 1 + permalink_after = post_permalinks[current_index] + pid = permalink_after.split('/').slice(-2, -1)[0] + } + for (const btn of document.getElementsByClassName('post_navigation')) { btn.classList.remove('d-none') btn.href = permalink_after.slice(1, -1) diff --git a/files/templates/header.html b/files/templates/header.html index 72df3c596..096b90ad7 100644 --- a/files/templates/header.html +++ b/files/templates/header.html @@ -256,7 +256,6 @@ - {% endif %} {% if v %} diff --git a/files/templates/post.html b/files/templates/post.html index 89469f3e4..3ba1bd860 100644 --- a/files/templates/post.html +++ b/files/templates/post.html @@ -361,6 +361,7 @@ + {% if fart and not (v and v.has_badge(128)) %}