MCPcopy Create free account
hub / github.com/crisxuan/bestJavaer / collectHomeUpdateArticles

Function collectHomeUpdateArticles

assets/article-cards.js:637–652  ·  view source on GitHub ↗
(section)

Source from the content-addressed store, hash-verified

635 }
636
637 function collectHomeUpdateArticles(section) {
638 var updateHeadings = ['最近更新', 'Recent Updates'];
639 var updateList = Array.from(section.querySelectorAll('h2')).reduce(function (found, heading) {
640 if (found || updateHeadings.indexOf(heading.textContent.trim()) === -1) {
641 return found;
642 }
643
644 return heading.nextElementSibling && heading.nextElementSibling.tagName === 'UL' ? heading.nextElementSibling : null;
645 }, null);
646
647 if (!updateList) {
648 return [];
649 }
650
651 return Array.from(updateList.children).map(toHomeUpdateItem).filter(Boolean);
652 }
653
654 function toHomeUpdateItem(listItem) {
655 if (!listItem || listItem.tagName !== 'LI') {

Callers 1

decorateHomePageFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected