need help blocking specific DIVs with no CLASS or ID attrs

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

need help blocking specific DIVs with no CLASS or ID attrs

Post by babybird »

as i understand it, adblock plus can block elements using raw css selectors. the selector that i need would be something to select the 5th <div> tag on the page. according to firebug, the xpath for this div is "/html/body/div[5]".

in that example, shouldn't i be able to use "site.com##div div div div div" as my filter? it doesn't seem to work though.

any ideas or is this not really possible to do with ABP?

also, what about having xpath rules for ABP?

thanks!
Dr. Evil
Posts: 194
Joined: Fri Sep 08, 2006 3:51 pm

Post by Dr. Evil »

the rule would have to look like this:

Code: Select all

site.com##body > div:first-child + div + div + div + div
You can also use the Element Hiding Helper to create such rules: http://adblockplus.org/en/elemhidehelper
also, what about having xpath rules for ABP?
Remove It Permantly uses xpath for blocking, but it has the flaw that it only removes stuff after the page has loaded - the unwanted content first appears and then goes away after some time. And I don't think this can be changed.
In contrast the CSS rules used by ABP apply already during page load, so the page doesn't flicker. Also,CSS is much faster, I think.
babybird

Post by babybird »

thank you for the reply.

i'm trying it out now and it doesn't seem to be working, but i'll experiment with it and see if i can't work it out. maybe i've missed something in the page or something. if not, i'll reply again with more info. :)

as for element hiding helper, i do have that. however when i use that it ends up blocking every div on the site instead of just the one i want blocked. i think that's because they don't have any attributes to narrow it down with. it only has tag name: DIV and align: center, which all the DIVs on the site have.

the other thing i've noticed with element hiding helper is when i add the custom css portion of your code in there, it doesn't generate the same code. what it gives me is this:

Code: Select all

site.com##*##body > div:first-child + div + div + div + div
even removing the ## still leaves me with that astrisk in the rule, unfortunately i've never figured enough out about css to understand why that's the case. but i do like having that preview feature i get from the element hiding helper addon. :D
User avatar
rick752
Posts: 2709
Joined: Fri Jun 09, 2006 7:59 pm
Location: New York USA
Contact:

Post by rick752 »

Using EHH can be tricky at first, but remember to use the "W" and "N" keys to zero in on the element to select. Then select that element and checkoff the listings above it one by one until you get to an element that has a solid definition. It should work. Like I said though, it takes a bit of practice and helps a lot if you have some basic some knowledge of html. Fortunately, EHH does a real-time preview of what you are doing.

Would you like to give a page link?
babybird

Post by babybird »

ok, the site is somewhat NSFW so i've made a copy and removed all the links/images etc to make it safe. ironically, it's mainly those parts that i'm trying to get rid of to begin with.

i've also added inline styles to the <DIV>s i want to keep (the red background color), the rest is what i'm trying to remove. i haven't changed any of the html structure etc other than removing links and text and of course adding the background:#ff0000; inline styles to those two <DIV>s.

any other questions, let me know.

the cleaned copy of the site is at http://babybird.chatcircuit.com/thesite/
Locked