Commit 2f40c41a authored by yPhil's avatar yPhil
Browse files

Pretty close now

- Unread count on subsequent refreshes
parent 2cba9592
......@@ -655,7 +655,7 @@ PTL.feed = {
if (data.thereArenewItems) {
$feedBody.html($newFeedBodyUl);
$feedBody.prepend($newFeedBodyUl);
$badge.fadeIn('slow').text(itemList[1]);
let ReadTransaction = db.transaction(PTL.DbStore, "readwrite"),
......
......@@ -64,25 +64,46 @@ function getFeed (feedUrl, lastItem, nbItems, callback) {
return callback({error:error, errno:res.status, message:error.message});
}).on('readable', function() {
try {
var item = this.read();
var item;
if (item !== null){
i++;
while ((item = this.read())) {
console.error('item.link: %s (%s)', item.link);
if (item !== null) {
i++;
if (typeof newLastItem == 'undefined') {
newLastItem = item.link;
}
if (typeof newLastItem === 'undefined') {
newLastItem = item.link;
}
if (newLastItem == lastItem) {
console.error('### Count reached i:%s, lastItem: [%s], newLastItem: %s', i, lastItem, newLastItem);
this.resume();
} else {
if (item.link !== lastItem) {
console.error('item.link: %s (%s)', item.link);
// console.error('### PUSHING [%s] lastItem:[%s]', item.link, newLastItem);
feedItems.push(item);
} else {
console.error('### i:[%s], This item:[%s], lastItem:[%s], newLastItem:[%s]', i, item.link, lastItem, newLastItem);
this.resume();
}
}
}
// if (item !== null){
// i++;
// console.error('item.link: %s (%s)', item.link);
// if (typeof newLastItem == 'undefined') {
// newLastItem = item.link;
// }
// if (newLastItem == lastItem) {
// console.error('### Count reached i:%s, lastItem: [%s], newLastItem: %s', i, lastItem, newLastItem);
// feedparser.destroy();
// // return false;
// } else {
// feedItems.push(item);
// }
// }
}
catch (err) {
console.error('## feedParserCatchErr: %s (%s)', err, feedUrl);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment