diff options
author | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2015-07-10 14:43:42 +0200 |
---|---|---|
committer | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2015-07-10 14:43:42 +0200 |
commit | 4ca54cabc263d638aaf0acb74f08b3793a2b3145 (patch) | |
tree | 5cb549ff7b672bd388d40428178c3a692c309360 | |
parent | Only start the classic crawler if we were able to get the feed of the site. (diff) | |
download | newspipe-4ca54cabc263d638aaf0acb74f08b3793a2b3145.tar.gz newspipe-4ca54cabc263d638aaf0acb74f08b3793a2b3145.tar.bz2 newspipe-4ca54cabc263d638aaf0acb74f08b3793a2b3145.zip |
Minor fixes to the counter.
-rw-r--r-- | pyaggr3g470r/static/js/articles.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/pyaggr3g470r/static/js/articles.js b/pyaggr3g470r/static/js/articles.js index 8bceb1b0..bdd33926 100644 --- a/pyaggr3g470r/static/js/articles.js +++ b/pyaggr3g470r/static/js/articles.js @@ -25,6 +25,7 @@ if (typeof jQuery === 'undefined') { throw new Error('Requires jQuery') } function change_unread_counter(feed_id, increment) { var new_value = parseInt($("#unread-"+feed_id).text()) + increment; $("#unread-"+feed_id).text(new_value); + $("#total-unread").text(parseInt($("#total-unread").text()) + increment); if (new_value == 0) { $("#unread-"+feed_id).hide(); } else { @@ -57,7 +58,6 @@ function change_unread_counter(feed_id, increment) { }) if (filter == "read") { $(this).parent().parent().parent().remove(); - $("#total-unread").text(parseInt($("#total-unread").text()) - 1); } else { // here, filter == "all" @@ -133,6 +133,7 @@ function change_unread_counter(feed_id, increment) { // Delete an article $('.delete').on('click', function() { + var feed_id = $(this).parent().parent().parent().attr("data-feed"); var article_id = $(this).parent().parent().parent().attr("data-article"); $(this).parent().parent().parent().remove(); @@ -141,7 +142,7 @@ function change_unread_counter(feed_id, increment) { type: 'DELETE', url: API_ROOT + "article/" + article_id, success: function (result) { - //console.log(result); + change_unread_counter(feed_id, -1); }, error: function(XMLHttpRequest, textStatus, errorThrown){ console.log(XMLHttpRequest.responseText); |