diff options
author | Bernhard Posselt <nukeawhale@gmail.com> | 2012-08-31 23:02:51 +0200 |
---|---|---|
committer | Bernhard Posselt <nukeawhale@gmail.com> | 2012-09-01 00:31:39 +0200 |
commit | d23e81a85a2c91696ffb752324f8c9911401dbfe (patch) | |
tree | 7a5e5ed92f0c0829748af998a61144978ac38ed3 /js/items.js | |
parent | 62deb561f12ee034435d3ba61353fc2fa8f87d1c (diff) |
empty itemcache on view change
Diffstat (limited to 'js/items.js')
-rw-r--r-- | js/items.js | 37 |
1 files changed, 24 insertions, 13 deletions
diff --git a/js/items.js b/js/items.js index 3d86d97e3..f1e8e1240 100644 --- a/js/items.js +++ b/js/items.js @@ -51,6 +51,8 @@ var t = t || function(app, string){ return string; }; // mock translation for lo } }) }); + + this._itemCache.populate(this._$articleList.children('ul')); } /** @@ -108,6 +110,13 @@ var t = t || function(app, string){ return string; }; // mock translation for lo }; /** + * Empties the item cache + */ + Items.prototype.emptyItemCache = function() { + this._itemCache.empty(); + }; + + /** * Returns the most recent id of a feed from the cache * @param type the type (MenuNodeType) * @param id the id @@ -186,6 +195,14 @@ var t = t || function(app, string){ return string; }; // mock translation for lo }; /** + * Empties the cache + */ + ItemCache.prototype.empty = function() { + this._items = {}; + this._feeds = {}; + }; + + /** * Returns all the ids of feeds for a type sorted by id ascending * @param type the type (MenuNodeType) * @param id the id @@ -329,7 +346,7 @@ var t = t || function(app, string){ return string; }; // mock translation for lo var self = this; // single hover on item should mark it as read too - $('#feed_items h1.item_title a').click(function(){ + this._$html.find('#h1.item_title a').click(function(){ var $item = $(this).parent().parent('.feed_item'); var itemId = $item.data('id'); var handler = new News.ItemStatusHandler(itemId); @@ -337,7 +354,7 @@ var t = t || function(app, string){ return string; }; // mock translation for lo }); // single hover on item should mark it as read too - $('#feed_items .body').click(function(){ + this._$html.find('.body').click(function(){ var $item = $(this).parent('.feed_item'); var itemId = $item.data('id'); var handler = new News.ItemStatusHandler(itemId); @@ -345,34 +362,28 @@ var t = t || function(app, string){ return string; }; // mock translation for lo }); // mark or unmark as important - $('#feed_items li.star').click(function(){ + this._$html.find('li.star').click(function(){ var $item = $(this).parent().parent().parent('.feed_item'); var itemId = $item.data('id'); self._toggleImportant(itemId); }); // toggle logic for the keep unread handler - $('#feed_items .keep_unread').click(function(){ + this._$html.find('.keep_unread').click(function(){ var $item = $(this).parent().parent().parent('.feed_item'); var itemId = $item.data('id'); var handler = new News.ItemStatusHandler(itemId); handler.toggleKeepUnread(); }); - $('#feed_items .keep_unread input[type=checkbox]').click(function(){ + + this._$html.find('.keep_unread input[type=checkbox]').click(function(){ var $item = $(this).parent().parent().parent().parent('.feed_item'); var itemId = $item.data('id'); var handler = new News.ItemStatusHandler(itemId); handler.toggleKeepUnread(); }); - // bind the mark all as read button - $('#mark_all_as_read').unbind(); - $('#mark_all_as_read').click(function(){ - var feedId = News.Feed.activeFeedId; - News.Feed.setAllItemsRead(feedId); - }); - - $("time.timeago").timeago(); + this._$html.find('time.timeago').timeago(); }; })(); |