Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eradicate story at Facebook #216

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

EasonC13
Copy link
Contributor

@EasonC13 EasonC13 commented Aug 31, 2022

As the image shows, I add some codes to allow the news-feed-eradicator to remove story feeds from friends at Facebook. That is very distracting when I just want to go to Facebook to view notifications.

P.S. My PR may require some extra work to make it more TypeScript, as I don't know TypeScript very well, I simply use // @ts-ignore to ignore type errors.

image

@redLeR1st
Copy link

Big thanks for you @EasonC13!
Now please can someone deploy this? 😄

Comment on lines +47 to +53
let story = document.querySelector('[role=region]')
if (story == null) {
return
}

// Hidden all story feeds
for (let i = 0; i < story.children[1].children[0].children.length; i++) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be a better idea to target the stories container with div[aria-label='Stories'] selector instead. That would remove the need for the for loop

if (i == 0) {
continue
}
let child = story.children[1].children[0].children[i]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can typecast this as HTMLElement to make typescript shut up about style not being property of Element
let child = story.children[1].children[0].children[i] as HTMLElement;

let child = story.children[1].children[0].children[i]
// Make others' story invisible and unclickable
// @ts-ignore
child.style.opacity = 0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

opacity value should be a string so = '0'

@nzawirski
Copy link
Contributor

From what i see the stories are already being hidden using css by targeting their container with div[aria-label='Stories']. This has been added in 4625cd2. I'm not sure why it isn't working for you, can you check if you are using the latest version of the extension?

Your solution is ok tho. I added some comments for the curious. But since this issue is already taken care of in css, i'm not sure if there is a need to merge this code.

@pawel-tomkiel
Copy link
Contributor

From what i see the stories are already being hidden using css by targeting their container with div[aria-label='Stories']. This has been added in 4625cd2. I'm not sure why it isn't working for you, can you check if you are using the latest version of the extension?

@nzawirski - aria-label is translated, and as I use Facebook in Polish it's "Relacje" here:
image

so I'm afraid not really feasible for selecting elements by it multilang 🥲

Would love to see it fixed and deployed though!

@nzawirski
Copy link
Contributor

@pawel-tomkiel oh wow, thanks for pointing it out, i totally didn't think that it could be the issue. In that case the way Eason solved it is better.

I'm only thinking that maybe it would be better to target it in css instead of js, the same way other containers are targeted 🤔 I'll try to come up with a solution to this this evening.

@EasonC13
Copy link
Contributor Author

Thank you.
It might be already outdated as facebook keep iterating its website.
Please check it does work before you merge it.

@nzawirski
Copy link
Contributor

Ok so i messed around a bit and found that targeting it in js does not work consistently. Although targeting it in css is a pain as well.

I submitted a new PR #256 with updated solution. @EasonC13 @pawel-tomkiel i tagged you as co-authors since it was your work that helped create this solution. Ultimately it's up to @jordwest to review and merge these changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants