Skip to content

Node.js based forum software built for the modern web

fix navigator.scrollToPost()

barisusaklifea2267b5851
diff --git a/public/src/modules/navigator.js b/public/src/modules/navigator.js
index ffc397bca0..b5c415ad78 100644
--- a/public/src/modules/navigator.js
+++ b/public/src/modules/navigator.js
@@ -210,7 +210,11 @@ define('navigator', ['forum/pagination', 'components'], function(pagination, com
}
if (config.usePagination) {
- var page = Math.max(1, Math.ceil(postIndex / config.postsPerPage));
+ var index = postIndex;
+ if (config.topicPostSort === 'most_votes' || config.topicPostSort === 'newest_to_oldest') {
+ index = ajaxify.data.postcount - 1 - index;
+ }
+ var page = Math.max(1, Math.ceil(index / config.postsPerPage));
if (parseInt(page, 10) !== ajaxify.data.pagination.currentPage) {
pagination.loadPage(page, function() {