uBlock icon indicating copy to clipboard operation
uBlock copied to clipboard

Question - two custom filters

Open gituporabnik opened this issue 11 years ago • 5 comments

I came across 2 rules, here are the examples:

  1. ekipa24.si###banner1

  2. med.over.net###phorum > .main-container > .clearfix.box-holder > .span-3_2.span > .forum.box-full.box > .post-listing > .main-post.single-post:nth-of-type(5) > .clearfix.oglasnik-addbox

In the first case, I would like to replace "banner1" or "1" with universal character (i.e. with any number). In the second case, it is similar. I would like to replace number "5" (in this case it is in brackets).

I would like to have a single filter for each rule, if possible. I have tried to replace characters with [id^="-"] For example: ekipa24.si##[id^="banner-"] and ekipa24.si##banner[id^="-"]

But it doesn't work.

gituporabnik avatar Jul 06 '15 21:07 gituporabnik

Is this really Firefox-specific? It seems unlikely.

AlexVallat avatar Jul 07 '15 07:07 AlexVallat

  • ekipa24.si##[id^="banner"] https://developer.mozilla.org/en-US/docs/Web/CSS/Attribute_selectors
  • second is more complicated: https://developer.mozilla.org/en-US/docs/Web/CSS/:nth-of-type tester: http://lea.verou.me/demos/nth.html

ghost avatar Jul 07 '15 09:07 ghost

@AlexVallat it is most likely not Firefox specific. I changed the title.

However, I figured it out. In the second rule, the number (in this case "5") can be simply replaced with "n", since it can be any character. Therefore: med.over.net###phorum > .main-container > .clearfix.box-holder > .span-3_2.span > .forum.box-full.box > .post-listing > .main-post.single-post:nth-of-type(n) > .clearfix.oglasnik-addbox

Thank you @gwarser for suggestions! The first rule you provided also works well.

gituporabnik avatar Jul 07 '15 10:07 gituporabnik

In the second rule, the number (in this case "5") can be simply replaced with "n"

Simpler to just remove altogether the nth-of-type pseudoclass I suppose:

[...] > .main-post.single-post > [...]

gorhill avatar Jul 07 '15 11:07 gorhill

@gorhill Correct. This is even better, because it allows me to delete some other subrules. Thanks!

gituporabnik avatar Jul 07 '15 12:07 gituporabnik