summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2014-01-25 16:07:50 +0100
committerGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2014-01-25 16:07:50 +0100
commitfa03aedac75a6ccb62b889e22fa0ec2e848cfa0b (patch)
treed3ada1a46ef97ea79a86dccfd47898633b3a08fd
parent4b05dcf90838f78f7493a49fa7f8fdde0637ac02 (diff)
Message articles disponibles uniquement lorsque approprié
Ne montre le message articles disponibles uniquement lorsque la vue en cours est concernée https://github.com/marienfressinaud/FreshRSS/issues/379
-rw-r--r--p/scripts/main.js17
1 files changed, 7 insertions, 10 deletions
diff --git a/p/scripts/main.js b/p/scripts/main.js
index 0c3a5fa3d..93e0c53b3 100644
--- a/p/scripts/main.js
+++ b/p/scripts/main.js
@@ -59,14 +59,17 @@ function incUnreadsFeed(article, feed_id, nb) {
}
}
+ var isCurrentView = false;
//Update unread: title
document.title = document.title.replace(/((?: \(\d+\))?)( · .*?)((?: \(\d+\))?)$/, function (m, p1, p2, p3) {
if (article || ($('#' + feed_id).closest('.active').length > 0)) {
+ isCurrentView = true;
return incLabel(p1, nb) + p2 + incLabel(p3, feed_priority > 0 ? nb : 0);
} else {
return p1 + p2 + incLabel(p3, feed_priority > 0 ? nb : 0);
}
});
+ return isCurrentView;
}
function mark_read(active, only_not_read) {
@@ -519,21 +522,15 @@ 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 (incUnreadsFeed(null, feed_id, nbUnreads - feed_unreads) && //Update of current view?
+ (nbUnreads - feed_unreads > 0)) {
+ $('#new-article').show();
+ };
});
-
- if (new_article) {
- $('#new-article').show();
- }
});
}