From 2a6443a0f0f52272e1e3269d0c32f56322a9a3ec Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Sat, 25 Jan 2014 14:06:34 +0100 Subject: Demande rafraîchissement page quand nvx articles MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ajout d'une indication pour rafraîchir la page si de nouveaux articles ont été détectés via le serveur Voir #379 --- p/scripts/main.js | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'p/scripts') diff --git a/p/scripts/main.js b/p/scripts/main.js index 3f6352baf..0c3a5fa3d 100644 --- a/p/scripts/main.js +++ b/p/scripts/main.js @@ -519,12 +519,21 @@ function init_notifications() { function refreshUnreads() { $.getJSON('./?c=javascript&a=nbUnreadsPerFeed').done(function (data) { + var new_article = false; $.each(data, function(feed_id, nbUnreads) { feed_id = 'f_' + feed_id; var elem = $('#' + feed_id + '>.feed').get(0), feed_unreads = elem ? (parseInt(elem.getAttribute('data-unread'), 10) || 0) : 0; incUnreadsFeed(null, feed_id, nbUnreads - feed_unreads); + + if (nbUnreads - feed_unreads > 0) { + new_article = true; + } }); + + if (new_article) { + $('#new-article').show(); + } }); } -- cgit v1.2.3