forked from MarseyWorld/MarseyWorld
make "next post" button skip visited posts
parent
a58e1ae0bf
commit
d4ead1150f
|
@ -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)
|
||||
|
|
|
@ -256,7 +256,6 @@
|
|||
<i class="fas fa-arrow-right"></i>
|
||||
</a>
|
||||
</li>
|
||||
<script src="{{'js/post_navigation.js' | asset}}"></script>
|
||||
{% endif %}
|
||||
|
||||
{% if v %}
|
||||
|
|
|
@ -361,6 +361,7 @@
|
|||
|
||||
<input hidden id="twoattrs-{{p.id}}" class="twoattrs" value="{{p.id}},{{p.comment_count}}">
|
||||
<script defer src="{{'js/new_comments.js' | asset}}"></script>
|
||||
<script defer src="{{'js/post_navigation.js' | asset}}"></script>
|
||||
<script defer src="{{'js/post.js' | asset}}"></script>
|
||||
|
||||
{% if fart and not (v and v.has_badge(128)) %}
|
||||
|
|
Loading…
Reference in New Issue