mirror of
https://github.com/aljazceru/awesome-nostr.git
synced 2025-02-23 07:09:00 +00:00
missing descritptions fixed
This commit is contained in:
parent
f3289d713a
commit
d36f1e17e7
31
script.js
31
script.js
@ -932,37 +932,24 @@ function displaySection(sectionName, sections) {
|
|||||||
// Display section content
|
// Display section content
|
||||||
sections[sectionName].forEach(item => {
|
sections[sectionName].forEach(item => {
|
||||||
if (item.type === 'content') {
|
if (item.type === 'content') {
|
||||||
|
// Regular markdown content
|
||||||
const contentDiv = document.createElement('div');
|
const contentDiv = document.createElement('div');
|
||||||
contentDiv.className = 'markdown-content';
|
contentDiv.className = 'markdown-content';
|
||||||
contentDiv.innerHTML = item.element.outerHTML;
|
contentDiv.innerHTML = item.element.outerHTML;
|
||||||
container.appendChild(contentDiv);
|
container.appendChild(contentDiv);
|
||||||
} else if (item.type === 'resources') {
|
} else if (item.type === 'resources') {
|
||||||
// Process both top-level and nested items
|
// Resource list
|
||||||
processResourceList(item.element, container);
|
Array.from(item.element.children).forEach(li => {
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// New helper function to process resource lists recursively
|
|
||||||
function processResourceList(ulElement, container) {
|
|
||||||
Array.from(ulElement.children).forEach(li => {
|
|
||||||
// Process the main item if it has a link
|
|
||||||
if (li.querySelector(':scope > a')) {
|
|
||||||
const card = createResourceCard({
|
const card = createResourceCard({
|
||||||
name: li.querySelector(':scope > a')?.textContent || '',
|
name: li.querySelector('a')?.textContent || '',
|
||||||
link: li.querySelector(':scope > a')?.href || '',
|
link: li.querySelector('a')?.href || '',
|
||||||
description: li.childNodes[0].textContent.split('- ')[1]?.trim() || '',
|
description: li.textContent.split('- ')[1]?.trim() || '',
|
||||||
stars: li.querySelector(':scope > img[alt="stars"]')
|
stars: li.querySelector('img[alt="stars"]')
|
||||||
? parseInt(li.querySelector(':scope > img[alt="stars"]').src.match(/stars\/(\d+)/)?.[1]) || 0
|
? parseInt(li.querySelector('img[alt="stars"]').src.match(/stars\/(\d+)/)?.[1]) || 0
|
||||||
: 0
|
: 0
|
||||||
});
|
});
|
||||||
container.appendChild(card);
|
container.appendChild(card);
|
||||||
}
|
});
|
||||||
|
|
||||||
// Process nested items if they exist
|
|
||||||
const nestedUl = li.querySelector(':scope > ul');
|
|
||||||
if (nestedUl) {
|
|
||||||
processResourceList(nestedUl, container);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user