Improve Mastodon feed

This commit is contained in:
Massive 2021-08-08 11:18:37 +02:00
parent 682c3de027
commit f31a429809
1 changed files with 6 additions and 8 deletions

View File

@ -269,7 +269,7 @@
<section class="section">
<p class="title">What's happening</p>
<p>Feed from my <a href="https://c.im/@massivebox">Mastodon profile</a></p>
<div id="mastodonfeed" style="overflow-x: hidden; overflow-y: auto; height: 50vh">
<div id="mastodonfeed" style="overflow-x: hidden; overflow-y: auto; height: 50vh; margin-top: 5px">
</div>
</section>
@ -279,8 +279,9 @@
let parser = new RSSParser();
parser.parseURL('https://c.im/@massivebox.rss', function(err, feed) {
if (err) throw err;
console.log(feed.title);
if (err) {
$("#mastodonfeed").html(`<p><span class="icon has-text-danger"><i class="fas fa-times"></i></span> Error parsing Mastodon RSS feed. Try refreshing the page.</p>`);
}
feed.items.forEach(function(entry) {
date = new Date(Date.parse(entry.isoDate));
html = `
@ -293,11 +294,8 @@
</figure>
<div class="media-content">
<div class="content">
<p>
<strong>MassiveBox</strong> <small><a href="https://c.im/@massivebox">massivebox@c.im</a></small> <small>`+date.getDate()+"/"+(date.getMonth()+1)+"/"+date.getFullYear()+`</small>
<br>
`+entry.contentSnippet+`
</p>
<p><strong>MassiveBox</strong> <small><a href="https://c.im/@massivebox">massivebox@c.im</a></small> <small>`+date.getDate()+"/"+(date.getMonth()+1)+"/"+date.getFullYear()+`</small></p>
`+entry.content+`
</div>
</div>
</article>