From c178a72f5cd52abd276d1265cbb5a8de81f83b6b Mon Sep 17 00:00:00 2001 From: double beep <38133098+double-beep@users.noreply.github.com> Date: Wed, 22 May 2024 17:31:21 +0000 Subject: [PATCH] fix: correctly detect answers when cv-pls generator is enabled --- src/UserscriptTools/sotools.ts | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/UserscriptTools/sotools.ts b/src/UserscriptTools/sotools.ts index 201b085..bd1976d 100644 --- a/src/UserscriptTools/sotools.ts +++ b/src/UserscriptTools/sotools.ts @@ -66,13 +66,8 @@ export function getPage(): Pages | '' { } function getPostType(element: HTMLElement): PostType { - // Consistency at its finest: - // for each results in the /search page: - // - if it's a question, anchor will have the s-link class - // - if it's an answer, anchor will have the answer-hyperlink class - // (ask SE why) return element.classList.contains('question') - || element.querySelector('.question-hyperlink, .s-link') + || element.id.startsWith('question') ? 'Question' : 'Answer'; }