Node.js based forum software built for the modern web
closes #5755
Barış Soner Uşaklıb13ed2658701
diff --git a/public/src/client/topic.js b/public/src/client/topic.jsindex c88af60237..3651c8be2b 100644--- a/public/src/client/topic.js+++ b/public/src/client/topic.js@@ -144,11 +144,11 @@ define('forum/topic', [function handleBookmark(tid) {// use the user's bookmark data if available, fallback to local if availablevar bookmark = ajaxify.data.bookmark || storage.getItem('topic:' + tid + ':bookmark');- var postIndex = getPostIndex();+ var postIndex = ajaxify.data.postIndex;- if (postIndex && window.location.search.indexOf('page=') === -1) {- if (components.get('post/anchor', postIndex).length) {- return navigator.scrollToPostIndex(postIndex, true, 0);+ if (postIndex > 0) {+ if (components.get('post/anchor', postIndex - 1).length) {+ return navigator.scrollToPostIndex(postIndex - 1, true, 0);}} else if (bookmark && (!config.usePagination || (config.usePagination && ajaxify.data.pagination.currentPage === 1)) && ajaxify.data.postcount > ajaxify.data.bookmarkThreshold) {app.alert({@@ -169,22 +169,6 @@ define('forum/topic', [}}- function getPostIndex() {- var parts = window.location.pathname.split('/');- var lastPart = parts[parts.length - 1];- if (lastPart && utils.isNumber(lastPart)) {- lastPart = Math.max(0, parseInt(lastPart, 10) - 1);- } else {- return 0;- }-- if (lastPart > 0 && !components.get('post/anchor', lastPart).length) {- return components.get('post/anchor').last().attr('name');- }-- return lastPart;- }-function addBlockQuoteHandler() {components.get('topic').on('click', 'blockquote .toggle', function () {var blockQuote = $(this).parent('blockquote');diff --git a/public/src/modules/navigator.js b/public/src/modules/navigator.jsindex 9ca7e94fa9..a7fd657cac 100644--- a/public/src/modules/navigator.js+++ b/public/src/modules/navigator.js@@ -76,7 +76,7 @@ define('navigator', ['forum/pagination', 'components'], function (pagination, coindex = 1;navigator.callback = null;navigator.selector = null;- $(window).off('scroll', navigator.update);+ $(window).off('scroll', navigator.delayedUpdate);toggle(false);};diff --git a/src/controllers/topics.js b/src/controllers/topics.jsindex eb69d48222..c702ba90fc 100644--- a/src/controllers/topics.js+++ b/src/controllers/topics.js@@ -262,6 +262,7 @@ topicsController.get = function (req, res, callback) {data.postDeleteDuration = parseInt(meta.config.postDeleteDuration, 10) || 0;data.scrollToMyPost = settings.scrollToMyPost;data.rssFeedUrl = nconf.get('relative_path') + '/topic/' + data.tid + '.rss';+ data.postIndex = req.params.post_index;data.pagination = pagination.create(currentPage, pageCount, req.query);data.pagination.rel.forEach(function (rel) {rel.href = nconf.get('url') + '/topic/' + data.slug + rel.href;