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"> <section class="section">
<p class="title">What's happening</p> <p class="title">What's happening</p>
<p>Feed from my <a href="https://c.im/@massivebox">Mastodon profile</a></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> </div>
</section> </section>
@ -279,8 +279,9 @@
let parser = new RSSParser(); let parser = new RSSParser();
parser.parseURL('https://c.im/@massivebox.rss', function(err, feed) { parser.parseURL('https://c.im/@massivebox.rss', function(err, feed) {
if (err) throw err; if (err) {
console.log(feed.title); $("#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) { feed.items.forEach(function(entry) {
date = new Date(Date.parse(entry.isoDate)); date = new Date(Date.parse(entry.isoDate));
html = ` html = `
@ -293,11 +294,8 @@
</figure> </figure>
<div class="media-content"> <div class="media-content">
<div class="content"> <div class="content">
<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>
<strong>MassiveBox</strong> <small><a href="https://c.im/@massivebox">massivebox@c.im</a></small> <small>`+date.getDate()+"/"+(date.getMonth()+1)+"/"+date.getFullYear()+`</small> `+entry.content+`
<br>
`+entry.contentSnippet+`
</p>
</div> </div>
</div> </div>
</article> </article>