aboutsummaryrefslogtreecommitdiff
path: root/pyaggr3g470r/static/js/articles.js
diff options
context:
space:
mode:
Diffstat (limited to 'pyaggr3g470r/static/js/articles.js')
-rw-r--r--pyaggr3g470r/static/js/articles.js17
1 files changed, 15 insertions, 2 deletions
diff --git a/pyaggr3g470r/static/js/articles.js b/pyaggr3g470r/static/js/articles.js
index e62ca360..990f293c 100644
--- a/pyaggr3g470r/static/js/articles.js
+++ b/pyaggr3g470r/static/js/articles.js
@@ -25,19 +25,32 @@ 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 filter = $('#filters').attr("data-filter");
var data;
if ($(this).hasClass("glyphicon-unchecked")) {
data = JSON.stringify({
readed: false
})
+ if (filter == "read") {
+ $(this).parent().parent().parent().remove();
+ }
+ else {
+ // here, filter == "all"
$(this).removeClass('glyphicon-unchecked').addClass('glyphicon-check');
+ }
}
else {
data = JSON.stringify({
readed: true
})
- $(this).removeClass('glyphicon-check').addClass('glyphicon-unchecked');
+ if (filter == "unread") {
+ $(this).parent().parent().parent().remove();
+ }
+ else {
+ // here, filter == "all"
+ $(this).removeClass('glyphicon-check').addClass('glyphicon-unchecked');
+ }
}
// sends the updates to the server
@@ -57,7 +70,7 @@ 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");
bgstack15