diff options
Diffstat (limited to 'pyaggr3g470r')
-rw-r--r-- | pyaggr3g470r/static/js/articles.js | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/pyaggr3g470r/static/js/articles.js b/pyaggr3g470r/static/js/articles.js index bd4e9627..4f27b802 100644 --- a/pyaggr3g470r/static/js/articles.js +++ b/pyaggr3g470r/static/js/articles.js @@ -51,12 +51,20 @@ if (typeof jQuery === 'undefined') { throw new Error('Requires jQuery') } if (filter == "unread") { $(this).parent().parent().parent().remove(); $("#total-unread").text(parseInt($("#total-unread").text()) - 1); - $("#unread-"+feed_id).text(parseInt($("#unread-"+feed_id).text()) - 1); + if (parseInt($("#unread-"+feed_id).text()) == 1) { + $("#unread-"+feed_id).remove(); + } else { + $("#unread-"+feed_id).text(parseInt($("#unread-"+feed_id).text()) - 1); + } } else { // here, filter == "all" $(this).removeClass('glyphicon-check').addClass('glyphicon-unchecked'); - $("#unread-"+feed_id).text(parseInt($("#unread-"+feed_id).text()) - 1); + if (parseInt($("#unread-"+feed_id).text()) == 1) { + $("#unread-"+feed_id).remove(); + } else { + $("#unread-"+feed_id).text(parseInt($("#unread-"+feed_id).text()) - 1); + } } } |