From a52c69d2a158e47e01423f6fe376777c6ca4f459 Mon Sep 17 00:00:00 2001 From: psychobunny Date: Sat, 20 Sep 2014 15:04:14 -0400 Subject: [PATCH] only send noscript paginator data on cold loads --- src/controllers/categories.js | 16 +++++++++------- src/controllers/topics.js | 16 +++++++++------- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/src/controllers/categories.js b/src/controllers/categories.js index b23e4d4afb..d3b4291cd8 100644 --- a/src/controllers/categories.js +++ b/src/controllers/categories.js @@ -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); diff --git a/src/controllers/topics.js b/src/controllers/topics.js index de91eb75dd..5bae5b3e42 100644 --- a/src/controllers/topics.js +++ b/src/controllers/topics.js @@ -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);