From 1fe86b6230ee3fefffc83f6fc21accf332d2b739 Mon Sep 17 00:00:00 2001 From: Hongbo Wu Date: Tue, 29 Nov 2022 15:48:45 +0800 Subject: [PATCH] Parse owner --- .../content-handler/src/websites/stack-overflow-handler.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/content-handler/src/websites/stack-overflow-handler.ts b/packages/content-handler/src/websites/stack-overflow-handler.ts index ecfe77029..384922e88 100644 --- a/packages/content-handler/src/websites/stack-overflow-handler.ts +++ b/packages/content-handler/src/websites/stack-overflow-handler.ts @@ -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 = `${name} - ${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) } })