Commit 881e170d authored by yPhil's avatar yPhil
Browse files

Feeds: Ars type (mixed)

parent 2c77039b
Pipeline #495719 passed with stage
in 39 seconds
{
"name": "petrolette",
"description": "The news page that doesn't know you",
"version": "v1.5.6",
"version": "1.5.6",
"private": true,
"license": "GPL-3.0-only",
"HTTP_PORT": 8000,
......
......@@ -577,57 +577,71 @@ PTL.feed = {
$refreshButton.addClass('spin');
let fetchFeed = await PTL.feed.fetchFeed(feedUrl, feedLastItem);
if (fetchFeed.error) {
try {
let fetchFeed = await PTL.feed.fetchFeed(feedUrl, feedLastItem);
$feedBody
.empty()
.append(PTL.feed.errorFeed(fetchFeed.error, feedUrl))
.css('height', '');
$feedLink.addClass('danger');
$refreshButton.removeClass('spin');
if (fetchFeed.error) {
} else {
$feedBody
.empty()
.append(PTL.feed.errorFeed(fetchFeed.error, feedUrl))
.css('height', '');
$feedLink.addClass('danger');
$refreshButton.removeClass('spin');
let lastItems = await PTL.feed.lastItems(fetchFeed.feedItems, $dataStore);
} else {
let isInsecureLinks = lastItems[2];
let lastItems = await PTL.feed.lastItems(fetchFeed.feedItems, $dataStore);
const feedName = fetchFeed.feedTitle;
let isInsecureLinks = lastItems[2];
let $insecureIcon = $('<i>')
.attr('class', 'icon-lock warning')
.attr('title', PTL.tr("Some linked elements (image, audio or video) within this feed's items could not be loaded because they were served insecurely"));
if (isInsecureLinks) $warningIconSpan.html($insecureIcon);
$feedBody.html(lastItems[0]);
const feedName = fetchFeed.feedTitle;
let $insecureIcon = $('<i>')
.attr('class', 'icon-lock-open insecureIcon warning')
.attr('title', PTL.tr("Some linked elements (image, audio or video) within this feed's items could not be loaded because they were served insecurely"));
if (isInsecureLinks) $warningIconSpan.html($insecureIcon);
$feedBody.html(lastItems[0]);
$refreshButton
.attr('title', PTL.tr('Refresh this feed') + ' (' + feedUrl + ', ' + timeStamp + ')')
.removeClass('spin');
$feedLink
.attr('href', fetchFeed.feedLink)
.attr('title', feedName)
.text(feedName);
if ($dataStore.data('name') == '') $dataStore.data('name', feedName);
if (fetchFeed.totalNewItems > 0) {
$dataStore.data('lastitem', fetchFeed.lastItem);
PTL.tab.saveTabs();
$badge
.text(fetchFeed.totalNewItems)
.attr('title', PTL.tr('There are %1 new items in this feed', fetchFeed.totalNewItems))
.fadeIn('slow');
} else {
$badge.fadeOut('slow');
}
$refreshButton
.attr('title', PTL.tr('Refresh this feed') + ' (' + feedUrl + ', ' + timeStamp + ')')
.removeClass('spin');
$feedLink
.attr('href', fetchFeed.feedLink)
.attr('title', feedName)
.text(feedName);
if ($dataStore.data('name') == '') $dataStore.data('name', feedName);
if (fetchFeed.totalNewItems > 0) {
$dataStore.data('lastitem', fetchFeed.lastItem);
PTL.tab.saveTabs();
$badge
.text(fetchFeed.totalNewItems)
.attr('title', PTL.tr('There are %1 new items in this feed', fetchFeed.totalNewItems))
.fadeIn('slow');
} else {
$badge.fadeOut('slow');
}
} catch (error) {
}
console.error('WOA: %s (%s)', error);
$feedBody
.empty()
.append(PTL.feed.errorFeed(fetchFeed.error, feedUrl))
.css('height', '');
$feedLink.addClass('danger');
$refreshButton.removeClass('spin');
}
} else {
$feedBody.addClass('folded');
......
......@@ -48,7 +48,7 @@
{
"url": "https://feeds.arstechnica.com/arstechnica/index",
"name": "Ars Technica",
"type": "text",
"type": "mixed",
"limit": 452,
"status": "on",
"iconhash": "909ebf2b292548840863bf882fe33f5b",
......
Supports Markdown
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