feat: add topicIndex to category page

v1.18.x
Barış Soner Uşaklı 5 years ago
parent 4969c86909
commit c1c617b323

@ -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);

Loading…
Cancel
Save