forked from rDrama/rDrama
1
0
Fork 0

rename post_ids to post_permalinks

master
Aevann 2024-01-31 01:41:04 +02:00
parent 0be69612d1
commit b2ac886612
5 changed files with 9 additions and 9 deletions

View File

@ -36,11 +36,11 @@ if (fake_textarea) {
//POST NAVIGATION
const post_ids = sessionStorage.getItem("post_ids").split(', ');
const current_index = post_ids.indexOf(`'${location.href}'`)
const post_permalinks = sessionStorage.getItem("post_permalinks").split(', ');
const current_index = post_permalinks.indexOf(`'${location.href}'`)
if (current_index > -1) {
const id_after = post_ids[current_index+1]
const id_before = post_ids[current_index-1]
const id_after = post_permalinks[current_index+1]
const id_before = post_permalinks[current_index-1]
if (id_before || id_after) {
document.getElementById('post_navigation').classList.remove('d-none')

View File

@ -1,2 +0,0 @@
const post_ids = document.getElementById('post_ids').value.slice(1, -1)
sessionStorage.setItem("post_ids", post_ids);

View File

@ -0,0 +1,2 @@
const post_permalinks = document.getElementById('post_permalinks').value.slice(1, -1)
sessionStorage.setItem("post_permalinks", post_permalinks);

View File

@ -80,7 +80,7 @@ def front_all(v, hole=None):
if v and v.client: return {"data": [x.json for x in posts], "total": total}
result = render_template("home.html", v=v, listing=posts, total=total, sort=sort, t=t, page=page, hole=hole, home=True, pins=pins, size=size, post_ids=[p.permalink for p in posts])
result = render_template("home.html", v=v, listing=posts, total=total, sort=sort, t=t, page=page, hole=hole, home=True, pins=pins, size=size, post_permalinks=[p.permalink for p in posts])
if not v:
cache.set(f'frontpage_{sort}_{t}_{page}_{hole}_{pins}', result, timeout=900)

View File

@ -129,6 +129,6 @@
<script defer src="{{'js/fp.js' | asset}}"></script>
{% endif %}
<input hidden id="post_ids" value="{{post_ids}}">
<script defer src="{{'js/post_ids.js' | asset}}"></script>
<input hidden id="post_permalinks" value="{{post_permalinks}}">
<script defer src="{{'js/post_permalinks.js' | asset}}"></script>
{% endblock %}