Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

[Feature request] Add an option to hide sponsored posts / ads #94

Closed
robrobinbin opened this issue Dec 26, 2015 · 15 comments
Closed

[Feature request] Add an option to hide sponsored posts / ads #94

robrobinbin opened this issue Dec 26, 2015 · 15 comments

Comments

@robrobinbin
Copy link

No description provided.

@juk47ht
Copy link

juk47ht commented Dec 28, 2015

Seconded.

@robrobinbin
Copy link
Author

I don't know much about android development, but I guess the "dark theme" and "fixed blue bar" options are implemented by injecting CSS into the page. I've looked in the EasyList block list and found these 8 element hiding rules for m.facebook.com

m.facebook.com###m_newsfeed_stream article[data-ft*="\"ei\":\""]
m.facebook.com,touch.facebook.com##.aymlCoverFlow
m.facebook.com,touch.facebook.com##.aymlNewCoverFlow[data-ft*="\"is_sponsored\":\"1\""]
m.facebook.com,touch.facebook.com##.pyml
m.facebook.com,touch.facebook.com##.storyStream > ._6t2[data-sigil="marea"] 
m.facebook.com,touch.facebook.com##.storyStream > .fullwidth._539p 
m.facebook.com,touch.facebook.com##.storyStream > article[id^="u_"]._676 
m.facebook.com,touch.facebook.com##.storyStream > article[id^="u_"].storyAggregation

If I'm not mistaken this corresponds to injecting the following CSS into the m.facebook.com webpage

#m_newsfeed_stream article[data-ft*="\"ei\":\""],
.aymlCoverFlow,
.aymlNewCoverFlow[data-ft*="\"is_sponsored\":\"1\""],
.pyml,
.storyStream > ._6t2[data-sigil="marea"],
.storyStream > .fullwidth._539p,
.storyStream > article[id^="u_"]._676,
.storyStream > article[id^="u_"].storyAggregation {
    display: none !important; 
   /*I don't know whether the !important is needed*/
}

I've tested this using Stylish on the desktop and all the ads on m.facebook.com were gone (tbh only the fist selector seemed to do something during my short test)

I think implementing this feature can be quite easy, the only possible drawback is that these rules need to be kept up to date if facebook updates its site.

@juk47ht
Copy link

juk47ht commented Jan 1, 2016

Cheers. Will try these with AdAway and update this thread for reference (or for a workaround if not possible to block the sponsored posts in Face Slim).

@robrobinbin
Copy link
Author

I don't think AdAway can do this, I think AdAway only blocks domains (eg. Imagine facebook stores all it's ads on something like FacebookAdServer.com and Facebook.com loads ads from there. AdAway can block all requests to FacebookAdServer system wide, so you wont see ads on facebook) but sponsored posts are directly embedded in the web page (they come from the same domain than normal facebook posts), thus these ads can't be stopped system wide (without blocking facebook completely), they need to be hidden by the application themselves (using something like CSS).
I could be wrong about this, and if it does work with AdAway somehow I'll be very happy!

@indywidualny
Copy link
Owner

It can be done for sure. I can modify css. Just give me some time. Busy
days now.

pt., 1.01.2016, 10:51 robrobinbin użytkownik [email protected]
napisał:

I don't think AdAway can do this, I think AdAway only blocks domains (eg.
Imagine facebook stores all it's ads on something like FacebookAdServer.com
and Facebook.com loads ads from there. AdAway can block all requests to
FacebookAdServer system wide, so you wont see ads on facebook) but
sponsored posts are directly embedded in the web page (they come from the
same domain than normal facebook posts), thus these ads can't be stopped
system wide (without blocking facebook completely), they need to be hidden
by the application themselves (using something like CSS).
I could be wrong about this, and if it does work with AdAway somehow I'll
be very happy!


Reply to this email directly or view it on GitHub
#94 (comment)
.

@indywidualny
Copy link
Owner

I'm afraid it only works for the first section. Dynamically loaded items cannot be styled. But... most of ads are at the top of the page. Am I right?

I hope it works. Didn't tested yet.

@indywidualny
Copy link
Owner

Is everything ok? Can I close it now?
My news feed has actually no ads so I cannot see the difference.

@robrobinbin
Copy link
Author

I installed FaceSlim/app/app-release.apk yesterday and enable the option, but I'm still getting ads :(

screenshot_20160112-204116
screenshot_20160112-204236
screenshot_20160112-204134

@indywidualny
Copy link
Owner

Not good :(

I think ads cannot be hidden for a dynamically loaded content. So in fact it only disables some of the sponsored posts. Only ads at the top of the page should be gone.

Are there any ads for a statically loaded content (e.g. top of the page, after refresh)?

@robrobinbin
Copy link
Author

I had to scroll down quite a bit to find an ad, but I opened m.facebook.com in a normal (non ad blocked) browser and I had to scroll down just as far (there weren't simple any sponsored posts earlier). I think yesterday I had an ad higher up, but I'm not sure. Why is it that dynamically loaded content can't be hidden? When you enable night mode dynamically loaded comments are also styled. Sadly I don't know much about android development and I don't have the right IDE's installed. When you change display: non !important to background-color: red !important do you get any ads with a red background? Are only the ads at the top red?

@indywidualny
Copy link
Owner

I will test it (red backgrounds).
A good point about a dynamically loaded content - it should work too.

wt., 12.01.2016, 21:27 robrobinbin użytkownik [email protected]
napisał:

I had to scroll down quite a bit to find an ad, but I opened
m.facebook.com in a normal (non ad blocked) browser and I had to scroll
down just as far (there weren't simple any sponsored posts earlier). I
think yesterday I had an ad higher up, but I'm not sure. Why is it that
dynamically loaded content can't be hidden? When you enable night mode
dynamically loaded comments are also styled. Sadly I don't know much about
android development and I don't have the right IDE's installed. When you
change display: non !important to background-color: red !important do you
get any ads with a red background? Are only the ads at the top red?


Reply to this email directly or view it on GitHub
#94 (comment)
.

@sedrubal
Copy link

sedrubal commented Feb 2, 2016

Can you also try to hide "Install fb messenger!!!1eleven" banners? :D

@indywidualny
Copy link
Owner

Sure. I will hide it by default today.

@juk47ht
Copy link

juk47ht commented Mar 1, 2016

Can we close this? Thanks to your work, it's been a month I haven't see any ads on Face Slim.

@indywidualny
Copy link
Owner

Yeah. I wanted to make sure it's working. Great! :)

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

No branches or pull requests

4 participants