Úprava souboru index.html
This commit is contained in:
parent
3f8c65c93c
commit
f674b7d463
1 changed files with 12 additions and 10 deletions
|
@ -104,31 +104,33 @@
|
|||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<div id="vystup"></div>
|
||||
<script>
|
||||
// Nahraďte touto URL adresou vašeho XML souboru
|
||||
// URL adresa vašeho RSS feedu
|
||||
const xmlUrl = 'https://code.nolog.cz/Nudista-Online.rss';
|
||||
|
||||
// Načtení XML souboru z URL
|
||||
fetch(xmlUrl)
|
||||
.then(response => response.text())
|
||||
.then(xmlString => {
|
||||
// Parsování XML (stejné jako předtím)
|
||||
// Parsování XML
|
||||
const parser = new DOMParser();
|
||||
const xmlDoc = parser.parseFromString(xmlString, 'application/xml');
|
||||
|
||||
// Zpracování dat z XML a zobrazení v tabulce (stejné jako předtím)
|
||||
const polozky = xmlDoc.getElementsByTagName('polozka');
|
||||
// Zpracování dat z RSS feedu
|
||||
const items = xmlDoc.querySelectorAll('item'); // Použijeme querySelectorAll pro výběr všech <item>
|
||||
|
||||
let vystupHtml = '<table>';
|
||||
vystupHtml += '<thead><tr><th>Název</th><th>Popis</th></tr></thead>';
|
||||
vystupHtml += '<thead><tr><th>Název</th><th>Popis</th><th>Odkaz</th></tr></thead>';
|
||||
vystupHtml += '<tbody>';
|
||||
|
||||
for (let i = 0; i < polozky.length; i++) {
|
||||
const nazev = polozky[i].getElementsByTagName('nazev')[0].textContent;
|
||||
const popis = polozky[i].getElementsByTagName('popis')[0].textContent;
|
||||
items.forEach(item => {
|
||||
const title = item.querySelector('title').textContent;
|
||||
const description = item.querySelector('description').textContent;
|
||||
const link = item.querySelector('link').textContent;
|
||||
|
||||
vystupHtml += `<tr><td>${nazev}</td><td>${popis}</td></tr>`;
|
||||
}
|
||||
vystupHtml += `<tr><td>${title}</td><td>${description}</td><td><a href="${link}" target="_blank">Otevřít</a></td></tr>`;
|
||||
});
|
||||
|
||||
vystupHtml += '</tbody></table>';
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue