From ad54e53f15761423a5cfad0102843f1ae2be83e3 Mon Sep 17 00:00:00 2001 From: Cédric Bonhomme Date: Sun, 17 May 2015 17:24:08 +0200 Subject: The line of an unread articles is removed from the table when it is opened in a new tab. --- pyaggr3g470r/static/js/articles.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'pyaggr3g470r/static') diff --git a/pyaggr3g470r/static/js/articles.js b/pyaggr3g470r/static/js/articles.js index a5ac82d0..fe7f0cba 100644 --- a/pyaggr3g470r/static/js/articles.js +++ b/pyaggr3g470r/static/js/articles.js @@ -24,6 +24,24 @@ if (typeof jQuery === 'undefined') { throw new Error('Requires jQuery') } +function ($) { + // Mark an article as read when it is opened in a new table + $('.open-article').on('click', function(e) { + var feed_id = $(this).parent().parent().attr("data-feed"); + var filter = $('#filters').attr("data-filter"); + console.log("unread"); + if (filter == "unread") { + $(this).parent().parent().remove(); + $("#total-unread").text(parseInt($("#total-unread").text()) - 1); + if (parseInt($("#unread-"+feed_id).text()) == 1) { + $("#unread-"+feed_id).remove(); + } else { + $("#unread-"+feed_id).text(parseInt($("#unread-"+feed_id).text()) - 1); + } + } + }); + + + // Mark an article as read or unread. $('.readed').on('click', function() { var article_id = $(this).parent().parent().parent().attr("data-article"); @@ -90,6 +108,8 @@ if (typeof jQuery === 'undefined') { throw new Error('Requires jQuery') } }); }); + + // Like or unlike an article $('.like').on('click', function() { var article_id = $(this).parent().parent().parent().attr("data-article"); @@ -145,6 +165,7 @@ if (typeof jQuery === 'undefined') { throw new Error('Requires jQuery') } }); + // Delete all duplicate articles (used in the page /duplicates) $('.delete-all').click(function(){ var data = []; -- cgit From 136ce735f5473bad2e102bb66e8c1c4c75ebc0c9 Mon Sep 17 00:00:00 2001 From: Cédric Bonhomme Date: Sun, 17 May 2015 17:28:10 +0200 Subject: Removed debug message. --- pyaggr3g470r/static/js/articles.js | 1 - 1 file changed, 1 deletion(-) (limited to 'pyaggr3g470r/static') diff --git a/pyaggr3g470r/static/js/articles.js b/pyaggr3g470r/static/js/articles.js index fe7f0cba..bb31f6d8 100644 --- a/pyaggr3g470r/static/js/articles.js +++ b/pyaggr3g470r/static/js/articles.js @@ -28,7 +28,6 @@ if (typeof jQuery === 'undefined') { throw new Error('Requires jQuery') } $('.open-article').on('click', function(e) { var feed_id = $(this).parent().parent().attr("data-feed"); var filter = $('#filters').attr("data-filter"); - console.log("unread"); if (filter == "unread") { $(this).parent().parent().remove(); $("#total-unread").text(parseInt($("#total-unread").text()) - 1); -- cgit