File tree Expand file tree Collapse file tree 1 file changed +3
-8
lines changed
Expand file tree Collapse file tree 1 file changed +3
-8
lines changed Original file line number Diff line number Diff line change 1- import { Timeline , Tweet } from "twi-ext" ;
1+ import { Timeline , type Tweet } from "twi-ext" ;
22
33// eslint-disable-next-line max-statements
44const onNewTweet = ( tweet : Tweet ) : void => {
55 const tweetElement = tweet . element ;
66 const viewCountWithIcon = tweetElement . querySelector < HTMLAnchorElement > ( "[role='group'] a[href$='analytics']" ) ;
7- if ( viewCountWithIcon && viewCountWithIcon . parentElement ) {
7+ if ( viewCountWithIcon ? .parentElement ) {
88 /*
99 * Measures against incompatibility with "Minimal Theme for Twitter" or other extensions.
1010 * See [#7](https://github.com/Robot-Inventor/hide-view-count/issues/7)
@@ -14,12 +14,7 @@ const onNewTweet = (tweet: Tweet): void => {
1414 }
1515
1616 const time = document . querySelector < HTMLElement > ( `a[aria-describedby] time` ) ;
17- if (
18- time &&
19- time . parentElement &&
20- time . parentElement . parentElement &&
21- time . parentElement . parentElement . parentElement
22- ) {
17+ if ( time ?. parentElement ?. parentElement ?. parentElement ) {
2318 const timeAndViewCountOuter = time . parentElement . parentElement . parentElement ;
2419 const targets = timeAndViewCountOuter . querySelectorAll < HTMLElement > ( "div ~ *" ) ;
2520 for ( const target of targets ) {
You can’t perform that action at this time.
0 commit comments