Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Block similar elements" option in the "Block Element" dialog #933

Closed
admirabilis opened this issue Nov 12, 2015 · 10 comments
Closed

"Block similar elements" option in the "Block Element" dialog #933

admirabilis opened this issue Nov 12, 2015 · 10 comments

Comments

@admirabilis
Copy link

In uBlock there is already the "Block Element" tool, but there is one feature of Adguard that makes me switch to it constantly to write new filters, which is called "Block similar elements".

As an example, on Inoreader.com, uBlock blocks ads, but leaves empty spaces between feed items (the cosmetic filters don't work there).

Using uBlock, I select the empty space, and it returns the element ###leaderboard_ad-564435f7bb14f to block. The problem with this approach is that 564435f7bb14f here is just a random string, which changes every time I visit Inoreader.

To block ads like this effectively, I have to activate Adguard, open the "Block Element" dialog, select that element, which will return ###leaderboard_ad-564435f7bb14f too. But then I click on "Advanced settings" and then "Block similar elements", which gives me inoreader.com##.block_article_ad, .mobile_leaderboard_ad, .ad_size_mobile_leaderboard, .sinner instead. I have used this rule in uBlock and it always works!

I have seen some very annoying ads on some other websites which also use that random string approach, and I can only write the rules easily for them with Adguard, and then I import them to uBlock.

@gorhill
Copy link
Owner

gorhill commented Nov 12, 2015

Where can I see that leaderboard_ad- DOM element? Can you tell me how to get to that page, and what is the element on that page?

@admirabilis
Copy link
Author

Hi, @gorhill! You need to create an account on inoreader.com and subscribe to some feed there. The feeds should be set to be displayed as columns.

uBlock will block the ads but will leave gaps above and between the feed items, where it was supposed to appear ads:

1

2

@admirabilis
Copy link
Author

I have noticed today that the website quora.com also uses this same method of random strings, which seems to have been designed to fool adblockers. If you start browsing questions there, they will eventually display an annoying popup trying to force you to login to display more questions.

@gorhill
Copy link
Owner

gorhill commented Nov 14, 2015

URL? (always)

@admirabilis
Copy link
Author

Oh, sorry! I'll just give one example of an URL on quora.com: https://www.quora.com/Why-do-people-answer-questions-on-Quora-1

You won't see the annoying login message right away, but from there, if you start browsing through related questions, it appears after around three or five pages:

1

@gorhill
Copy link
Owner

gorhill commented Nov 14, 2015

website quora.com also uses this same method of random strings

It's just a matter of removing the variable part using a fancier CSS selector in the current instance:

! 14/11/2015, 10:05:02 https://www.quora.com/What-makes-people-answer-questions-on-Quora
www.quora.com##[id$="_modal_signup_wrapper"]

This specific case wouldn't be solved with a "Block similar elements" feature, as the variable part is in the unique id of the DOM element.

@admirabilis
Copy link
Author

I have just opened Adguard, and "Block similar elements" gives me quora.com##.dialog, .modal_signup_dialog for the login dialog, and quora.com##.modal_signup_background, .new_web_signup_wall_design for the dark background that covers the page. They both work well with uBlock too.

@gorhill
Copy link
Owner

gorhill commented Mar 22, 2017

This was fixed with 1c4347d, I hadn't realized there was an issue opened about this. Ctrl-click will now pick better broad selectors.

@gorhill gorhill closed this as completed Mar 22, 2017
@admirabilis
Copy link
Author

That's awesome, thank you!

@cmwhyk
Copy link

cmwhyk commented Mar 28, 2017

what is the equivalent on OSX? I tried ctrl, option, cmd, shift to no avail

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants