Creating AdGuard custom filters from Ad Muncher custom filters

Nick

New Member
As I mentioned in another thread, creating filters for Ad Muncher seemed so much easier. After scanning the source code, I'd just add a filter based on what I wanted to filter (Remove images/etc with URL, Block retrieval of URL, Remove scripts with text etc, etc) and it would just work 9 times out of 10. Very rarely I would have to delve a little deeper into the source code.

I'm struggling a little with Adguard in this sense but I'm sure it will improve as my experience of the app grows. At the moment, I seem to be spending lots of time trying out filters which don't seem to have any effect which is kinda frustrating.

Is it possible to filter objects in Adguard based on the following? If yes, could someone provide an example filter please?
Remove links to URL
Remove images/etc with URL
Block retrieval of URL
Remove scripts with text
Remove tables with text
Remove divs/spans with text

Thanks :)
 

Nameless

Beta Tester
Like most things it depends on the situation.

Remove links to URL - Probably needs JS to do this
Remove images/etc with URL - Single file: ||adguard.com/images/logo.png Folder: ||adguard.com/images/
Block retrieval of URL Like above ||adguard.com
Remove scripts with text - never done this myself check http://adguard.com/en/filterrules.html#htmlContentFilter or http://adguard.com/en/filterrules.html#javascriptInjection
Remove tables with text - Table title, class, id name or you meanwithin the table?
Remove divs/spans with text - ID/Class name? Or text within the div?

im sure someone will correct me if they see something wrong, hell maybe im doing it wrong.
You can also use https://adblockplus.org/en/filter-cheatsheet
 

Nick

New Member
Thanks (again) Nameless...that should come in handy.

As for the Remove tables/divs with text, yes I mean any text within the div itself although ID/Class, title etc are also good.

I owe you some rep!
 

avatar

Administrator
Staff member
Administrator
Remove links to URL
Remove images/etc with URL
it's done automatically if this URL is blocked by standard URL-blocking rules.

Block retrieval of URL
http://adguard.com/en/filterrules.html#baseRules

Remove scripts with text
Remove tables with text
Remove divs/spans with text
Something like this:
Code:
$$script[tag-content="substring of the script"]
$$div[tag-content="substring inside this div"]
$$span[tag-content="substring inside this span"]
$$table[tag-content="substring inside this table"]
Also it's highly recommended to add attributes and length restrictions for divs and tables.
max-length attribute of this rule allows removing of those elements only which length is lesser than "max-length" value.
Code:
$$div[tag-content="substring inside this div"][class="substring of class attribute"][max-length="4000"]
$$table[tag-content="substring inside this table"][class="substring of class attribute"][max-length="8000"]
More info here: http://adguard.com/en/filterrules.html#htmlContentFilter

$$ rules do not work in our browser extensions.
 

Nameless

Beta Tester
Never used the max length rule myself must give it ago. Thanks for a better explenation than mine too.
 

avatar

Administrator
Staff member
Administrator
Never used the max length rule myself must give it ago. Thanks for a better explenation than mine too.
max-length is recommended to reduce chance for removing normal element.
Adguard removes the biggest element suitable for the rule.
That's why it's also good to use attributes restrictions.
 

streetwolf

Beta Tester
I've found that since coming from AM I see more popups/popovers/sliders etc. since I started using AG. What was AM doing to prevent these that AG isn't? Whatever AM was doing is AG going to duplicate it?
 

Nameless

Beta Tester
Funny, im seeing less thanks to https support and anything i do see i want removing then gets added to my personal filter list, im guessing you have reported these popups/popovers/sliders etc s that maybe they get added to the lists?
 

avatar

Administrator
Staff member
Administrator
I've found that since coming from AM I see more popups/popovers/sliders etc. since I started using AG. What was AM doing to prevent these that AG isn't? Whatever AM was doing is AG going to duplicate it?
It's better to report those. If we see something common in them - we'll add this pattern to our popup blocker extension.
 
Top