uBlock icon indicating copy to clipboard operation
uBlock copied to clipboard

Custom filter: help please

Open gituporabnik opened this issue 11 years ago • 5 comments

I would like to add two universal cookie notification filter rules for Google in my custom list. 1.) Here is one for Google Translate: ###gb > .gb_[id] 2.) And here is one for Google Maps: ###pushdown > .gb_[id]

It looks like the first 4 characters are always the same (.gb_). Others change, for example: translate.google.com###gb > .gb_X.gb_wa.gb_Jb (for Google Translate) translate.google.com###gb > .gb_d.gb_2b.gb_Dc www.google.com###pushdown > .gb_g.gb_8b.gb_Nc (for Google Maps)

Problem: the upper two universal rules do not work. Cookie notifications are still appearing. I have also tried ###gb > [id^=".gb"] and ###pushdown > [id^=".gb"] but they don't seem to work neither. Did I write something wrong?

gituporabnik avatar Aug 24 '15 12:08 gituporabnik

the upper two universal rules do not work

Because .gb_[id] matches nothing, your CSS rule is improperly crafted given what you want to accomplish.

Try translate.google.com###gb > [class^="gb_"].

Also, take note that the issue tracker here is only for issues with uBlock Origin, it should not be used as a help desk. I will have to become more hardcore if my goodwill to help keeps being abused through the opening of non-issues on GitHub -- each time I help someone with such non-issue, it sends the message to others that they can also do so, and this end up polluting the issue trackers here with things unrelated to uBlock. There are other places for such help, try Reddit, Wilders Security, anywhere else really.

gorhill avatar Aug 24 '15 12:08 gorhill

Thank you for information. I didn't know for Wilders Securtiy forum. I will contact them (or Reddit) in the future.

gituporabnik avatar Aug 24 '15 13:08 gituporabnik

Another trick useful in your case: use the element picker to validate whether a cosmetic filter works or not: uBlock will highlight whatever on the page matches the filter in the text field. So if you cut and paste ###gb > .gb_[id] in the text field of the element picker while on the page https://translate.google.com, uBlock would have highlighted nothing, meaning your cosmetic filter was not working. Entering ###gb > [class^="gb_"] would have highlighted the element you were trying to remove (and maybe other things on the page -- I did not try it).

gorhill avatar Aug 24 '15 13:08 gorhill

Great! I thought the text field didn't have option to manually enter and test different rule variations. Very useful indeed.

gituporabnik avatar Aug 24 '15 14:08 gituporabnik

Just in case, do not enter the prefix for the site when you test for a filter (i.e. translate.google.com), uBlock will always use the current site internally. In short:

  • ###gb > [class^="gb_"] = good
  • translate.google.com###gb > [class^="gb_"] = bad, will be rejected as not a valid filter

gorhill avatar Aug 24 '15 14:08 gorhill