mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-01 11:35:55 +01:00
make ?page=[numbers] links work for users with pagination disabled. remove ?page when updating the URL for infinite scroll
This commit is contained in:
@@ -260,7 +260,7 @@ define('forum/topic', [
|
||||
|
||||
Topic.replaceURLTimeout = 0;
|
||||
if (history.replaceState) {
|
||||
var search = (window.location.search ? window.location.search : '');
|
||||
var search = (window.location.search && !/^\?page=\d+$/.test(window.location.search) ? window.location.search : '');
|
||||
history.replaceState({
|
||||
url: newUrl + search
|
||||
}, null, window.location.protocol + '//' + window.location.host + RELATIVE_PATH + '/' + newUrl + search);
|
||||
|
||||
@@ -97,7 +97,9 @@ topicsController.get = function(req, res, callback) {
|
||||
req.params.post_index = 0;
|
||||
}
|
||||
if (!settings.usePagination) {
|
||||
currentPage = 1;
|
||||
if (req.params.post_index !== 0) {
|
||||
currentPage = 1;
|
||||
}
|
||||
if (reverse) {
|
||||
postIndex = Math.max(0, postCount - (req.params.post_index || postCount) - Math.ceil(settings.postsPerPage / 2));
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user