Eliminate Ambiguous Characters
Added a clean, ASCII-only version of the script section.
This commit is contained in:
parent
3aff306893
commit
e1ffa837da
|
@ -72,27 +72,28 @@
|
||||||
feeds.forEach(feed => {
|
feeds.forEach(feed => {
|
||||||
const section = document.createElement('div');
|
const section = document.createElement('div');
|
||||||
section.className = 'feed-section';
|
section.className = 'feed-section';
|
||||||
section.innerHTML = `<h2>${feed.title}</h2><ul class="feed-list" id="list-${feed.title.replace(/\s+/g, '')}"><li>Loading...</li></ul>`;
|
section.innerHTML = '<h2>' + feed.title + '</h2><ul class="feed-list" id="list-' + feed.title.replace(/\s+/g, '') + '"><li>Loading...</li></ul>';
|
||||||
container.appendChild(section);
|
container.appendChild(section);
|
||||||
|
|
||||||
fetch(`https://api.rss2json.com/v1/api.json?rss_url=${encodeURIComponent(feed.url)}`)
|
fetch('https://api.rss2json.com/v1/api.json?rss_url=' + encodeURIComponent(feed.url))
|
||||||
.then(res => res.json())
|
.then(res => res.json())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
const list = document.getElementById(`list-${feed.title.replace(/\s+/g, '')}`);
|
const list = document.getElementById('list-' + feed.title.replace(/\s+/g, ''));
|
||||||
list.innerHTML = '';
|
list.innerHTML = '';
|
||||||
data.items.slice(0, 5).forEach(item => {
|
data.items.slice(0, 5).forEach(item => {
|
||||||
const li = document.createElement('li');
|
const li = document.createElement('li');
|
||||||
li.innerHTML = `<a href="${item.link}" target="_blank">${item.title}</a>`;
|
li.innerHTML = '<a href="' + item.link + '" target="_blank">' + item.title + '</a>';
|
||||||
list.appendChild(li);
|
list.appendChild(li);
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
const list = document.getElementById(`list-${feed.title.replace(/\s+/g, '')}`);
|
const list = document.getElementById('list-' + feed.title.replace(/\s+/g, ''));
|
||||||
list.innerHTML = `<li class="error">Failed to load feed.</li>`;
|
list.innerHTML = '<li class="error">Failed to load feed.</li>';
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Reference in New Issue