Skip to content

Commit

Permalink
fix: correctly detect answers when cv-pls generator is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
double-beep authored May 22, 2024
1 parent 8189ffe commit c178a72
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions src/UserscriptTools/sotools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}
Expand Down

0 comments on commit c178a72

Please sign in to comment.