Skip to content

Commit

Permalink
fix: followers hidden when hide who to follow is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
xmile1 committed Nov 26, 2023
1 parent 101452d commit 5930ed9
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/contentScripts/scripts/tweetProcessor/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ function observeTweets(element: Element, options: any): void {
const observer = new MutationObserver((mutations: MutationRecord[]) => {
mutations.forEach((mutation: MutationRecord) => {
mutation.addedNodes.forEach((node: Node) => {
if (
node.nodeType === Node.ELEMENT_NODE
&& (node as Element).matches('[data-testid="cellInnerDiv"]')
)
const isInTimelineView = (node as Element).closest('[aria-label="Timeline: Your Home Timeline"]')
const isTweetSection = (node as Element).matches('[data-testid="cellInnerDiv"]')

if (node.nodeType === Node.ELEMENT_NODE && isTweetSection && isInTimelineView)
processTweet(node as HTMLElement, options)
})
})
Expand All @@ -30,9 +30,7 @@ function observeTweets(element: Element, options: any): void {
observer.observe(element, { childList: true, subtree: true })
}

export async function initializeTweetObserver(
options: any,
): Promise<void> {
export async function initializeTweetObserver(options: any): Promise<void> {
const tweetsContainer = await getTweetsContainer()
tweetsContainer
.querySelectorAll('[data-testid="cellInnerDiv"]')
Expand Down

0 comments on commit 5930ed9

Please sign in to comment.