Filter for uBlock

0

I'm using uBlock ad blocker on Firefox. Originally I have free filters such as:

search.yahoo.com###yui_3_10_0_1_1531993940314_95  
search.yahoo.com###yui_3_10_0_1_1532027806134_88
search.yahoo.com###yui_3_10_0_1_1532084576415_87

I assumed that all next pages will have similar id's. So I want to created a general filter so it can filter out the ads from every next pages, something like this:

search.yahoo.com###yui_3_10_0_1_153*

But I can't figure out from uBlock's documentation what is syntax for this task.

How to create filter for uBlock?

megas

Posted 2018-07-20T11:18:16.707

Reputation: 117

Answers

2

You would have to look at the CSS selector documentation. uBlock adds a few extensions of its own ("procedural" selectors), but still has the same general syntax and features as CSS.

In your example, ## is the separator and #yui_3_10_0_1_1532027806134_88 is the CSS selector – the # prefix means it matches on the element's id= attribute (an ID selector).

ID selectors are always exact-match, but they're simply shorthand for generic attribute selectors – the previous is identical to [id=yui_3_10_0_1_1532027806134_88].

Attribute selectors do support prefix, suffix, and substring matches using ^=, $=, and *= respectively. So the selector you're asking for is [id^=yui_3_10_0_1_153]:

search.yahoo.com##[id^=yui_3_10_0_1_153]

Note that the large number in YUI autogenerated IDs is a timestamp – specifically, the "Unix timestamp" in microseconds. It will reach 1540000000000 on October 20th of this year (and 1600000000000 in September of 2020, if Yahoo is still around by that time), so you should adjust the uBlock filter accordingly.

user1686

Posted 2018-07-20T11:18:16.707

Reputation: 283 655