(list)
| 783 | } |
| 784 | |
| 785 | function renderFeatureCards(list) { |
| 786 | Array.from(list.children).forEach(function (item) { |
| 787 | if (item.tagName !== 'LI' || item.classList.contains('home-feature-item')) { |
| 788 | return; |
| 789 | } |
| 790 | |
| 791 | var link = item.querySelector('a[href]'); |
| 792 | |
| 793 | if (!link) { |
| 794 | return; |
| 795 | } |
| 796 | |
| 797 | var summaryNode = Array.from(item.querySelectorAll('p')).find(function (paragraph) { |
| 798 | return !paragraph.querySelector('a[href]'); |
| 799 | }); |
| 800 | var href = link.getAttribute('href') || '#/'; |
| 801 | var title = link.textContent.trim(); |
| 802 | var summary = summaryNode ? summaryNode.textContent.trim() : ''; |
| 803 | var card = document.createElement('a'); |
| 804 | var media = document.createElement('span'); |
| 805 | var image = document.createElement('img'); |
| 806 | var body = document.createElement('span'); |
| 807 | var titleNode = document.createElement('span'); |
| 808 | var summaryNodeNew = document.createElement('span'); |
| 809 | |
| 810 | item.className = 'home-feature-item'; |
| 811 | card.className = 'home-feature-card'; |
| 812 | card.href = href; |
| 813 | media.className = 'home-feature-card-media'; |
| 814 | image.alt = title; |
| 815 | image.loading = 'lazy'; |
| 816 | image.src = createGeneratedCover(title, summary || 'cxuan-ai-labs'); |
| 817 | body.className = 'home-feature-card-body'; |
| 818 | titleNode.className = 'home-feature-card-title'; |
| 819 | summaryNodeNew.className = 'home-feature-card-summary'; |
| 820 | titleNode.textContent = title; |
| 821 | summaryNodeNew.textContent = summary; |
| 822 | |
| 823 | media.appendChild(image); |
| 824 | body.appendChild(titleNode); |
| 825 | body.appendChild(summaryNodeNew); |
| 826 | card.appendChild(media); |
| 827 | card.appendChild(body); |
| 828 | item.textContent = ''; |
| 829 | item.appendChild(card); |
| 830 | }); |
| 831 | } |
| 832 | |
| 833 | function toArticleItem(listItem) { |
| 834 | var link = listItem.querySelector('a[href]'); |
no test coverage detected