From 84f90ae7fddea4f09122578cb2f48136578ba310 Mon Sep 17 00:00:00 2001 From: Aevann Date: Sun, 14 Jan 2024 15:08:27 +0200 Subject: [PATCH] Revert "use sessionStorage instead of localStorage" This reverts commit 3987dc1686a05e26b08d88be5e68614d6cac869e. --- files/assets/css/main.css | 1 - files/assets/js/mobile_navigation_bar.js | 11 +++-------- files/assets/js/post.js | 19 ------------------- files/assets/js/post_ids.js | 2 -- files/routes/front.py | 2 +- files/templates/header.html | 19 +------------------ files/templates/home.html | 3 --- 7 files changed, 5 insertions(+), 52 deletions(-) delete mode 100644 files/assets/js/post_ids.js diff --git a/files/assets/css/main.css b/files/assets/css/main.css index 441e43cf6..b1a435b61 100644 --- a/files/assets/css/main.css +++ b/files/assets/css/main.css @@ -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"} diff --git a/files/assets/js/mobile_navigation_bar.js b/files/assets/js/mobile_navigation_bar.js index 414df7a0d..34b2a195f 100644 --- a/files/assets/js/mobile_navigation_bar.js +++ b/files/assets/js/mobile_navigation_bar.js @@ -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`; } } diff --git a/files/assets/js/post.js b/files/assets/js/post.js index 693a413e2..88708dd57 100644 --- a/files/assets/js/post.js +++ b/files/assets/js/post.js @@ -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}` - } -} diff --git a/files/assets/js/post_ids.js b/files/assets/js/post_ids.js deleted file mode 100644 index 3dd3e303b..000000000 --- a/files/assets/js/post_ids.js +++ /dev/null @@ -1,2 +0,0 @@ -const post_ids = document.getElementById('post_ids').value.slice(1, -1) -sessionStorage.setItem("post_ids", post_ids); diff --git a/files/routes/front.py b/files/routes/front.py index 73909bd23..1b7a8a622 100644 --- a/files/routes/front.py +++ b/files/routes/front.py @@ -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) diff --git a/files/templates/header.html b/files/templates/header.html index c6b249bd2..8e1767ed1 100644 --- a/files/templates/header.html +++ b/files/templates/header.html @@ -82,7 +82,7 @@ {% endif %} -