File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -14,10 +14,10 @@ function observeTweets(element: Element, options: any): void {
14
14
const observer = new MutationObserver ( ( mutations : MutationRecord [ ] ) => {
15
15
mutations . forEach ( ( mutation : MutationRecord ) => {
16
16
mutation . addedNodes . forEach ( ( node : Node ) => {
17
- if (
18
- node . nodeType === Node . ELEMENT_NODE
19
- && ( node as Element ) . matches ( '[data-testid="cellInnerDiv"]' )
20
- )
17
+ const isInTimelineView = ( node as Element ) . closest ( '[aria-label="Timeline: Your Home Timeline"]' )
18
+ const isTweetSection = ( node as Element ) . matches ( '[data-testid="cellInnerDiv"]' )
19
+
20
+ if ( node . nodeType === Node . ELEMENT_NODE && isTweetSection && isInTimelineView )
21
21
processTweet ( node as HTMLElement , options )
22
22
} )
23
23
} )
@@ -30,9 +30,7 @@ function observeTweets(element: Element, options: any): void {
30
30
observer . observe ( element , { childList : true , subtree : true } )
31
31
}
32
32
33
- export async function initializeTweetObserver (
34
- options : any ,
35
- ) : Promise < void > {
33
+ export async function initializeTweetObserver ( options : any ) : Promise < void > {
36
34
const tweetsContainer = await getTweetsContainer ( )
37
35
tweetsContainer
38
36
. querySelectorAll ( '[data-testid="cellInnerDiv"]' )
You can’t perform that action at this time.
0 commit comments