Commit 818f2abb authored by yPhil's avatar yPhil

Feed: Link to website in feedTitle (ISSUE 13 #13)

parent 2c840636
......@@ -572,18 +572,6 @@ div.testFlex {
}
}
#questionDialog > p {
font-family: 'GrobeDeutschmeisterRegular';
font-size: 4em;
text-align:center;
}
.ui-dialog .ui-dialog-titlebar-help {
/* position: absolute; */
right: 2em;
/* top: 50%; */
}
#tabs {
white-space: nowrap;
overflow: hidden;
......@@ -769,17 +757,28 @@ li.feed {
}
.mobHeader > .feedTitle {
color: var(--color-ter);
flex-basis: auto;
flex-grow: 4;
flex-shrink: 1;
flex-basis: auto;
font-family: 'BebasNeueRegular' !important;
margin-left: var(--title-margin-left);
}
.mobHeader > .feedTitle > a:link {
color: var(--color-ter);
/* margin: .2em 0; */
font-size: var(--var-controls-font-size);
font-family: 'BebasNeueRegular';
font-weight: normal;
font-style: italic;
font-weight: normal;
text-decoration: none;
}
.mobHeader > .feedTitle > a:visited {
color: var(--color-ter) !important;
}
.mobHeader > .feedTitle > a:hover {
color: var(--ui-color-sec) !important;
}
.ui-tabs-active a {
......
......@@ -92,8 +92,13 @@ MOB.feed = {
.attr('class', 'feedDelete');
var $titleDiv = $('<div>')
.attr('title', url)
.attr('class', 'feedTitle truncate');
var $titleLink = $('<a>')
.attr('href', url)
.html(url);
var $prefsDiv = $('<div>')
.attr('class', 'prefs');
......@@ -153,7 +158,8 @@ MOB.feed = {
$feedSelect.appendTo($selectDiv);
$feedDelete.appendTo($deleteDiv);
$titleDiv.html(url);
$titleLink.appendTo($titleDiv);
// $titleDiv.html(url);
$feedPrefs.appendTo($prefsDiv);
$feedReload.appendTo($reloadDiv);
......@@ -190,6 +196,7 @@ MOB.feed = {
$panel = $dataStore.parent().parent().parent(),
$feed = $dataStore.parent().parent(),
$feedTitle = $feed.children().children('.feedTitle'),
$feedLink = $feedTitle.children('a'),
$feedBody = $feed.children().children('ul.feedBody'),
feedUrl = $dataStore.data('url'),
feedType = $dataStore.data('type'),
......@@ -262,8 +269,13 @@ MOB.feed = {
$feedBody.empty();
}).done(function(data) {
$feedTitle.text(data.feedTitle)
console.log('data.feedLink:', $feedTitle.text());
$feedLink.text(data.feedTitle)
.attr('href', data.feedLink)
.attr('title', (data.feedTitle || MOB.tr('Error')) + ' (' + feedUrl + ')');
// $feedTitle.text(data.feedTitle);
if (data.error) {
console.info('Pétrolette | bad Feed: (%s) error: [%s]', feedUrl, data.error);
......
......@@ -51,9 +51,11 @@ function getFeed (urlfeed, callback) {
return;
}
});
req.on ('error', function (res) {
console.log ('getFeed: Error read %s (%s) .', urlfeed, res);
});
feedparser.on ('readable', function () {
try {
var item = this.read ();
......@@ -66,7 +68,7 @@ function getFeed (urlfeed, callback) {
}
}).on ('end', function () {
var meta = this.meta;
callback ('Feed OK', feedItems, meta.title);
callback ('Feed OK', feedItems, meta.title, meta.link);
}).on ('error', function (err) {
// console.log ("getFeed: Error reading (%s) feed: %s.", urlfeed, err.message);
callback ('Bad feed');
......@@ -75,15 +77,16 @@ function getFeed (urlfeed, callback) {
router.get('/feed', function(req, res) {
getFeed(req.query.feedurl, function (err, feedItems, feedTitle) {
if (feedItems) {
res.send({
feedItems: feedItems,
feedTitle: feedTitle
});
} else {
res.send({error:err});
}
getFeed(req.query.feedurl, function (err, feedItems, feedTitle, feedLink) {
if (feedItems) {
res.send({
feedItems: feedItems,
feedLink: feedLink,
feedTitle: feedTitle
});
} else {
res.send({error:err});
}
});
});
......
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