Skip to content

Commit

Permalink
fix(Sort by recent): 🐛 Fix sort by recent selectors (#64)
Browse files Browse the repository at this point in the history
Co-authored-by: Valdo Ryu <valdo.ryu@wee-fin.com>
  • Loading branch information
valdoryu and Valdo Ryu authored Nov 20, 2024
1 parent c96bf09 commit 11a25da
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions content/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -342,20 +342,20 @@ function blockByKeywords(keywords, disablePostCount) {
}

// Toggle sort by recent

async function sortByRecent() {
const dropdownTrigger = (
await waitForSelector('li-icon[aria-label="Sort order dropdown button"]')
).parentElement.parentElement
const dropdownTrigger = await waitForSelector(
'button.full-width.artdeco-dropdown__trigger.artdeco-dropdown__trigger--placement-bottom'
)

const parent = dropdownTrigger.parentElement
if (dropdownTrigger.textContent.includes('Top')) {
dropdownTrigger.click()
const recentOption = await waitForSelectorScoped(
'ul > li:nth-child(2) > div',
parent
)
recentOption.click()
}

dropdownTrigger.click()

const recentOption = await waitForSelectorScoped(
'ul > li:nth-child(2) > div.artdeco-dropdown__item.artdeco-dropdown__item--is-dropdown',
parent
)
recentOption.click()
}

// Wait for selector implementation
Expand Down

0 comments on commit 11a25da

Please sign in to comment.