feat: Added a lot of new section rewrites
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
(() => {
|
||||
const container = document.querySelector('main#main #AjaxMainSection .section_guidepost_before .vc-articlebox');
|
||||
if (!container) return null;
|
||||
|
||||
const headerEl = container.querySelector('.header span');
|
||||
const sectionTitle = headerEl ? headerEl.textContent.trim() : null;
|
||||
|
||||
const articleNodes = container.querySelectorAll('.content.articles a.article');
|
||||
|
||||
const articles = Array.from(articleNodes).map(article => {
|
||||
const link = article.getAttribute('href');
|
||||
|
||||
const titleEl = article.querySelector('.title');
|
||||
const title = titleEl ? titleEl.textContent.trim() : null;
|
||||
|
||||
const dateEl = article.querySelector('.date');
|
||||
const date = dateEl ? dateEl.textContent.trim() : null;
|
||||
|
||||
const annotationEl = article.querySelector('.annotation');
|
||||
const annotation = annotationEl ? annotationEl.textContent.trim() : null;
|
||||
|
||||
const imgEl = article.querySelector('.img img');
|
||||
const imageSrc = imgEl ? (imgEl.getAttribute('data-src') || imgEl.getAttribute('src')) : null;
|
||||
const imageAlt = imgEl ? imgEl.getAttribute('alt') : null;
|
||||
|
||||
return {
|
||||
title,
|
||||
link,
|
||||
date,
|
||||
annotation,
|
||||
imageSrc,
|
||||
imageAlt
|
||||
};
|
||||
});
|
||||
|
||||
const moreBtn = container.querySelector('.footer a.moreBtn');
|
||||
const moreLink = moreBtn ? moreBtn.getAttribute('href') : null;
|
||||
|
||||
return {
|
||||
sectionTitle,
|
||||
articles,
|
||||
moreLink
|
||||
};
|
||||
})();
|
||||
Reference in New Issue
Block a user