-
Notifications
You must be signed in to change notification settings - Fork 12
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
Support for uBO media queries #70
Comments
Copy/pasting implementation ideas from the comment in a duplicate issue: Possible implementations:
Tbh, I am not sure which one is better. Also, we should definitely file it to CoreLibs as well. |
Regarding the converter way, I am not entirely sure about it. Of course we could convert them into a simple CSS rule, i.e. With how things done now element hiding rules with One more idea would be to introduce a new cosmetic modifier "media" and write those rules this way: In this case the rules converter will do a simple |
In my opinion, it makes more sense to use the native CSS syntax at the engine level and convert the other rules.
It seems this is currently a very rare case and can be solved with a CSS rule:
By the way, this case is a bit similar to when scriptlets get a path constraint (see #65). For example |
I am more or less okay with both approaches. IMO,
Both simplifications are really minor and can be easily achieved with the native CSS syntax as well. On the other hand, using native CSS syntax has a very huge and clear advantage over that new modifier, we don't need to bother implementing anything new. |
Well, if necessary, we can directly parse a CSS media query list (e.g. with CSSTree), so for me the modifier also seems like a good idea, and syntactically it is easy to use. For my part, I simply prefer native CSS, but your idea is more flexible:) If I understand everything correctly, the following two rules are both valid on this way:
(Although in the case of CSS injections, the native CSS syntax seems more natural to me, and I don't see any complications in terms of parsing either) And we can simplify Other aspects:
|
Thank you! Actually, there are only a few dozens of these rules in the known filter lists so probably bothering with implementing a new modifier is not feasible anyway.
In Safari these CSS rules are only applied via web extension, Safari Content Blocker does not provide media queries support. Off-topic:
|
It has already been fixed, but we haven't released a new version of the extension since then. Linguist uses the improved version (last #$#@media (min-width: 1px) { .ad { padding: 1; } } |
uBO now supports media queries. The tsurlfilter's converter does not support it yet.
Reference: https://github.com/gorhill/uBlock/wiki/Procedural-cosmetic-filters#subjectmatches-mediaarg
Examples:
should be converted to
should be converted to
FIXME:
This is typically an element hiding rule
and perhaps it can be converted to
but I'm not sure about that
Reference: https://kb.adguard.com/en/general/how-to-create-your-own-ad-filters#examples-9
@slavaleleka Do you have a better idea for the last case? 🙂
The text was updated successfully, but these errors were encountered: