From 1eb104b4503aea3d0af2a78bc126e0b6cdd937d9 Mon Sep 17 00:00:00 2001 From: "cek@posta.indivia.net" Date: Wed, 29 Mar 2017 22:29:15 +0200 Subject: [PATCH] sistemato bug di scambio tab in caso non ci fossero nuovi post e aggiunto reset paginazione quando si cambia tab --- www/js/query.js | 2 +- www/js/update.js | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/www/js/query.js b/www/js/query.js index 520819e..4b4fe81 100644 --- a/www/js/query.js +++ b/www/js/query.js @@ -103,7 +103,7 @@ var appendPostList = function(div, resultSet, categories, fallback) { var prependPostsList = function(div, resultSet, categories, fallback) { var type = getObjKey(FONTE.categories, categories); - $(div).empty(); + //$(div).empty(); if (resultSet.rows.length > 0) { FONTE.page_loaded[type]++; drawListPost(div, resultSet, 'prepend'); diff --git a/www/js/update.js b/www/js/update.js index 3fd7fc3..c980bd1 100644 --- a/www/js/update.js +++ b/www/js/update.js @@ -62,6 +62,8 @@ function update() { } function postsUpdate(categories) { + $(FONTE.contentListClass).empty(); + var storage = window.localStorage; var type = getObjKey(FONTE.categories, categories); var jsonurl = weburl + REST_PARAMS.posts + REST_PARAMS.per_page + "&categories=" + categories.join(','); @@ -177,6 +179,10 @@ function getPrevSinglePageRecur(url, pagenum, categories) { } function getLastSinglePageRecur(url, pagenum, categories) { + // resetto la paginazione di #info e #ilove + FONTE.page_loaded.info = 0; + FONTE.page_loaded.ilove = 0; + var type = getObjKey(FONTE.categories, categories); console.log('url:'+url); @@ -238,7 +244,11 @@ function getLastSinglePageRecur(url, pagenum, categories) { insertOrUpdateCatToPost(id, val); }); }); + + if (data.length == 0) { + renderLastNews(FONTE.contentListClass, categories); + } }, error: JSONErrorHandler }); -} \ No newline at end of file +}