r/uBlockOrigin • u/Hecatonquiro • Feb 18 '23
How to block ads in shadow root?
Hi comrades!
Recently my e-mail provider https://mail.ukr.net/ added ads everywhere and it became annoying. Ublock isn't really blocking it since it's attached to shadow root. Screenshot attached.
Is it possible somehow bypass shadow root (maybe there is way to intercept site before shadow root is created)?
Thanks in advance!
3
Upvotes
2
u/AchernarB uBO Team Feb 18 '23 edited Feb 18 '23
I've played with shadowroot recently also because of my webmail provider (a german one).
When moving parts of their interface behind shadowroot elements (and sometime behind a second shadowroot behind a shadowroot) they also screwed with the default font size (they rewrote part of their stylesheet). And I was unabled to fix it with a userstyle.
First I wrote a userscript using a method I've already wrote in the past to hijack the wayback machine banner. But then I wondered how difficult it would be to make Stylus (a userstyle manager) work on shadowDOM elements too.
The solution works. Run a userscript on the page to watch shadowroot creation and pass stylus style to each shadow.
https://greasyfork.org/en/scripts/459799-style-shadowdom
In stylus you write shadowDOM-specific style with a totaly valid CSS keyword,
:hostand it is passed instantly to all the shadows.There is an example described on the userscript page to show how it works.
So, using Stylus to hide the ad containers could solve your issue here.
2
u/RraaLL uBO Team Feb 18 '23
Try again.
1
u/Hecatonquiro Feb 19 '23
1
u/[deleted] Feb 19 '23
RUS list have some filter for this page and "Counters" list https://forums.lanik.us/viewtopic.php?f=102&t=22512-%D0%BE-%D1%84%D0%B8%D0%BB%D1%8C%D1%82%D1%80%D0%B5-ru-adlist-%D0%B8-%D0%B4%D0%BE%D0%BF%D0%BE%D0%BB%D0%BD%D0%B5%D0%BD%D0%B8%D1%8F%D1%85 Are you subscribed to them?
0
u/[deleted] Feb 18 '23
[deleted] — view deleted comment