From a861df2662915e4b1b1bca333db06b65912bf91d Mon Sep 17 00:00:00 2001 From: Cadence Fish Date: Sun, 15 Mar 2020 19:02:38 +1300 Subject: [PATCH] Fix post navigation button functionality --- src/site/html/static/js/post_overlay.js | 6 +++--- src/site/pug/includes/post.pug | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/site/html/static/js/post_overlay.js b/src/site/html/static/js/post_overlay.js index a8f994f..f6a9384 100644 --- a/src/site/html/static/js/post_overlay.js +++ b/src/site/html/static/js/post_overlay.js @@ -148,11 +148,11 @@ function loadPostOverlay(shortcode, stateChangeType) { overlay.element.querySelectorAll(".navigate-posts").forEach(button => { button.addEventListener("click", async event => { /** @type {HTMLButtonElement} */ - //@ts-ignore + // @ts-ignore const button = event.currentTarget - if (button.classList.contains("next")) { + if (button.hasAttribute("data-next")) { navigate("next") - } else { + } else if (button.hasAttribute("data-previous")) { navigate("previous") } }) diff --git a/src/site/pug/includes/post.pug b/src/site/pug/includes/post.pug index 4da5b23..3a9c920 100644 --- a/src/site/pug/includes/post.pug +++ b/src/site/pug/includes/post.pug @@ -12,9 +12,9 @@ mixin post(post, headerWithNavigation) else = `@${post.getBasicOwner().username}` if headerWithNavigation - button.navigate-posts + button(data-previous).navigate-posts img(src="/static/img/arrow-circled.svg" alt="Previous post.").icon.previous - button.navigate-posts + button(data-next).navigate-posts img(src="/static/img/arrow-circled.svg" alt="Next post.").icon div.relative-box div.scrolling-box