This started as a pet peave but now it's an academic exercise.

Occasionally I follow a link to a story at the UK's Daily Mail and I want to write a rule/filter for uBlockO to prevent my eyes being soiled by the tawdry, sycophantic sidebar stories that invariably litter the right-hand margin of the page. uBlockO's "block element" function works well enough but only for that one specific element. I want to block the entire category.

Here is a (redacted) example URL:


When I "block element" it, the filter it creates is this:

www.dailymail.co.uk##a[href="/tvshowbiz/article-1234567/abcd-efgh-ijkl-mnop.html"] > .pufftext > strong

I've tried every permutation I can think of to block everything from www.dailymail.co.uk/tvshowbiz/article-* outward, or even www.dailymail.co.uk/tvshowbiz/*, but none of them have any effect. I don't know if I'm using the wrong uBlock function or if my syntax is in error.

Any clues?

  • You just need to block the entire div where the advertisements are. The filter would look like this www.dailymail.co.uk##.beta – DrZoo Jan 30 '18 at 4:28
  • Thank you for the reply, DrZoo, but these aren't adverts, they're links to other stories/articles at the Daily Mail. And I'm afraid I don't know what a "div" is. As a guess, I did try www.dailymail.co.uk##.tvshowbiz but it had no effect. – bobsnephew Jan 30 '18 at 18:09
  • Not understanding basic HTML is probably why you're having trouble blocking what you want. Here is a picture with the div. Here is a picture without the div. I quickly blocked the whole thing to show the difference. I was unclear what you exactly wanted blocked. – DrZoo Jan 30 '18 at 18:29

I'll go you one better. I didn't even know 'div' was HTML.

I appreciate your help but while I was trying to figure out which 'div' to block, I found that I'd have got the result I wanted in the first place if I'd been more thorough when investigating the "block element" function. I needed to paint with a broader brush so I was selecting the greater frame rather than one of the elements contained within the frame. When I hit the right spot, the filter it created was:

www.dailymail.co.uk##.lead-alpha.cleared:nth-of-type(3) > .beta

And that produced the same result you posted images of. The entire frame disappears.

Thanks again!

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.