diff options
author | Bernhard Posselt <nukeawhale@gmail.com> | 2012-08-11 17:53:41 +0200 |
---|---|---|
committer | Bernhard Posselt <nukeawhale@gmail.com> | 2012-08-11 17:53:41 +0200 |
commit | 638ffc27b3e9bdff7ac455cbdba99a03e308264c (patch) | |
tree | 5a465af48193e814c6b00634f56a10de9946b0bf | |
parent | 80cc1dd89295b4f913706b97008cb92c5f2a58b3 (diff) |
implemented the 'mark all as read' button to mark all loaded items of a feed as read
-rw-r--r-- | js/news.js | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/js/news.js b/js/news.js index 7af0f6384..f792086b7 100644 --- a/js/news.js +++ b/js/news.js @@ -176,7 +176,7 @@ News={ return false; }, markItem:function(itemid, feedid) { - var currentitem = $('#rightcontent [data-id="' + itemid + '"]'); + var currentitem = $('#feed_items [data-id="' + itemid + '"][data-feedid="' + feedid + '"]'); if (currentitem.hasClass('title_unread')) { $.post(OC.filePath('news', 'ajax', 'markitem.php'),{'itemid':itemid},function(jsondata){ if(jsondata.status == 'success'){ @@ -203,8 +203,12 @@ News={ }) }; }, - markAllItems:function(feedid) { - + markAllItems:function() { + $("#feed_items li.title_unread").each(function(){ + var itemId = $(this).data('id'); + var feedId = $(this).data('feedid'); + News.Feed.markItem(itemId, feedId); + }); }, load:function(feedid) { $.post(OC.filePath('news', 'ajax', 'loadfeed.php'),{'feedid':feedid},function(jsondata) { @@ -357,6 +361,11 @@ function bindItemEventListeners(){ News.Feed.markItem(itemId, feedId); }) + // bind the mark all as read button + $('#mark_all_as_read').click(function(){ + News.Feed.markAllItems(); + }); + } |