Skip to content

Node.js based forum software built for the modern web

fix: #8363, go to hash when entering topic

Barış Soner Uşaklı0c265a41d49c
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);
}