diff options
| author | 2014-01-25 14:06:34 +0100 | |
|---|---|---|
| committer | 2014-01-25 14:06:34 +0100 | |
| commit | 2a6443a0f0f52272e1e3269d0c32f56322a9a3ec (patch) | |
| tree | eefeb8a1a3c6ab32426945b7edbb5e220979a02f /p/scripts | |
| parent | a7aa82b461ec2b35883ce4fb34e29e2b77717145 (diff) | |
Demande rafraîchissement page quand nvx articles
Ajout d'une indication pour rafraîchir la page si de nouveaux articles
ont été détectés via le serveur
Voir #379
Diffstat (limited to 'p/scripts')
| -rw-r--r-- | p/scripts/main.js | 9 |
1 files changed, 9 insertions, 0 deletions
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(); + } }); } |
