removing block of html(no element ID)
|
|
Hi there everyone, I downloaded the two greasemonkey scripts that were supposed to removed the sponsor block from the sitepoint forums, but neither worked. I've noticed that there are no unique element ID's to help me in my task. tcat and alt2 are shared by other parts of of the page. Here's the code: EDIT: I've removed the code due to the inability to keep it from parsing. I want to remove a table with class "tborder product". I would like to make this code disappear. Could someone help me with this task? Thanks very much for your time.
|
|
|
You want to remove a table with class "tborder product". An Xpath expression like "//table[@class='tborder product']" would be enough
You can get the $x function in the GreaseSpot wiki (http://wiki.greasespot.net/Code_snippets#XPath_...) |
|
|
I believe that will throw an error if the array is empty. OK, because that function defines |
|
|
Hi there mindeye, and thanks very much for the response. If I can manage to do it, this would be my first greasemonkey script and although I'm reading everything I can find, I'm having a problem actually assembling the code. I see that the wiki explains the different things I can do once I've identified the code, but to be honest, I can't determine which I'm supposed to use, as the docs don't seem to be intended to be used by a layman. Would you mind helping me a bit more with what I need to do to bring the script to fruition? thanks very much for the time you've already spent on it. thanks,
|
|
|
Sorry descriptor, I missed your post when replying. Are you saying that mindeye's snippet is the code in an of itself, but it needs some modification? thanks,
|
|
|
It's perfectly fine, but if it was written like this...
var ad = $x("//table[@class='tborder product']");
if (ad.length) ad[0].parentNode.removeChild(ad[0]);
There wouldn't be any (strict) JavaScript warning... when the ad doesn't exist. -- All you need is that XPath helper function from the link Mindeye supplied, and his two lines of code. |
|
|
GM_addStyle('.tborder.product,.industrybrains{display:none}');
Also, Stylish. |
