From 8d10bf224a86dacdeb75d1f4afe25fe048dd86e5 Mon Sep 17 00:00:00 2001 From: Aevann Date: Mon, 29 Apr 2024 05:52:05 +0300 Subject: [PATCH] improve post nav --- files/assets/js/post_navigation.js | 10 ++++++---- files/templates/header.html | 8 ++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/files/assets/js/post_navigation.js b/files/assets/js/post_navigation.js index cb69b7ca7..a76c9adcf 100644 --- a/files/assets/js/post_navigation.js +++ b/files/assets/js/post_navigation.js @@ -14,9 +14,13 @@ if (post_permalinks) { pid = permalink_after.split('/').slice(-2, -1)[0] } + function go_next() { + location.replace(permalink_after.slice(1, -1)) + } + for (const btn of document.getElementsByClassName('post_navigation')) { btn.classList.remove('d-none') - btn.href = permalink_after.slice(1, -1) + btn.onclick = go_next } document.addEventListener('keydown', (e) => { @@ -26,9 +30,7 @@ if (post_permalinks) { !expandImageModal.classList.contains('show') ) { if (["ArrowRight", "d"].includes(e.key)) - location.href = permalink_after.slice(1, -1) - if (["ArrowLeft", "a"].includes(e.key)) - history.back() + go_next() } }) } diff --git a/files/templates/header.html b/files/templates/header.html index 217a31513..bbaf863f6 100644 --- a/files/templates/header.html +++ b/files/templates/header.html @@ -200,9 +200,9 @@ {% endif %} {% if p %} - + {% endif %} {% if g.browser == 'webview' %} @@ -258,9 +258,9 @@ {% if p %} {% endif %}