From 0c265a41d49c31149b580279e6465bc65e95d514 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Fri, 5 Jun 2020 17:56:31 -0400 Subject: [PATCH] fix: #8363, go to hash when entering topic --- public/src/client/topic.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/public/src/client/topic.js b/public/src/client/topic.js index 46df30aa63..e12413328a 100644 --- a/public/src/client/topic.js +++ b/public/src/client/topic.js @@ -39,7 +39,7 @@ define('forum/topic', [ Topic.init = function () { var tid = ajaxify.data.tid; - + currentUrl = ajaxify.currentPage; $(window).trigger('action:topic.loading'); app.enterRoom('topic_' + tid); @@ -119,8 +119,11 @@ define('forum/topic', [ // use the user's bookmark data if available, fallback to local if available var bookmark = ajaxify.data.bookmark || storage.getItem('topic:' + tid + ':bookmark'); var postIndex = ajaxify.data.postIndex; - - if (postIndex > 1) { + if (window.location.hash) { + var hash = window.location.hash; + window.location.hash = ''; + window.location.hash = hash; + } else if (postIndex > 1) { if (components.get('post/anchor', postIndex - 1).length) { return navigator.scrollToPostIndex(postIndex - 1, true, 0); }