mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-12-22 00:10:25 +01:00
fix: #8363, go to hash when entering topic
This commit is contained in:
@@ -39,7 +39,7 @@ define('forum/topic', [
|
|||||||
|
|
||||||
Topic.init = function () {
|
Topic.init = function () {
|
||||||
var tid = ajaxify.data.tid;
|
var tid = ajaxify.data.tid;
|
||||||
|
currentUrl = ajaxify.currentPage;
|
||||||
$(window).trigger('action:topic.loading');
|
$(window).trigger('action:topic.loading');
|
||||||
|
|
||||||
app.enterRoom('topic_' + tid);
|
app.enterRoom('topic_' + tid);
|
||||||
@@ -119,8 +119,11 @@ define('forum/topic', [
|
|||||||
// use the user's bookmark data if available, fallback to local if available
|
// use the user's bookmark data if available, fallback to local if available
|
||||||
var bookmark = ajaxify.data.bookmark || storage.getItem('topic:' + tid + ':bookmark');
|
var bookmark = ajaxify.data.bookmark || storage.getItem('topic:' + tid + ':bookmark');
|
||||||
var postIndex = ajaxify.data.postIndex;
|
var postIndex = ajaxify.data.postIndex;
|
||||||
|
if (window.location.hash) {
|
||||||
if (postIndex > 1) {
|
var hash = window.location.hash;
|
||||||
|
window.location.hash = '';
|
||||||
|
window.location.hash = hash;
|
||||||
|
} else if (postIndex > 1) {
|
||||||
if (components.get('post/anchor', postIndex - 1).length) {
|
if (components.get('post/anchor', postIndex - 1).length) {
|
||||||
return navigator.scrollToPostIndex(postIndex - 1, true, 0);
|
return navigator.scrollToPostIndex(postIndex - 1, true, 0);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user