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