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['feeds:disableRSS'] = parseInt(meta.config['feeds:disableRSS'], 10) === 1;
data.csrf = req.csrfToken(); data.csrf = req.csrfToken();
// Paginator for noscript if (!res.locals.isAPI) {
data.pages = []; // Paginator for noscript
for(var x=1;x<=data.pageCount;x++) { data.pages = [];
data.pages.push({ for(var x=1;x<=data.pageCount;x++) {
page: x, data.pages.push({
active: x === parseInt(page, 10) page: x,
}); active: x === parseInt(page, 10)
});
}
} }
res.render('category', data); res.render('category', data);

View File

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