Revert "use sessionStorage instead of localStorage"

This reverts commit 3987dc1686.
master
Aevann 2024-01-14 15:08:27 +02:00
parent 39fcd3837e
commit 84f90ae7fd
7 changed files with 5 additions and 52 deletions

View File

@ -6,7 +6,6 @@
.fa-align-left:before{content:"\f036"}
.fa-long-arrow-left:before{content:"\f177"}
.fa-arrow-left:before{content:"\f060"}
.fa-arrow-right:before{content:"\f061"}
.fa-sign-out:before{content:"\f08b"}
.fa-long-arrow-right:before{content:"\f178"}

View File

@ -12,23 +12,18 @@ window.onscroll = function () {
const bottomSafeAreaInset = parseInt(getComputedStyle(bottomBar).getPropertyValue("--safe-area-inset-bottom")) || 0;
const postNavigationBar = document.getElementById('post_navigation')
if (bottomBar != null) {
if (prevScrollpos > currentScrollPos && (innerHeight + currentScrollPos) < (document.body.offsetHeight - 65)) {
bottomBar.style.bottom = "0px";
if (postNavigationBar)
postNavigationBar.style.top = "0px";
}
else if (currentScrollPos <= 125 && (innerHeight + currentScrollPos) < (document.body.offsetHeight - 65)) {
bottomBar.style.bottom = "0px";
if (postNavigationBar)
postNavigationBar.style.top = "0px";
}
else if (prevScrollpos > currentScrollPos && (innerHeight + currentScrollPos) >= (document.body.offsetHeight - 65)) {
bottomBar.style.bottom = `-${50 + bottomSafeAreaInset}px`;
}
else {
bottomBar.style.bottom = `-${50 + bottomSafeAreaInset}px`;
if (postNavigationBar)
postNavigationBar.style.top = `-${40 + bottomSafeAreaInset}px`;
}
}

View File

@ -32,22 +32,3 @@ if (fake_textarea) {
location.href = fake_textarea.dataset.href;
});
}
let post_ids = sessionStorage.getItem("post_ids");
if (post_ids) {
post_ids = post_ids.split(', ')
const current_index = post_ids.indexOf(pid)
const id_before = post_ids[current_index-1]
const id_after = post_ids[current_index+1]
if (id_before) {
document.getElementById('post_before').classList.remove('disabled')
document.getElementById('post_before').href = `/post/${id_before}`
}
if (id_after) {
document.getElementById('post_after').classList.remove('disabled')
document.getElementById('post_after').href = `/post/${id_after}`
}
}

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

@ -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=ids)
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)
if not v:
cache.set(f'frontpage_{sort}_{t}_{page}_{hole}_{pins}', result, timeout=900)

View File

@ -82,7 +82,7 @@
{% endif %}
</div>
<div class="navbar navbar-expand-md navbar-light" id="navbar" style="z-index: 1030">
<div class="navbar navbar-expand-md navbar-light" id="navbar">
<div class="container-fluid" style="padding:0">
<a href="/" class="navbar-brand mr-auto {% if not has_logo and not hole %}flex-grow-1{% endif %}">
{% if False %}
@ -462,23 +462,6 @@
{% endif %}
</div>
</div>
{% if request.path.startswith('/post/') and p %}
<div id="post_navigation" style="top: 0px; transition: top cubic-bezier(0, 0, 0.2, 1) 220ms; position: relative; z-index: 1029">
<div id="post_navigation-tabs" class="row" style="justify-content: center">
<a id="post_before" class="disabled btn btn-primary btn-block m-0 shop-tab award-tab">
<span class="mr-auto ml-auto">
<i class="fas fa-arrow-left"></i> Previous Post
</span>
</a>
<a id="post_after" class="disabled btn btn-primary btn-block m-0 shop-tab award-tab">
<span class="mr-auto ml-auto">
<i class="fas fa-arrow-right"></i> Next Post
</span>
</a>
</div>
</div>
{% endif %}
</nav>
{% if v and not err %}

View File

@ -128,7 +128,4 @@
{% if FP and request.path == '/' and v and not v.fp %}
<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>
{% endblock %}