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

Somehow it works

- The feed's lastItem attribute is... Hm ; Let's sleep on it.
parent c71c1a64
......@@ -471,11 +471,10 @@ PTL.dialog = {
const $dialog = $(this),
$column = $button.parent().parent(),
$panel = $column.parent(),
$columnsInTab = $panel.find('.column'),
nbOfColumnsInTab = $columnsInTab.length,
$icon = $dialog.find('div#icon > i'),
colIndex = $panel.find('.column').index($column),
nbOfFeedsInCol = $column.find('.feed').length;
$feedsInCol = $column.find('.feed'),
nbOfFeedsInCol = $feedsInCol.length;
$icon.addClass('icon-trash-empty danger');
......@@ -496,8 +495,14 @@ PTL.dialog = {
title: PTL.tr('Wait! Are you sure?'),
class: "dangerous translate",
click: function() {
$feedsInCol.each(function(){
localStorage.setItem($(this).find('div.dataStore').attr('data-url'), '');
console.log('deleting (%s) from cache', $(this).find('div.dataStore').attr('data-url'));
});
PTL.dialog.kill($dialog);
PTL.col.del($column, nbOfColumnsInTab);
PTL.col.del($column);
}
}
],
......
......@@ -7,14 +7,7 @@ PTL.feed = {
const feedIndex = $('#tabs').find('.feed').length;
const $feed = $('<li>')
.attr('class', 'feed')
.data('url', url)
.data('name', name)
.data('type', type)
.data('limit', limit)
.data('iconhash', iconhash)
.data('nbitems', nbitems)
.data('lastitem', lastitem);
.attr('class', 'feed');
const $feedImg = $('<img>')
.attr({
......@@ -556,9 +549,7 @@ PTL.feed = {
if ($dataStore.data('status') == 'on') {
var lastItem = $dataStore.data('lastitem');
console.log('lastItem: %s (%s)', lastItem);
console.log('lastItem: %s (%s)', feedLastItem);
$feedIcon.removeClass('fold');
$refreshButton.addClass('spin');
......@@ -572,7 +563,7 @@ PTL.feed = {
$feedBody.append(saved);
}
PTL.feed.get(feedUrl, lastItem)
PTL.feed.get(feedUrl, feedLastItem)
.then(function(data) {
if (data.lastItem) {
......@@ -594,7 +585,7 @@ PTL.feed = {
})
.catch(function(error) {
console.log('whoops: %s (%s)', error);
$feedBody.append(PTL.feed.errorFeed(error, feedUrl));
$feedBody.empty().append(PTL.feed.errorFeed(error, feedUrl));
$feedBody.css('height', '');
$refreshButton
......@@ -608,7 +599,7 @@ PTL.feed = {
} else {
PTL.feed.get(feedUrl, lastItem)
PTL.feed.get(feedUrl, '')
.then(function(data) {
// console.log('YAAA: %s (%s)', JSON.stringify(data));
......@@ -643,7 +634,7 @@ PTL.feed = {
})
.catch(function(error) {
console.log('whoops: %s (%s)', error);
$feedBody.append(PTL.feed.errorFeed(error, feedUrl));
$feedBody.empty().append(PTL.feed.errorFeed(error, feedUrl));
$feedBody.css('height', '');
$refreshButton
......
......@@ -68,6 +68,8 @@ PTL.sync = (function() {
if (PTL.util.isValidPTLFile(JSON.parse(data))) {
console.log('DATA: %s (%s)', JSON.stringify(data));
PTL.tab.populate(JSON.parse(data));
} else {
......
......@@ -125,6 +125,9 @@ PTL.tab = {
thisFeed.status = v.status;
thisFeed.iconhash = v.iconhash;
thisFeed.nbitems = v.nbitems;
thisFeed.lastitem = v.lastitem;
// console.log('v.lastitem: %s (%s)', v.lastitem);
thisColFeeds.push(thisFeed);
allFeeds.push(thisColFeeds);
......@@ -234,6 +237,7 @@ PTL.tab = {
if (!newTab) {
feeds.forEach(function(feed) {
// console.log('feed.lastitem: %s (%s)', feed.lastitem, feed.url);
const type = PTL.feedTypes.includes(feed.type) ? feed.type : 'mixed',
nbitems = Number.isInteger(feed.nbitems) ? feed.nbitems : 30,
limit = Number.isInteger(feed.limit) ? feed.limit : 260;
......@@ -286,6 +290,8 @@ PTL.tab = {
feed.nbitems = $dataStore.data('nbitems');
feed.lastitem = $dataStore.data('lastitem');
// console.log('feed.lastitem: %s (%s)', feed.lastitem, feed.url);
column.push(feed);
});
......
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