How to Hide Elements in ABP (really short version)

General information, announcements and questions about the EasyList subscriptions.
Locked
User avatar
rick752
Honorary Member
Honorary Member
Posts: 4508
Joined: Fri Dec 30, 2005 1:02 am
Location: New York, USA

How to Hide Elements in ABP (really short version)

Post by rick752 »

Wladimir's Adblock Plus Element Hiding Helper extension is great for easy selecting and automatically inserting the filters into Adblock Plus.

Adblock Plus Element Hiding Helper extension:
https://addons.mozilla.org/firefox/4364/

------------------------------------------------------------

Hiding an element is much harder and trickier than blocking an ad. A basic knowledge of html coding is helpful, but not necessary if you use EHH. Lets say we are at a site called

Code: Select all

somesite.com


Let's say you have isolated a <table> that you want to remove:
The entire code line is:

Code: Select all

<table width="100" height="95" class="crappyad">
You have some choices here, ANY of the 3 table 'descriptors' can be blocked individually or ALL 3 can be used to make ABP find ALL of them in a table before it initiates a 'hide'.

Unlike the html coding, in ABP the 'tag' ('TABLE' is the tag) must be preceded by a "#" to designate this string as an element-hide string .... <brackets> and "quotes" must be removed ... EACH descriptor must be enclosed with their own (parenthesis) .... and all spaces must be removed.

You should have a string that looks like this:

Code: Select all

#table(width=100)(height=95)(class=crappyad)
This is a finished string and will work fine on ANY site that matches all 3 descriptors of <table> in the html code.

But to prevent false positives (especially at first), you should designate the hide just to the site you are trying to block. You can do that by simply adding that domain to the beginning of the string MINUS the "http://" stuff.
So now you have:

Code: Select all

somesite.com#table(width=100)(height=95)(class=crappyad)
Any of the descriptors can be removed for broader blocking (or just plain simplicity) like:

Code: Select all

somesite.com#table(class=crappyad)
Wildcard features can be used too:

Code: Select all

somesite.com#table(class=crappyad) -  hides a class containing EXACTLY "crappyad"
somesite.com#table(class^=crappyad) - hides a class that BEGINS WITH "crappyad"
somesite.com#table(class$=crappyad) - hides a class that ENDS WITH "crappyad"
somesite.com#table(class*=crappyad) - hides a class containing "crappyad" ANYWHERE in the class
Notes and warnings:
All code lines are case-sensitive .... whitelisting will NOT override an element hide. ( Also, you must take a good look to ensure that you did not create false-positives as the same elements can be used on other parts of the page or site.

Using the Element Hiding Helper for ABP extension can select, create the string, and it will enter directly into your ABP filters. Just use the "W" and ""N" keys to 'zero-in' on the element your want to hide. It takes a little practice but works quite well. Get it here:
https://addons.mozilla.org/en-US/firefox/addon/4364

Some more element hiding documentation info here:
http://adblockplus.org/en/filters#elemhide_basic
"Experience is something you don't get until just after you need it"
Locked