Page 1 of 1

EHH: show number of hidden elements

Posted: Thu Jan 27, 2011 9:10 pm
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>

Re: EHH: show number of hidden elements

Posted: Wed Feb 09, 2011 3:37 pm
by Wladimir Palant
Sounds like a good idea to me, over to future development.

Re: EHH: show number of hidden elements

Posted: Sun Nov 11, 2012 11:37 am
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.

Re: EHH: show number of hidden elements

Posted: Wed Nov 14, 2012 4:48 am
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"

Re: EHH: show number of hidden elements

Posted: Wed Dec 12, 2012 11:42 pm
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

Re: EHH: show number of hidden elements

Posted: Fri Jan 11, 2013 7:37 am
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.

Re: EHH: show number of hidden elements

Posted: Fri Jan 11, 2013 8:06 am
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.

Re: EHH: show number of hidden elements

Posted: Sat Jan 26, 2013 6:29 pm
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.