#div(name) new function

Posting here is no longer possible, please use the forum of a filter list project, such as EasyList
guest

#div(name) new function

Post by guest »

i'd like a new funciont

that block DIV not only by name, but also for matching content

example:

<div id="g"> Sponsor Text </div>

<div id="g"> Normal Text </div>

so if you block all G div you block also Normal Text.

so can you add a new function like #div(g):text=*sponsor*


thanks
User avatar
rick752
Posts: 2709
Joined: Fri Jun 09, 2006 7:59 pm
Location: New York USA
Contact:

Post by rick752 »

You can't block an element by it's contained text in CSS any more than I can make the word "Rick" show up in red using only those letters.

Sorry
wiedzmin

Why not?

Post by wiedzmin »

Why can you not set visibility=hidden on a DIV element on the page if it matches a provided name or id? That would be so helpful against those text ads that can't be blocked by either image or frame source...
wiedzmin

Post by wiedzmin »

Ah nevermind I misunderstood the response. You mean that you cannot set the innerHTML property of an element without using JavaScript...
guest

Post by guest »

i think you do not understand, sorry for my bad english:

with the current adblockplus this command

#div(g)

hide all DIV element with ID="g"

it's ok?

if my html page contain 2 or more DIV element with ID="g" but only someones are ADS

like first post example.

so it would be great an other commands that filters only some DIV ID="g" by matching internal HTML text

like this
#div(g):BUT_ONLY_IF_INTERNAL_HTML_CONTAINS(*sponsor*)

understand now?
User avatar
rick752
Posts: 2709
Joined: Fri Jun 09, 2006 7:59 pm
Location: New York USA
Contact:

Post by rick752 »

You CANNOT use plain html text at all to define anything .... you MUST define elements by themselves.

You can xpath to it from an element BEFORE that one using regular css rules. Eg:

Code: Select all

##div[id="IdBefore"] + div[id="g"]
This will block div:id=g that comes after div:id=IdBefore .

or

Code: Select all

##div[id="IdBefore"] > div[id="g"]
This will block div:id=g that is a child of div:id=IdBefore .
guest

Post by guest »

rick752 wrote:You CANNOT use plain html text at all to define anything .... you MUST define elements by themselves.

You can xpath to it from an element BEFORE that one using regular css rules. Eg:

Code: Select all

##div[id="IdBefore"] + div[id="g"]
This will block div:id=g that comes after div:id=IdBefore .

or

Code: Select all

##div[id="IdBefore"] > div[id="g"]
This will block div:id=g that is a child of div:id=IdBefore .
this does not work if the page have many consecutive Div:id=g some with sponsor and some not.

#div(g):BUT_ONLY_IF_INTERNAL_HTML_CONTAINS(*sponsor*)

1) find element div(g)
2) check innerHTML of element, if contains *sponsor* than hide else go on.

where is the impossibility to implement?
Wladimir Palant

Post by Wladimir Palant »

As Rick mentioned a few times already, element hiding is limited by CSS in what it can do. Looking at the contents of a element is something that it definitely cannot do. Sometimes there are alternatives but without seeing the site we cannot tell.
fang5566
Posts: 31
Joined: Fri Nov 24, 2006 7:04 am

Post by fang5566 »

As adp can add element hiding function using CSS,we also can add simple innerHTML hiding function using Javascript.
Just part of my persnal view. :oops:
Wladimir Palant

Post by Wladimir Palant »

It is very difficult to get usability and performance right if we want to use JavaScript here. GreaseMonkey is doing this kind of thing - but the issues are still too many IMO.
zeniko

Post by zeniko »

What about using XPath to either just rip out the designated DOM nodes or to at least add a special attribute to them which makes the nodes hidable through CSS? Then all you'd have to do would be evaluating the XPath expression on DOMContentLoaded and iterate through the results...

Bonus points for allowing the user to manually enter XPath expression as well. :wink:
Wladimir Palant

Post by Wladimir Palant »

Doesn't change the problems. Performance of XPath is comparably low, and it should be impossible to remove the ads *before* they had a chance to show.
pavlo
Posts: 6
Joined: Tue Feb 12, 2008 9:52 am
Contact:

Post by pavlo »

hi
sory, please help me.
how i can make #div(tobar) on one site
http://example.com#div(tobar) it not worked :(
Wladimir Palant

Post by Wladimir Palant »

This will work:

example.com#div(tobar)

You can install the Element Hiding Helper extension - it makes building element hiding rules much easier.
pavlo
Posts: 6
Joined: Tue Feb 12, 2008 9:52 am
Contact:

Post by pavlo »

thanks, i'am make http://example.com#div(tobar)
and it not worked

and example.com#div(tobar) is worked :)
Locked