Need help writing an element blocking filter

Posting here is no longer possible, please use the forum of a filter list project, such as EasyList
Locked
anon42
Posts: 14
Joined: Fri Jul 24, 2015 10:21 pm

Need help writing an element blocking filter

Post by anon42 »

I have a problem with the site macupdate.com. Recently they started plastering annoying advertising banners across their entire web page in the middle of the actaul useful information they have there. There are usually three banners displayed in succession and one (and sometimes two) change every week.

I use Element Hiding Helper for Adblock Plus and select the banner when it appears to create a ADB filter to hide the banner. For example,

macupdate.com###billboard_deep-dreamer

I discovered that ### means to match the element with the id that follows. This works. But for every new annoying banner I need to create another filter rule. They are adding up!

What would be nice is if a filter rule could be created to generalize matching all these banners even when macupdate changes them. Something like,

macupdate.com###billboard_.*

But apparently regular expressions can't be used in element hiding rules. So the reason for this post is to ask if there is anyway to generalize this banner hiding so I don't have to add to the filter rule set every time macupdate adds a new ad banner?

Just for reference here's the chunk of html from maupdate for their current set of (3) banners (at the time I captured it of course):

Code: Select all

<div id="nfml-featuredapp-slider" class="off2">
                       <a href="/app/mac/54576/gestimer" id="billboard_gestimer"
	class="nfmlfas-slider-box billboard_gestimer bb_current"
	> <img
	src="http://www.macupdate.com/images/app_billboards/image.jpg"
	class="nfmlfasb-img" alt="Download Gestimer" />
</a>
                       <a href="/app/mac/54928/deep-dreamer" id="billboard_deep-dreamer"
	class="nfmlfas-slider-box billboard_deep-dreamer"
	style="display:none"> <img
	src="http://www.macupdate.com/images/app_billboards/deepdreamerbanner.jpg"
	class="nfmlfasb-img" alt="Download Deep Dreamer" />
</a>
                       <a href="/app/mac/52709/blocs" id="billboard_blocs"
	class="nfmlfas-slider-box billboard_blocs"
	style="display:none"> <img
	src="http://www.macupdate.com/images/app_billboards/Blocs.jpg"
	class="nfmlfasb-img" alt="Download Blocs" />
</a>
				<div id="nfmlfas-slider-controls" class="off2">
			class="nfmlfassc-btn active"></a>
			class="nfmlfassc-btn "></a>
			class="nfmlfassc-btn "></a>
</div>
Any help would be appreciated.
User avatar
Gingerbread Man
Posts: 1339
Joined: Fri Aug 12, 2011 5:28 am

Re: Need help writing an element blocking filter

Post by Gingerbread Man »

anon42 wrote:macupdate.com###billboard_.*
That's not a valid filter. Element hiding filters are comprised of the domain name (optional), ## to indicate an element hiding filter, then a CSS selector.
https://developer.mozilla.org/en-US/doc ... #Selectors

Code: Select all

macupdate.com##[id^="billboard_"]
User avatar
mapx
Posts: 21940
Joined: Thu Jan 06, 2011 2:01 pm

Re: Need help writing an element blocking filter

Post by mapx »

Code: Select all

macupdate.com##[id^="billboard_"]
macupdate.com##DIV[style="clear:both;height:280px;"]
macupdate.com##.banner2
macupdate.com###mud_upgradeblock
anon42
Posts: 14
Joined: Fri Jul 24, 2015 10:21 pm

Re: Need help writing an element blocking filter

Post by anon42 »

Gingerbread Man - I know that the syntax I posted was wrong and said as much. I was only trying to illustrate what kind of operation I wanted to do. So thanks for the macupdate.com##[id^="billboard_"]. That appears to do the trick.

mapx - thanks to you too. Your first line is the same as Gingerbread Man. So what's the purpose of the remaining three lines?
User avatar
mapx
Posts: 21940
Joined: Thu Jan 06, 2011 2:01 pm

Re: Need help writing an element blocking filter

Post by mapx »

macupdate.com##DIV[style="clear:both;height:280px;"]
removes the unused space (after applying the first filter)

macupdate.com##.banner2
removes a banner at bottom

macupdate.com###mud_upgradeblock
removes a small banner on the top right

more about filters:
en/filter-cheatsheet
en/filters
anon42
Posts: 14
Joined: Fri Jul 24, 2015 10:21 pm

Re: Need help writing an element blocking filter

Post by anon42 »

Thanks for the explaination mapx. I'll keep that info for future reference.

I really don't notice ay space following the removed banner and I didn't care about the stuff at the bottom and side. Only the annoying crap they plastered right in the middle of the interesting stuff.

Thanks for the links too.
Locked