@puniko
Is your instances #rss configured differently somehow ?
This code works with other instances, but refuses to work with mk.absturztau.be
_____
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css">
<link rel="stylesheet" href="./style.css">
<body>
<!-- partial:index.partial.html -->
<!-- partial -->
<script>
const userFeed = 'https://mk.absturztau.be/@aoikurayami.rss';
const wrapper = document.body;
const tootHTML = (description, date, url) => `
<article>
<a href="${url}">?</a> | <time>${date}</time>____________
<div>${description}</div>
</article>`;
const formatToots = (domContent, container) => {
[...domContent.querySelectorAll('item')].map(item => {
const $toot = el => item.querySelector(el).textContent;
const description = $toot('description')
const url = $toot('guid')
const date = $toot('pubDate')
container.innerHTML = container.innerHTML + tootHTML(description, date, url)
});
};
const parser = new DOMParser();
fetch(userFeed)
.then(response => {
if (response.status >= 400) {
return <p>No toots available at the moment</p>
}
return response.text();
})
.then(response => formatToots(parser.parseFromString(response, "application/xml"), wrapper));
</script>
</body>
<div id="myTimeline" class="mastodon-timeline mastodon-timeline-light"></div>
</div>
GNU social JP is a social network, courtesy of GNU social JP管理人. It runs on GNU social, version 2.0.2-dev, available under the GNU Affero General Public License.
All GNU social JP content and data are available under the Creative Commons Attribution 3.0 license.