only send noscript paginator data on cold loads

This commit is contained in:
psychobunny
2014-09-20 15:04:14 -04:00
parent f891f49339
commit a52c69d2a1
2 changed files with 18 additions and 14 deletions

View File

@@ -202,13 +202,15 @@ categoriesController.get = function(req, res, next) {
data['feeds:disableRSS'] = parseInt(meta.config['feeds:disableRSS'], 10) === 1;
data.csrf = req.csrfToken();
// Paginator for noscript
data.pages = [];
for(var x=1;x<=data.pageCount;x++) {
data.pages.push({
page: x,
active: x === parseInt(page, 10)
});
if (!res.locals.isAPI) {
// Paginator for noscript
data.pages = [];
for(var x=1;x<=data.pageCount;x++) {
data.pages.push({
page: x,
active: x === parseInt(page, 10)
});
}
}
res.render('category', data);

View File

@@ -217,13 +217,15 @@ topicsController.get = function(req, res, next) {
topic_url += '?' + queryString;
}
// Paginator for noscript
data.pages = [];
for(var x=1; x<=data.pageCount; x++) {
data.pages.push({
page: x,
active: x === parseInt(page, 10)
});
if (!res.locals.isAPI) {
// Paginator for noscript
data.pages = [];
for(var x=1; x<=data.pageCount; x++) {
data.pages.push({
page: x,
active: x === parseInt(page, 10)
});
}
}
res.render('topic', data);