[feature req.] Inline CSS styles

Everything about using Adblock Plus on Mozilla Firefox, Thunderbird and SeaMonkey

[feature req.] Inline CSS styles

Postby Lain_13 » Fri Oct 05, 2012 12:12 am

Hi, I already talked about this thing with Wladimir Palant in emails but we didn't came to conclusion. So, I would like to talk about this feature here with all active users and subscription maintainers.

I've encountered situation on site fs.ua when they integrated an advertisement image into their main stylesheet. Simple blocking of this stylesheet renders site broken. Furthermore there are were no way to hide this image. It was applied as a background to one of the root elements and hiding it hid all the other content of the site. Of course it's possible to block specific image but it's not effective approach.

Also on the same site I've encountered situation when blocking ads limited functionality of the site. Thye have online video player and there are a couple of drop-down lists under the video stream. Part of these controls (that which are on the left) doesn't show up when block with advertisements under the player is blocked or hidden. They supposed to be open above the advertisements block but when it is blocked bottom part of the div around videoplayer cuts these controls.

Also on the site kinopoisk.ru there is no effective way to block branding (they showing ads there from time to time) because they changing color of the background and often when you block background image menu becomes invisible (either white on white or black on black). Users complain about both and leaving ads unblocked seems a better solution to me rather than breaking functionality.

Also there are cases when I would like to hide specific empty block on the site (usually in the header) but it appears impossible to hide because it isn't an object on the page but rather 'margin' or 'padding' border applied as style to another object on the page which I do not want to hide. Examples: http://www.bigmir.net, http://www.timeout.ru

Simple hiding doesn't work and useless in all these cases. :(
I think I'm not alone with such problems.

So, here is my idea.
I propose to add ability to define inline CSS styles which have to be applied to the CSS selector. It have to be defined right after the selector in the curly braces.
Here is example of such rule: fs.ua##.l-body-branding {background-image:none!important}
So, we still using standard technologies provided by the browser and doesn't break compatibility (old versions of Adblock will treat this as blocking rule which will never block anything).
Also I think this will be a great addition to the motto "Adblock can do more than block ads" because users will be able to use this functionality not only to hide ads which is not possible to hide using current functionality but also they will be able to use it like lightweight replacement for Stylish extensions. This feature will never be as easy to use as Stylish but it will allow to define and apply simple styles to sites and browser itself without using any additional extensions. Subscriptions like my bitblock and fanboy's annoyance list may profit from this feature as well.

Wladimir found following problems with this solution (quote from his email):
That would be fairly geeky functionality - we are looking into making the extension more usable for mainstream users. So replacing Stylish is definitely a non-goal for Adblock Plus.

If defining full CSS styles is required to block ads then this is something to consider. However, there are significant issues with this solution:

a) There are tools to assist creation of such rules and these tools most likely cannot be created at all.
b) The likeliness of people breaking element hiding by invalid CSS rules will increase significantly (this is related to a).
c) This will give a lot more power to filter list authors - e.g. CSS allows adding text to elements (content injection) or using images (tracking).

So this isn't really something that I want to add to Adblock Plus. The question is whether the ads in your examples can be blocked by other means and whether not blocking them is a big issue.

Yes, it's geeky feature. Only geeks will be able to use it properly but current CSS Selectors based hiding rules is geeky as well and only geeks can use them properly anyway. Probably a bit less geeky geeks but it doesn't really matter.

a) There is no point to implement tools to write such complex hiding rules. Without knowledge how things works such rules will be done wrong anyway and with knowledge it's just not important and users will be able to write them without additional tools (as I sometimes do). There are no functionality to use '~' instead of '+*+*+*+' or to use pseudo-class :not() when it's needed in the Element Hiding Helper but I think it's ok. For instance VLC player have two preferences interfaces. One simplified for average users and one complex for total geeks... and I still prefer to use mplayer with configuration in the text file because geeky complex interface of preferences in the VLC are just not useable. It's insane. There are lots and lots of command line tools in our operating systems and lots of them haven't GUI analogues but nobody complains about it, right? It's ok to implement simple interface with limited set of features only for average users and leave complex stuff for those who knows about it (it's ok to tell about existence of such features, though).

b) Without overcomplicated full-featured CSS editor people will not be able to break stuff more then they could already (and will be able with integrated EHH) and those who will attempt to use this feature will most likely know what are they doing and how to undo it. So, it is not a problem at all.

c) Indeed, but I doubt anyone will do such a thing. Anyway it's possible to block such rude behaviour from imaginary evil filterlists authors by treating filters with specific things like ':before', ':after' and 'url(' between curly braces as wrong rules. Probably such validations should be applied to the rules which came from the subscriptions only and allow users to use them in their own rules. Probably I'm wrong here but this feature doesn't gives more power to filterlists authors then Stylish gives to authors of styles on userstyles.org but nobody complains about such security 'hole' in the Stylish.

> The question is whether the ads in your examples can be blocked by other means
No or it leads to breaking sites functionality.

> and whether not blocking them is a big issue.
I think inability to properly block any ads is a big issue. Especially images, especially almost full-screen images like 'branding'. Probably site owners will invent some new ways to avoid blocking but at least they will have more 'hard time' with it and will think about either showing humble request to disable adblock as good guys do or completely block access to site as some bad guys do instead of pointless and annoying for everyone 'bullet and armor' game.
Last edited by Lain_13 on Sun Jul 06, 2014 11:09 pm, edited 2 times in total.
Posts: 114
Joined: Fri Dec 18, 2009 6:24 pm
Location: Wonderful World, Ubuntu Linux

Re: [feature req.] Extend hiding functionality

Postby Lain_13 » Sun Jul 06, 2014 10:55 pm


I'd like to add an update on this:
1. I made supplementary stylesheet for my list of filters: https://userstyles.org/styles/101141/ru-adlist-css-fixes
A few rules there are irrelevant and could be implemented as normal hiding rules (overclockers, chatovod, na-svyazi). They are there for another reason.

2. AdGuard browser extension does support such filters. They are using different syntax yet they do support them. Actually they even support JS injection!
Here is a list of their filters: http://adguard.com/en/filter-rules.html?id=2
Look there for #adg_start_style_inject.

So, having such functionality is required to be on par with concurrents.
Posts: 114
Joined: Fri Dec 18, 2009 6:24 pm
Location: Wonderful World, Ubuntu Linux

Re: [feature req.] Inline CSS styles

Postby mapx » Sun Jul 06, 2014 11:02 pm

you could file an "issue" (change type) on the bug tracker
User avatar
Posts: 21946
Joined: Thu Jan 06, 2011 3:01 pm

Re: [feature req.] Inline CSS styles

Postby Lain_13 » Mon Jul 07, 2014 12:25 am

Posts: 114
Joined: Fri Dec 18, 2009 6:24 pm
Location: Wonderful World, Ubuntu Linux

Re: [feature req.] Inline CSS styles

Postby jack.mauro » Tue Jul 08, 2014 6:34 pm

Your request is more general (so better) than the one i made a few days ago:


Posts: 10
Joined: Thu Dec 06, 2012 10:39 am

Return to Adblock Plus for Firefox support

Who is online

Users browsing this forum: Google [Bot] and 9 guests