summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBernhard Posselt <nukeawhale@gmail.com>2012-09-05 15:29:08 +0200
committerBernhard Posselt <nukeawhale@gmail.com>2012-09-05 15:29:44 +0200
commit4c8457c01e5683cc77370a344d24ad2cd6763e7f (patch)
treec3452a1deb515feb30227fd2fecff38b550e6e61
parentfd16daf12d07bd67db7e5af1d7cd964707d4bedc (diff)
fixed bug that would prevent marking as keep_unread when directly clicking on the checkbox, fixed bug that prevented a folder being set as all read
-rw-r--r--js/items.js77
-rw-r--r--js/menu.js10
2 files changed, 42 insertions, 45 deletions
diff --git a/js/items.js b/js/items.js
index bd929d951..27b6d754d 100644
--- a/js/items.js
+++ b/js/items.js
@@ -122,21 +122,6 @@ var News = News || {};
});
};
- /**
- * Marks the currently viewed element as viewed
- */
- Items.prototype._markCurrentlyViewed = function() {
- var self = this;
- $('.viewed').removeClass('viewed');
- var notFound = true;
- $('.feed_item').each(function(){
- var visiblePx = Math.ceil($(this).position().top + $(this).outerHeight());
- if(notFound && visiblePx > 90){
- $(this).addClass('viewed');
- notFound = false;
- }
- });
- };
/**
* Jumps to the next visible element
@@ -181,26 +166,6 @@ var News = News || {};
};
/**
- * Jumps to an element in the article list
- * @param number the number of the item starting with 0
- */
- Items.prototype._jumpToElemenId = function(id) {
- $elem = $('.feed_item[data-id=' + id + ']');
- this._$articleList.scrollTop(
- $elem.offset().top - this._$articleList.offset().top + this._$articleList.scrollTop());
- this._markCurrentlyViewed();
- };
-
- /**
- * Adds padding to the bottom to be able to scroll the last element beyond
- * the top area
- */
- Items.prototype._setScrollBottom = function() {
- var padding = this._$articleList.height() - 80;
- this._$articleList.children('ul').css('padding-bottom', padding + 'px');
- };
-
- /**
* Empties the item cache
*/
Items.prototype.emptyItemCache = function() {
@@ -227,6 +192,27 @@ var News = News || {};
};
/**
+ * Jumps to an element in the article list
+ * @param number the number of the item starting with 0
+ */
+ Items.prototype._jumpToElemenId = function(id) {
+ $elem = $('.feed_item[data-id=' + id + ']');
+ this._$articleList.scrollTop(
+ $elem.offset().top - this._$articleList.offset().top + this._$articleList.scrollTop());
+ this._markCurrentlyViewed();
+ };
+
+ /**
+ * Adds padding to the bottom to be able to scroll the last element beyond
+ * the top area
+ */
+ Items.prototype._setScrollBottom = function() {
+ var padding = this._$articleList.height() - 80;
+ this._$articleList.children('ul').css('padding-bottom', padding + 'px');
+ };
+
+
+ /**
* Returns a jquery node by searching for its id
* @param id the id of the node
* @return the jquery node
@@ -236,6 +222,21 @@ var News = News || {};
return this._$articleList.find('.feed_item[data-id="' + id + '"]');
};
+ /**
+ * Marks the currently viewed element as viewed
+ */
+ Items.prototype._markCurrentlyViewed = function() {
+ var self = this;
+ $('.viewed').removeClass('viewed');
+ var notFound = true;
+ $('.feed_item').each(function(){
+ var visiblePx = Math.ceil($(this).position().top + $(this).outerHeight());
+ if(notFound && visiblePx > 90){
+ $(this).addClass('viewed');
+ notFound = false;
+ }
+ });
+ };
News.Items = Items;
@@ -544,11 +545,7 @@ var News = News || {};
self._toggleKeepUnread();
});
- this._$html.find('.keep_unread input[type=checkbox]').click(function(){
- var $item = $(this).parent().parent().parent().parent('.feed_item');
- var itemId = $item.data('id');
- self._toggleKeepUnread();
- });
+
this._$html.find('time.timeago').timeago();
};
diff --git a/js/menu.js b/js/menu.js
index 2a2b930b6..0980e4ca1 100644
--- a/js/menu.js
+++ b/js/menu.js
@@ -799,14 +799,14 @@ var News = News || {};
// check if we got a parent folder and update its unread count
if(type === MenuNodeType.Feed){
var $folder = $node.parent().parent();
- var folderData = $(this._getIdAndTypeFromNode($folder));
-
+ var folderData = this._getIdAndTypeFromNode($folder);
if(folderData.type === MenuNodeType.Folder){
var folderUnreadCount = 0;
- $node.siblings('li').each(function(){
- var feedData = $(this._getIdAndTypeFromNode($(this)));
+ var self = this;
+ $folder.children('ul').children('li').each(function(){
+ var feedData = self._getIdAndTypeFromNode($(this));
if(feedData.type === MenuNodeType.Feed){
- folderUnreadCount += this._unreadCount.Feed[feedData.id];
+ folderUnreadCount += self._unreadCount.Feed[feedData.id];
}
});
this._applyUnreadCountStyle(MenuNodeType.Folder, folderData.id,