Parse owner

This commit is contained in:
Hongbo Wu
2022-11-29 15:48:45 +08:00
parent f8e0efad05
commit 1fe86b6230

View File

@ -53,6 +53,7 @@ export class StackOverflowHandler extends ContentHandler {
const authors = element.querySelectorAll(`.post-signature`)
authors.forEach((author) => {
const isOwner = author.classList.contains('owner')
const name = author.querySelector(`.user-details a`)?.textContent
const link = author.querySelector(`.user-details a`)?.getAttribute('href')
const reputation = author.querySelector(`.reputation-score`)?.textContent
@ -67,6 +68,12 @@ export class StackOverflowHandler extends ContentHandler {
newAuthor.innerHTML = `<a href="${link}"><b>${name}</b></a> - ${reputation} reputation - ${
badges || 'no badge'
} - ${date}`
if (isOwner) {
const author = dom.createElement('span')
author.setAttribute('rel', 'author')
author.innerHTML = name
newAuthor.appendChild(author)
}
newAuthors.appendChild(newAuthor)
}
})