Thanks for including a link to the page your running it on, that helps
your case a lot.  For one thing I made a mistake posting my code, it
should probably be [CONTEXT].getElementsByTagName('A').  For your
purposes you can probably just put document or document.body for
[context], although narrowing your start element down will speed up
the search.  Chances are your not getting in the loop yet, and elms
has zero items, but this should all be easy for you to confirm with
GM_log(elms.length) or the dreaded alert(elms.length) before the
loop.  If you tracing stuff within the loop then don't use alert
because you'll have to close a zillion dialogs.

In any case since you posted the link:
var elms = document.getElementsByTagName('a');
for( i in elms ){
 if( typeof(elms[i].href) != 'undefined' && elms[i].href.indexOf
('anonym.to') > 0 )
        elms[i].href=unescape(elms[i].href.replace('h t t p : / / w w w .
anonym.to/?',''));
}

Added another test, because not all A tags had a HREF, and not all a
tags were anonym links either, so this only applies the replace to the
specified links.  Remove the extra spaces from the URL.

On Nov 3, 12:57 pm, "Jamie.ds" <[email protected]> wrote:
> Don't think think there is a relative link, heres the link im on 
> abouthttp://da-forums.info/viewtopic.php?search_id=1844107524&t=567
> in the top post.
>
> On 3 Nov, 13:53, Anthony Lieuallen <[email protected]> wrote:
>
>
>
> > On 11/03/09 02:20, cc wrote:
>
> > > Finally, it occurs to me that these hrefs may be relative, e.g.
> > > '?[LINK]' rather than 'http://www.anonym.to/?[LINK]'; check on that with
> > > View Source or Firebug (tooltips and status bar will not help here).
>
> > The element.href style access always gives you the full URL.  Doing
> > element.getAttribute('href') gives you the content actually in the href
> > attribute, which may be i.e. a relative link.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"greasemonkey-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/greasemonkey-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to