mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
feat: add topicIndex to category page
This commit is contained in:
@@ -41,10 +41,9 @@ define('forum/category', [
|
||||
};
|
||||
|
||||
function handleScrollToTopicIndex() {
|
||||
var parts = window.location.pathname.split('/');
|
||||
var topicIndex = parts[parts.length - 1];
|
||||
var topicIndex = ajaxify.data.topicIndex;
|
||||
if (topicIndex && utils.isNumber(topicIndex)) {
|
||||
topicIndex = Math.max(0, parseInt(topicIndex, 10) - 1);
|
||||
topicIndex = Math.max(0, parseInt(topicIndex, 10));
|
||||
if (topicIndex && window.location.search.indexOf('page=') === -1) {
|
||||
navigator.scrollToElement($('[component="category/topic"][data-index="' + topicIndex + '"]'), true, 0);
|
||||
}
|
||||
|
||||
@@ -96,6 +96,7 @@ categoryController.get = async function (req, res, next) {
|
||||
categoryData.privileges = userPrivileges;
|
||||
categoryData.showSelect = userPrivileges.editable;
|
||||
categoryData.showTopicTools = userPrivileges.editable;
|
||||
categoryData.topicIndex = topicIndex;
|
||||
categoryData.rssFeedUrl = nconf.get('url') + '/category/' + categoryData.cid + '.rss';
|
||||
if (parseInt(req.uid, 10)) {
|
||||
categories.markAsRead([cid], req.uid);
|
||||
|
||||
Reference in New Issue
Block a user