diff options
author | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2014-06-29 21:10:09 +0200 |
---|---|---|
committer | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2014-06-29 21:10:09 +0200 |
commit | affa1cd6d40444cdf90233f97c1d863f74419a21 (patch) | |
tree | c9715282c7a29bcbd4b120076b675dea009eb31e /pyaggr3g470r/static | |
parent | Using date CSS class where appropriate. (diff) | |
download | newspipe-affa1cd6d40444cdf90233f97c1d863f74419a21.tar.gz newspipe-affa1cd6d40444cdf90233f97c1d863f74419a21.tar.bz2 newspipe-affa1cd6d40444cdf90233f97c1d863f74419a21.zip |
Minor improvements to the JS scripts.
Diffstat (limited to 'pyaggr3g470r/static')
-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); + } } } |