Skip to content

Loading…

How to whitelist embedded tweets? #497

Closed
michaelstepner opened this Issue · 11 comments

4 participants

@michaelstepner

Hello, I've noticed since switching to uBlock that tweets embedded into a page using a Twitter widget are no longer visible. For example, this page has an embedded tweet from @BillSimmons: http://fivethirtyeight.com/datalab/peyton-manning-isnt-finished/

It's pretty common for news organizations and blogs to embed tweets within articles for context, and I'd love to whitelist these elements. I've figured out that the blocking is coming from "Fanboy’s Social Blocking List‎", but I can't figure out how to add a rule in uBlock that whitelists Twitter widgets. (My goal is not to fully disable "Fanboy's Social Blocking List".)

I've tried referring to the ABP filter rules and adding whitelist elements to the "My Filters" text box in the uBlock config, but I'm not getting it right. Any guidance is appreciated.

@gorhill

Just un-select "Fanboy Social Blocking" filter list if you do not want social widgets to be blocked/removed.

Ok sorry, read too quick, I had not seen you want to keep Fanboy Social. Let me look into this.

@gorhill gorhill closed this
@gorhill gorhill reopened this
@gorhill

This works:

fivethirtyeight.com#@#.embed-twitter

Ref. ABP filter syntax.

Edit: Did you mean you want to whitelist .embed-twitter globally, for all domains?

@michaelstepner

Thanks gorhill, that works! For others' reference (or your comment), I wanted to whitelist twitter embeds on all sites, not just fivethirtyeight.com. I tried:

#@#.embed-twitter

but that doesn't successfully whitelist any sites. I read the ABP filter syntax and couldn't figure out how to do an all-domain whitelist. Absent that, the I've settled for this hack:

.com,.org,.net,.edu,.gov,.uk,.ca#@#.embed-twitter

Which does work for all sites with those TLDs. This should whitelist twitter embeds for almost all websites I visit.

@gorhill

Yes, uBlock does not currently support global whitelist cosmetic filters. I left this out because I could not find one single instance in any of the filter lists. I could support it.

Your solution is not "hacky", I think it's all fine -- though you don't need to use the leading dot on each TLD. I actually prefer this workaround rather than introduce some kind of overhead to support global whitelist cosmetic filter which cost would be incurred by everybody rather than just those interested in that kind of filter.

Edit: Well I looked at the code, and really I don't see any problem supporting there, the overhead mentioned above is really a non-issue. I will fix this.

@michaelstepner

Sounds good! I understand and respect the decision not to support global whitelist cosmetic filters.

I do think this illustrates a clear use case for them. I'd like to always whitelist twitter embeds if I could. By listing TLDs one-by-one I will still occasionally encounter a website on a less common TLD where I've failed to whitelist the embedded tweets.
(For instance: I've visited some .fr websites in the past week to read about Charlie Hebdo.)

But clearly global whitelist cosmetic filters are not commonly used, and I defer to your judgement on issue of overhead for many / benefits for few.

Thank you for your helpful support, and your excellent program.

@gorhill gorhill reopened this
@gorhill

I changed my mind above after looking at the code.

@Snapy

I'm surprised dynamic filtering hasn't been mentioned. I know it's for advanced users but you can more easily allow an element and reload the page and you don' need to have knowledge on filter syntax. Whitelisting platform.twitter.comshould allow embed tweets. I don't know if it's the kind of solution that could satisfy you @michaelstepner

@CODYQX4
@gorhill

Dynamic filtering applies only to network requests, not DOM elements.

@gorhill gorhill added a commit that closed this issue
@gorhill gorhill this fixes #497 57274ac
@gorhill gorhill closed this in 57274ac
@gorhill

For the record, I could find only 11 instances of generic exception filters in all the filter lists packaged with uBlock:

/raw.githubusercontent.com/reek/anti-adblock-killer/master/anti-adblock-killer-filters.txt:75:#@##div-gpt-ad-1-0
/raw.githubusercontent.com/reek/anti-adblock-killer/master/anti-adblock-killer-filters.txt:82:#@##sponsored-ad
/easylist-downloads.adblockplus.org/liste_fr.txt:3762:#@##AdArea
/easylist-downloads.adblockplus.org/liste_fr.txt:3763:#@##banner
/easylist-downloads.adblockplus.org/liste_fr.txt:3768:#@##ad_ad
/easylist-downloads.adblockplus.org/liste_fr.txt:3769:#@##ad_link
/easylist-downloads.adblockplus.org/liste_fr.txt:4292:#@##bannerAdContainer1_1
/easylist-downloads.adblockplus.org/liste_fr.txt:4293:#@##bannerAdFrame
/easylist-downloads.adblockplus.org/liste_fr.txt:4294:#@##bannerGoogle
/easylist-downloads.adblockplus.org/liste_fr.txt:4295:#@##block-ad_cube-0
/easylist-downloads.adblockplus.org/liste_fr.txt:4296:#@##blox-big-ad-bottom
@michaelstepner

Well I, for one, really appreciate your work on this (and μBlock more broadly). Thanks gorhill!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.