mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-02 12:05:57 +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;
|
Topic.replaceURLTimeout = 0;
|
||||||
if (history.replaceState) {
|
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({
|
history.replaceState({
|
||||||
url: newUrl + search
|
url: newUrl + search
|
||||||
}, null, window.location.protocol + '//' + window.location.host + RELATIVE_PATH + '/' + 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;
|
req.params.post_index = 0;
|
||||||
}
|
}
|
||||||
if (!settings.usePagination) {
|
if (!settings.usePagination) {
|
||||||
currentPage = 1;
|
if (req.params.post_index !== 0) {
|
||||||
|
currentPage = 1;
|
||||||
|
}
|
||||||
if (reverse) {
|
if (reverse) {
|
||||||
postIndex = Math.max(0, postCount - (req.params.post_index || postCount) - Math.ceil(settings.postsPerPage / 2));
|
postIndex = Math.max(0, postCount - (req.params.post_index || postCount) - Math.ceil(settings.postsPerPage / 2));
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user