summaryrefslogtreecommitdiffstats
path: root/js
diff options
context:
space:
mode:
authorBernhard Posselt <nukeawhale@gmail.com>2012-09-01 01:19:47 +0200
committerBernhard Posselt <nukeawhale@gmail.com>2012-09-01 01:19:47 +0200
commit4c39312cb3ffba28b103e49ac37f293fc5eea78b (patch)
tree2e36d1f90cf9de4fb3f7f1ad4348e38698da9d2c /js
parent069f27346d84d9cb39cba4190d81e73402df61d1 (diff)
folders are now correctly transformed when it contains hidden items
Diffstat (limited to 'js')
-rw-r--r--js/items.js28
-rw-r--r--js/menu.js8
2 files changed, 34 insertions, 2 deletions
diff --git a/js/items.js b/js/items.js
index cd54afda8..64a5f4d53 100644
--- a/js/items.js
+++ b/js/items.js
@@ -112,7 +112,13 @@ var t = t || function(app, string){ return string; }; // mock translation for lo
this._itemCache.empty();
};
-
+ /**
+ * Marks all items of a feed as read
+ * @param feedId the id of the feed which should be marked as read
+ */
+ Items.prototype.markAllRead = function(feedId) {
+ this._itemCache.markAllRead(feedId);
+ };
/**
* Returns the most recent id of a feed from the cache
@@ -185,6 +191,19 @@ var t = t || function(app, string){ return string; }; // mock translation for lo
return this._items[itemId];
};
+
+ /**
+ * Marks all items of a feed as read
+ * @param feedId the id of the feed which should be marked as read
+ */
+ Items.prototype.markAllRead = function(feedId) {
+ if(this._feeds[feedId] !== undefined){
+ $.each(this._feeds[feedId], function(key, value){
+ value.addReadClass();
+ });
+ }
+ };
+
/**
* Adds Html elements to the cache
* @param html the html for a complete list with items
@@ -398,6 +417,13 @@ var t = t || function(app, string){ return string; }; // mock translation for lo
};
/**
+ * Adds only the read class, used for marking all read
+ */
+ Item.prototype.addReadClass = function() {
+ this._$html.addClass('read');
+ };
+
+ /**
* Binds listeners on the feed item
*/
Item.prototype._bindItemEventListeners = function() {
diff --git a/js/menu.js b/js/menu.js
index 19fb2ab5e..cd41fa63c 100644
--- a/js/menu.js
+++ b/js/menu.js
@@ -248,6 +248,7 @@ var News = News || {};
}
});
}
+ this._resetOpenFolders();
};
/**
@@ -760,7 +761,12 @@ var News = News || {};
Menu.prototype._resetOpenFolders = function(){
var $folders = $('.folder');
$folders.each(function(){
- var $children = $(this).children('ul').children('li');
+ var $children;
+ if(this._showAll){
+ $children = $(this).children('ul').children('li');
+ } else {
+ $children = $(this).children('ul').children('li.feed:not(.hidden)');
+ }
if($children.length > 0){
$(this).addClass('collapsable');
} else {