CoreLibs icon indicating copy to clipboard operation
CoreLibs copied to clipboard

Support for uBO media queries

Open ameshkov opened this issue 3 years ago • 0 comments

@scripthunter7 commented on Sat Dec 17 2022

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:

  • example.com###target-3 > .target-4:matches-media((min-width: 1920px) and (min-height: 930px)):style(color: red !important)
    

    should be converted to

    example.com#$#@media (min-width: 1920px) and (min-height: 930px) { #target-3 > .target-4 { color: red !important; } }
    
  • github.com##pre:matches-media(print):style(white-space:pre-line !important;)
    

    should be converted to

    github.com#$#@media (print) { pre { white-space:pre-line !important; } }
    

FIXME:

  • This is typically an element hiding rule

    example.com###target-1 > .target-2:matches-media((min-width: 800px))
    

    and perhaps it can be converted to

    example.com#$#@media (min-width: 800px) { #target-1 > .target-2 { display: none !important; } }
    

    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? 🙂

ameshkov avatar Dec 18 '22 09:12 ameshkov