EHH: show number of hidden elements

Various discussions related to Adblock Plus development
Post Reply
famlam
Posts: 59
Joined: Sat Aug 07, 2010 2:06 pm

EHH: show number of hidden elements

Post by famlam »

Just a feature request:
it would be nice if the EHH could show the number of matches of a rule on a page.

For example, I am on a website which contains a banner has a fully random url and can only be hidden by
site.com##img[height="120"][width="130"]

To know if this filter doesn't cause any false-positives I have to check the full page if anything else does also disappear after adding that rule. [or simply assume it is correct and hope I'm not wrong]
However, it would be nice if there was a line 'This filter hides # items on this page'

I guess the most difficult part would be to exclude items inside hidden items, e.g. for ##.any not to count this two times:
<div class="any">
<div class="any thing else">
</div></div>
Wladimir Palant

Re: EHH: show number of hidden elements

Post by Wladimir Palant »

Sounds like a good idea to me, over to future development.
User avatar
Crits
Posts: 394
Joined: Mon Jan 16, 2012 11:54 am
Location: France
Contact:

Re: EHH: show number of hidden elements

Post by Crits »

I created another topic dealing with the same idea, without actually having a look at this one. I'm just dumping its content here for consistency:
----------------------------------------------------------------------

1) When hovering over the ABP icon, it tells us how many times each filter is used on the page, except for the hiding rules whose numbers of hits are always: (1)

Would it be possible to actually count the real number of hits on one webpage for hiding rules?
It would be highly useful for example for list maintainers, as this features could help to quickly check if a hiding rule being tested (especially the ones with exotic CSS selectors) is causing false positives - i.e. if it matches more times than intended - without having to crawl through the source code of the page, the CSS stylesheets, etc., or having to have a really sharp eye at the webpage content.

2) In the blockable items list, could a new row containing the number of hits could be added? As it wouldn't be useful for most users, it could be hidden by default.
Author of Liste FR, an ad-blocking subscription for French websites
lewisje
Posts: 2743
Joined: Mon Jun 14, 2010 12:07 pm

Re: EHH: show number of hidden elements

Post by lewisje »

To my knowledge, the element-hiding rules are the equivalent of injecting a huge block of CSS selectors followed by {display:none!important}, so there's no real concept of "hits"
There's a buzzin' in my brain I really can't explain; I think about it before they make me go to bed.
famlam
Posts: 59
Joined: Sat Aug 07, 2010 2:06 pm

Re: EHH: show number of hidden elements

Post by famlam »

lewisje wrote:To my knowledge, the element-hiding rules are the equivalent of injecting a huge block of CSS selectors followed by {display:none!important}, so there's no real concept of "hits"

Code: Select all

document.querySelectorAll("filter_part-after_the_##").length;
(Although this one might have to be in a try-catch since the person who adds the filter might have accidentally submitted a broken filter in which case this function throws an error)
Sorry for the lack of replies, somehow this forum loses it's "Notify me when a reply is posted" setting when it's moved to another location
Lain_13
Posts: 114
Joined: Fri Dec 18, 2009 5:24 pm
Location: Wonderful World, Ubuntu Linux
Contact:

Re: EHH: show number of hidden elements

Post by Lain_13 »

Why not just highlight borders of blocks which are going to be hidden while editing rule? As least it could be useful as a switch in EHH dialog.
famlam
Posts: 59
Joined: Sat Aug 07, 2010 2:06 pm

Re: EHH: show number of hidden elements

Post by famlam »

Lain_13 wrote:Why not just highlight borders of blocks which are going to be hidden while editing rule? As least it could be useful as a switch in EHH dialog.
In that case, you'd still first have to scroll the page to see where rules match. Secondly, I'd prefer to have a preview where the page looks as it would become after applying the rule rather than elements just being highlighted (since some pages mess up only after an element is actually hidden, especially top banners with fixed position menus are good at doing that). So I don't think that would be a good idea.
Lain_13
Posts: 114
Joined: Fri Dec 18, 2009 5:24 pm
Location: Wonderful World, Ubuntu Linux
Contact:

Re: EHH: show number of hidden elements

Post by Lain_13 »

That's exactly why I proposed a switch between highlight and hide preview modes. In highlight mode you will see all matched elemetns and in hide mode you will see how page will looks like without them. Sometimes it's really hard to track down all changes on the page with just hide preview. Especially when you writing some crazy stuff like A:not([href*="..."]):not([href*="..."])>IMG...
Counter of actual hits would be nice to have but it wouldn't be much help.
Post Reply