Update to improve RSS

This commit is contained in:
William Moore 2023-06-14 04:26:11 -05:00
parent 73415a4a0d
commit dfd0f12a15
2 changed files with 12 additions and 7 deletions

View File

@ -1,6 +1,7 @@
<html>
<head>
<meta http-equiv="refresh" content="3600">
<script src="FONTAWESOME_SCRIPT_URL" crossorigin="anonymous"></script>
<script type="module" src="./js/RSS.js"></script>
</head>
<body>

View File

@ -41,7 +41,6 @@ export class RSS extends LitElement {
const result = await response.text();
const rss = (new DOMParser()).parseFromString(result.trim(), 'text/xml');
const channel = rss.getElementsByTagName('channel')[0] ?? null;
console.log(rss);
for (let channelI = 0; channelI < channel?.children?.length; channelI++) {
const channelChild = channel?.children?.item(channelI);
@ -98,12 +97,17 @@ export class RSS extends LitElement {
override render() {
return html`
<div class="gauge-body">
<div class="gauge-label">RSS Feed for ${this.rssTitle}${this.rssLink ? html`<a href="${this.rssLink}">link</a>` : ''}</div>
${this.rssItems?.length > 0
? html`
<div class="gauge-label">RSS Feed for ${this.rssTitle}${this.rssLink ? html` <a href="${this.rssLink}"><i class="fa-solid fa-link"></i></a>` : ''}</div>
${this.rssItems.map(rssItem => html`
<div>
<div>${rssItem.link ? html`<a href="${rssItem.link}">${rssItem.title}</a>` : rssItem.title}</div>
</div>
`)}
`
: html`<div class="gauge-label">There was no valid RSS feed found.</div>`
}
</div>
`;