jordwest / news-feed-eradicator

A browser extension that deletes your news feed and replaces it with a nice quote
MIT License
1.16k stars 280 forks source link

Eradicate Twitter public feed as well when not logged in #262

Open weeksling opened 1 year ago

weeksling commented 1 year ago

The new public Twtitter feed is not blocked by the extension. This feed is particularly egregious, so it would be great if it could be blocked as well.

Screen Shot 2023-04-22 at 12 10 39 PM

I found that the main difference is that the document querySelector for twitter doesn't include the public feed. The test-id works, but there is not 4th child. I was able to select the public feed by changing it to :nth-child(3) from this:

document.querySelector(
    'div[data-testid="primaryColumn"] > div:last-child > div:nth-child(4)'
);

to this:

document.querySelector(
    'div[data-testid="primaryColumn"] > div:last-child > div:nth-child(3)'
);

I would add a pull request, but want to confirm what I should do to determine if the user is logged in or not so that it doesn't break the previous logged in version. Would be acceptable for me to find a login element to query for to decide isUserLoggedOut, or alternatively, would it be alright to just add the second query as a conditional after the first one and let it proceed if either exists?

Any advice is helpful. I'll take a look later how to test changes locally and see if I can implement this myself for a pr.