aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2015-05-17 17:24:08 +0200
committerCédric Bonhomme <cedric@cedricbonhomme.org>2015-05-17 17:24:08 +0200
commitad54e53f15761423a5cfad0102843f1ae2be83e3 (patch)
tree354da82f0e98c774e78ae94a004a1244a100ad84
parentFinally, the side menu was easier to understand before. (diff)
downloadnewspipe-ad54e53f15761423a5cfad0102843f1ae2be83e3.tar.gz
newspipe-ad54e53f15761423a5cfad0102843f1ae2be83e3.tar.bz2
newspipe-ad54e53f15761423a5cfad0102843f1ae2be83e3.zip
The line of an unread articles is removed from the table when it is opened in a new tab.
-rw-r--r--pyaggr3g470r/static/js/articles.js21
-rw-r--r--pyaggr3g470r/templates/home.html2
2 files changed, 22 insertions, 1 deletions
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 = [];
diff --git a/pyaggr3g470r/templates/home.html b/pyaggr3g470r/templates/home.html
index c2a8b114..3d0e3849 100644
--- a/pyaggr3g470r/templates/home.html
+++ b/pyaggr3g470r/templates/home.html
@@ -93,7 +93,7 @@
{% if filter_ == 'all' %}</b>{% endif %}
{% endif %}
</td>
- <td><a href="/article/redirect/{{ article.id}}" target="_blank">{{ article.source.title|safe }}</a></td>
+ <td><a class="open-article" href="/article/redirect/{{ article.id}}" target="_blank">{{ article.source.title|safe }}</a></td>
<td {%if filter_ == 'all' and article.readed == False %}style='font-weight:bold'{% endif %}>
<a href="/article/{{ article.id }}">{{ article.title|safe }}</a>
</td>
bgstack15