Commit 61f12f41 authored by yPhil's avatar yPhil
Browse files

Removed 404 onerror on img tags

parent e71c3fda
......@@ -19,7 +19,7 @@ PTL.db = {
query.onsuccess = (event) => {
if (!event.target.result) {
console.log(`Feed ${url} not found`);
console.log('Feed: [%s] not in db (%s)', url, PTL.DbName);
resolve(null);
} else {
// console.table(event.target.result);
......@@ -55,7 +55,7 @@ PTL.db = {
query.onsuccess = event => {
resolve();
// console.log(event);
console.log('Feed: [%s] has been saved to db (%s)', url, PTL.DbName);
};
query.onerror = event => {
......@@ -83,12 +83,11 @@ PTL.db = {
let query = store.delete(url);
query.onsuccess = function (event) {
console.log(event);
console.log('DEL OK: %s (%s)', event);
console.log('Feed: [%s] has been saved to db (%s)', url, PTL.DbName);
};
query.onerror = function (event) {
console.log('DEL NOK: %s (%s)', event.target.errorCode);
console.log('DEL NOK: [%s] (%s)', event.target.errorCode);
};
txn.oncomplete = function () {
......
......@@ -281,11 +281,15 @@ PTL.dialog = {
newName = DOMPurify.sanitize($(this).find('input#feedNameInput').val()),
newType = $('#feedTypeDiv :radio:checked').attr('id');
$dataStore
.data('url', newUrl)
.attr('data-dummyurl', newUrl)
.data('name', newName)
.data('type', newType);
console.log('newUrl: %s (%s)', newUrl, $dataStore.data('url'));
if ($('input[name=killFeedCheckbox]:checked').val() === 'on') {
$feed.hide('fade', 1000, function() {$feed.remove();});
} else {
......@@ -467,7 +471,7 @@ PTL.dialog = {
},
change: function( event, ui ) {
$feedLimitInput.val(ui.value);
$dataStore.data('limit', ui.value);
$dataStore.attr('data-limit', ui.value);
}
});
......@@ -494,7 +498,7 @@ PTL.dialog = {
},
change: function( event, ui ) {
$feedNbItemsInput.val(ui.value);
$dataStore.data('nbitems', ui.value);
$dataStore.attr('data-nbitems', ui.value);
}
});
......
This diff is collapsed.
......@@ -143,7 +143,7 @@ var PTL = (function() {
}
PTL.sideMenu('close');
PTL.feed.add($column, '', '', 'mixed', 220, 'on', '', '', '', 30, true, false);
PTL.feed.add($column, '', '', 'mixed', 220, 'on', '', 16, '', 30, true, false);
});
$feedCodeButton.click(function(event) {
......
// @license magnet:?xt=urn:btih:1f739d935676111cfff4b4693e3816e664797050&dn=gpl-3.0.txt GPL-v3-or-Later
PTL.tab = {
init:function() {
init:function() {
PTL.language = PTL.prefs.readConfig('lang');
PTL.language = PTL.prefs.readConfig('lang');
PTL.util.translate();
PTL.util.translate();
$('#loadSpinner').fadeIn('fast');
$('#loadSpinner').fadeIn('fast');
const $tabs = $('#tabs').tabs({
heightStyle: 'content',
activate: function(event, ui) {
ui.newPanel.css("display","flex");
$('.tabIcon').show();
}
});
const $tabs = $('#tabs').tabs({
heightStyle: 'content',
activate: function(event, ui) {
ui.newPanel.css("display","flex");
$('.tabIcon').show();
}
});
$tabs.find('.ui-tabs-nav').sortable({
axis: 'x',
items: '> li:not(#newTabTab)',
stop: function() {
$tabs.tabs('refresh');
PTL.tab.saveTabs();
}
});
$tabs.on('mouseup', '.ui-tabs-active a', function(e){
e.preventDefault();
if (e.which === 1) {
PTL.dialog.editTab($(this));
}
});
$tabs.on("click", "i.tabCloser", function() {
PTL.dialog.killTab($(this));
});
if (PTL.util.isMobile()) {
$tabs.find('.feedControls > div').removeClass('collapsible');
}
$tabs.find('.ui-tabs-nav').sortable({
axis: 'x',
items: '> li:not(#newTabTab)',
stop: function() {
$tabs.tabs('refresh');
PTL.tab.saveTabs();
}
});
$tabs.on('mouseup', '.ui-tabs-active a', function(e){
e.preventDefault();
if (e.which === 1) {
PTL.dialog.editTab($(this));
}
});
$tabs.on("click", "i.tabCloser", function() {
PTL.dialog.killTab($(this));
});
$tabs.find('.collapsible').show('fast');
if (PTL.util.isMobile()) {
$tabs.find('.feedControls > div').removeClass('collapsible');
}
$(window).scroll(function() {
if ($(this).scrollTop() >= 50) {
$('#backToTop').fadeIn(200);
} else {
$('#backToTop').fadeOut(200);
}
});
$tabs.find('.collapsible').show('fast');
$('#backToTop').click(function() {
$('body,html').animate({
scrollTop : 0
}, 500);
});
$(window).scroll(function() {
if ($(this).scrollTop() >= 50) {
$('#backToTop').fadeIn(200);
} else {
$('#backToTop').fadeOut(200);
}
});
$('#backToTop').click(function() {
$('body,html').animate({
scrollTop : 0
}, 500);
});
$('#newTabTab').bind('click', function(event) {
event.stopImmediatePropagation();
PTL.tab.add($tabs);
});
$('#newTabTab').bind('click', function(event) {
event.stopImmediatePropagation();
PTL.tab.add($tabs);
});
PTL.sync.readSync();
PTL.sync.readSync();
$("#theme").attr({href: '/static/css/themes/' + PTL.prefs.readConfig('theme') + '.css'});
$("#theme").attr({href: '/static/css/themes/' + PTL.prefs.readConfig('theme') + '.css'});
$('#loadSpinner').fadeOut(999);
$('#loadSpinner').fadeOut(999);
},
saveTabs:function() {
const feeds = PTL.tab.list();
PTL.prefs.writeConfig('feeds', JSON.stringify(feeds));
PTL.sync.writeSync(JSON.stringify(feeds));
PTL.util.say(PTL.tr('Tabs and feeds saved'), 'success');
},
populate:function(feeds) {
},
saveTabs:function() {
const feeds = PTL.tab.list();
PTL.prefs.writeConfig('feeds', JSON.stringify(feeds));
PTL.sync.writeSync(JSON.stringify(feeds));
PTL.util.say(PTL.tr('Tabs and feeds saved'), 'success');
},
populate:function(feeds) {
const $tabs = $('#tabs');
const $tabs = $('#tabs');
PTL.tab.makeNewTabButton($tabs);
PTL.tab.makeNewTabButton($tabs);
if (!feeds || feeds.length <= 0) {
PTL.util.say(PTL.tr('No feeds found'), 'error');
feeds = ['empty'];
}
if (!feeds || feeds.length <= 0) {
PTL.util.say(PTL.tr('No feeds found'), 'error');
feeds = ['empty'];
}
var nbOfGroups = 0,
nbOfFeeds = 0,
progress = PTL.util.buildProgress();
var nbOfGroups = 0,
nbOfFeeds = 0,
progress = PTL.util.buildProgress();
feeds.forEach(function(group) {
nbOfGroups++;
$.each(group.columns, function(k, v) {
$.each(v, function() {
nbOfFeeds++;
feeds.forEach(function(group) {
nbOfGroups++;
$.each(group.columns, function(k, v) {
$.each(v, function() {
nbOfFeeds++;
});
});
});
});
});
PTL.util.say(PTL.tr('Data structure OK: %1 tab(s) containing %2 feed(s)', nbOfGroups, nbOfFeeds), 'success');
PTL.util.say(PTL.tr('Data structure OK: %1 tab(s) containing %2 feed(s)', nbOfGroups, nbOfFeeds), 'success');
progress.init(nbOfFeeds);
progress.init(nbOfFeeds);
feeds.forEach(function(group) {
feeds.forEach(function(group) {
const thisGroup = {},
allFeeds = [],
thisTabCols = [];
const thisGroup = {},
allFeeds = [],
thisTabCols = [];
thisGroup.name = group.name;
thisGroup.name = group.name;
$.each(group.columns, function(k, v) {
$.each(group.columns, function(k, v) {
const thisColFeeds = [];
const thisColFeeds = [];
$.each(v, function( k, v ) {
const thisFeed = {};
thisFeed.url = v.url;
thisFeed.name = v.name;
thisFeed.type = v.type;
thisFeed.limit = v.limit;
thisFeed.status = v.status;
thisFeed.iconhash = v.iconhash;
thisFeed.nbitems = v.nbitems;
thisFeed.lastitem = v.lastitem;
$.each(v, function( k, v ) {
const thisFeed = {};
thisFeed.url = v.url;
thisFeed.name = v.name;
thisFeed.type = v.type;
thisFeed.limit = v.limit;
thisFeed.status = v.status;
thisFeed.iconhash = v.iconhash;
thisFeed.nbitems = v.nbitems;
thisFeed.lastitem = v.lastitem;
// console.log('v.lastitem: %s (%s)', v.lastitem);
// console.log('v.lastitem: %s (%s)', v.lastitem);
thisColFeeds.push(thisFeed);
allFeeds.push(thisColFeeds);
thisColFeeds.push(thisFeed);
allFeeds.push(thisColFeeds);
});
thisTabCols.push(thisColFeeds);
});
PTL.tab.add($tabs, thisGroup.name, thisTabCols, progress);
});
thisTabCols.push(thisColFeeds);
});
PTL.tab.add($tabs, thisGroup.name, thisTabCols, progress);
});
$('#newTabTab').removeClass('hidden');
$('#newTabTab').removeClass('hidden');
$tabs.find('li[tabindex="0"]:first-child').focus();
$tabs.find('li[tabindex="0"]:first-child').focus();
PTL.util.say(PTL.tr('Pétrolette init finished'), 'success');
PTL.util.say(PTL.tr('Pétrolette init finished'), 'success');
PTL.tab.saveTabs();
PTL.tab.saveTabs();
},
empty:function(callback) {
$('div#tabs ul li').remove();
$('div#tabs div').remove();
callback();
},
add:function($tabs, name, columns, progress) {
},
empty:function(callback) {
$('div#tabs ul li').remove();
$('div#tabs div').remove();
callback();
},
add:function($tabs, name, columns, progress) {
var tabIndex = $('ul#tabNamesUl li.tabName').length + 1;
var tabIndex = $('ul#tabNamesUl li.tabName').length + 1;
name = name || 'Tab ' + tabIndex;
name = name || 'Tab ' + tabIndex;
const $tabCloser = $('<i>')
.attr('class', 'icon-cancel tabIcon tabCloser translate')
.data('title', PTL.tr('Delete the [%1] tab', name))
.attr('title', PTL.tr('Delete the [%1] tab', name));
const $tabCloser = $('<i>')
.attr('class', 'icon-cancel tabIcon tabCloser translate')
.data('title', PTL.tr('Delete the [%1] tab', name))
.attr('title', PTL.tr('Delete the [%1] tab', name));
const $tabPanel = $('<div>')
.attr('id', 'tab-' + tabIndex)
.attr('class', 'tab panel');
const $tabPanel = $('<div>')
.attr('id', 'tab-' + tabIndex)
.attr('class', 'tab panel');
const $tabLink = $('<a>')
.attr('href', '#tab-' + tabIndex)
.append(name);
const $tabLink = $('<a>')
.attr('href', '#tab-' + tabIndex)
.append(name);
const $tab = $('<li>')
.attr('class', 'modal tabName translate')
.data('id', 'tab-' + tabIndex++)
.data('title', PTL.tr('%1 | Click to rename, drag to move', name))
.attr('title', PTL.tr('%1 | Click to rename, drag to move', name));
const $tab = $('<li>')
.attr('class', 'modal tabName translate')
.data('id', 'tab-' + tabIndex++)
.data('title', PTL.tr('%1 | Click to rename, drag to move', name))
.attr('title', PTL.tr('%1 | Click to rename, drag to move', name));
const $tabNames = $('#tabs ul#tabNamesUl');
const $tabNames = $('#tabs ul#tabNamesUl');
$tab.droppable({
tolerance: 'pointer',
accept: 'li.feed.selected',
hoverClass: 'ui-state-hover',
drop: function (event, ui) {
const $item = $(this);
const $index = $('li.tabName').index(this);
const $elements = ui.draggable.data('items');
const $list = $($item.find('a').attr('href'))
.find('.column').first();
$elements.show().hide('slow');
$tab.droppable({
tolerance: 'pointer',
accept: 'li.feed.selected',
hoverClass: 'ui-state-hover',
drop: function (event, ui) {
const $item = $(this);
const $index = $('li.tabName').index(this);
const $elements = ui.draggable.data('items');
const $list = $($item.find('a').attr('href'))
.find('.column').first();
$elements.show().hide('slow');
ui.draggable.show().hide('fade', 300, function () {
ui.draggable.show().hide('fade', 300, function () {
$item.find('.collapsible').show('fade', 'fast');
$item.find('.collapsible').show('fade', 'fast');
if (PTL.prefs.readConfig('tabDropActivate') === 'true')
$tabs.tabs('option', 'active', $index);
if (PTL.prefs.readConfig('tabDropActivate') === 'true')
$tabs.tabs('option', 'active', $index);
$(this).prependTo($list).show('fade', 800).before($elements.show('fade', 800));
$(this).prependTo($list).show('fade', 800).before($elements.show('fade', 800));
$('body').css('cursor','auto');
$('body').css('cursor','auto');
PTL.tab.saveTabs();
PTL.tab.saveTabs();
});
}
});
}
});
$tab.append($tabLink,
$tabCloser);
$tab.append($tabLink,
$tabCloser);
$tab.appendTo($tabNames);
$tabNames.find('#newTabTab').appendTo($tabNames);
$tab.appendTo($tabNames);
$tabNames.find('#newTabTab').appendTo($tabNames);
var newTab = false;
var newTab = false;
if (!columns || columns.length <= 0) {
newTab = true;
columns = ['empty'];
}
if (!columns || columns.length <= 0) {
newTab = true;
columns = ['empty'];
}
var colIndex = 1,
nbOfColumnsInTab = columns.length;
var colIndex = 1,
nbOfColumnsInTab = columns.length;
columns.forEach(function(feeds) {
columns.forEach(function(feeds) {
const $column = PTL.col.add(colIndex++);
const $column = PTL.col.add(colIndex++);
$column.appendTo($tabPanel);
$column.appendTo($tabPanel);
if (PTL.queryString) {
PTL.feed.add($column, encodeURI(PTL.queryString), '', 'mixed', 260, 'on', '', '', 30, true, true);
PTL.queryString = null;
}
if (PTL.queryString) {
PTL.feed.add($column, encodeURI(PTL.queryString), '', 'mixed', 260, 'on', '', '', 30, true, true);
PTL.queryString = null;
}
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 : 5,
limit = Number.isInteger(feed.limit) ? feed.limit : 260;
PTL.feed.add($column, feed.url, feed.name, type, limit, feed.status, feed.iconhash, nbitems, feed.lastitem, false, false, progress);
});
}
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 : 5,
limit = Number.isInteger(feed.limit) ? feed.limit : 260,
lastItem = feed.lastitem;
PTL.feed.add($column, feed.url, feed.name, type, limit, feed.status, feed.iconhash, nbitems, lastItem, false, false, progress);
});
}
if (nbOfColumnsInTab < 2) $column.find('.col-del').addClass('ui-state-disabled');
if (nbOfColumnsInTab < 2) $column.find('.col-del').addClass('ui-state-disabled');
});
});
$tabPanel.appendTo($tabs);
$tabPanel.appendTo($tabs);
$tabs.tabs('refresh');
$tabs.tabs( "option", "active", 0);
},
list:function(type) {
$tabs.tabs('refresh');
$tabs.tabs( "option", "active", 0);
},
list:function(type) {
const $groupNodes = $('#tabNamesUl > li.tabName'),
groups = [];
const $groupNodes = $('#tabNamesUl > li.tabName'),
groups = [];
$groupNodes.each(function() {
$groupNodes.each(function() {
const group = {},
columns = [],
$groupNode = $(this),
$columnNodes = $($groupNode.children().attr('href') + ' ul.column');
const group = {},
columns = [],
$groupNode = $(this),
$columnNodes = $($groupNode.children().attr('href') + ' ul.column');
group.name = $groupNode.children('a').text();
group.name = $groupNode.children('a').text();
if (type && type === 'all')
group.pane = $groupNode.data('id');
if (type && type === 'all')
group.pane = $groupNode.data('id');
$columnNodes.each(function() {
$columnNodes.each(function() {
const column = [],
$srcNodes = $(this).children('li.feed');
const column = [],
$srcNodes = $(this).children('li.feed');
$srcNodes.each(function() {
const feed = {};
$srcNodes.each(function() {
const feed = {};
const $dataStore = $(this).find('.dataStore');
feed.url = $dataStore.data('url');
feed.name = $dataStore.data('name');
feed.type = $dataStore.data('type');
feed.limit = $dataStore.data('limit');
feed.status = $dataStore.data('status');
feed.iconhash = $dataStore.data('iconhash');
feed.feedhash = $dataStore.data('feedhash');
feed.nbitems = $dataStore.data('nbitems');
feed.lastitem = $dataStore.data('lastitem');
const $dataStore = $(this).find('.dataStore');
feed.url = $dataStore.data('url');
feed.name = $dataStore.data('name');
feed.type = $dataStore.data('type');
feed.limit = $dataStore.data('limit');
feed.status = $dataStore.data('status');
feed.iconhash = $dataStore.data('iconhash');
feed.nbitems = $dataStore.data('nbitems');
feed.lastitem = $dataStore.data('lastitem');
// console.log('feed.lastitem: %s (%s)', feed.lastitem, feed.url);