tags:

views:

133

answers:

2

I have this Greasemonkey script, I originally wanted to get all the <table> elements and search through those for but I couldn't get that to work. So I tried searching for the <a> elements themselves and just hiding them if they contained "http://www.4chanscapepk.t35.com" but its not working either. What am I missing?

var results = document.getElementsByTagName("a");
for ( var i=0; i<results.length; i++ ) {
    if (
        results[i].href.indexOf("http://www.unwantedsites.com") == 0 ) {
        results[i].parentNode.style.display = "none";
    }
}
A: 

try using getAttribute instead of directly accessing the property href:

if ( results[i].getAttribute("href").indexOf("http://www.unwantedsites.com") == 0 ) {
Marius
That didn't work either.I have all the "Included Pages" set correctly.
+1  A: 

Maybe make the condition a little looser? Maybe instead of:

results[i].href.indexOf("http://www.unwantedsites.com") == 0 )

do:

results[i].href.indexOf("unwantedsites.com") >= 0 )
Matt Blaine