aboutsummaryrefslogtreecommitdiff
path: root/pyaggr3g470r/static/js
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2014-06-29 13:26:07 +0200
committerCédric Bonhomme <cedric@cedricbonhomme.org>2014-06-29 13:26:07 +0200
commitc3aa3555554f9017e4996c8e08d656e9d5bbd3a3 (patch)
tree5c895c01696cc08832a465efe24b9d2c228c3958 /pyaggr3g470r/static/js
parentImproved read/unread JS function. (diff)
downloadnewspipe-c3aa3555554f9017e4996c8e08d656e9d5bbd3a3.tar.gz
newspipe-c3aa3555554f9017e4996c8e08d656e9d5bbd3a3.tar.bz2
newspipe-c3aa3555554f9017e4996c8e08d656e9d5bbd3a3.zip
Improved read/unread JS function.
Diffstat (limited to 'pyaggr3g470r/static/js')
-rw-r--r--pyaggr3g470r/static/js/articles.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/pyaggr3g470r/static/js/articles.js b/pyaggr3g470r/static/js/articles.js
index 990f293c..bd4e9627 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') }
// Mark an article as read or unread.
$('.readed').on('click', function() {
var article_id = $(this).parent().parent().parent().attr("data-article");
+ var feed_id = $(this).parent().parent().parent().attr("data-feed");
var filter = $('#filters').attr("data-filter");
var data;
@@ -34,10 +35,13 @@ if (typeof jQuery === 'undefined') { throw new Error('Requires jQuery') }
})
if (filter == "read") {
$(this).parent().parent().parent().remove();
+ $("#total-unread").text(parseInt($("#total-unread").text()) - 1);
+ $("#unread-"+feed_id).text(parseInt($("#unread-"+feed_id).text()) + 1);
}
else {
// here, filter == "all"
$(this).removeClass('glyphicon-unchecked').addClass('glyphicon-check');
+ $("#unread-"+feed_id).text(parseInt($("#unread-"+feed_id).text()) + 1);
}
}
else {
@@ -46,10 +50,13 @@ 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);
}
else {
// here, filter == "all"
$(this).removeClass('glyphicon-check').addClass('glyphicon-unchecked');
+ $("#unread-"+feed_id).text(parseInt($("#unread-"+feed_id).text()) - 1);
}
}
bgstack15