[Greasemonkey] Convert links to TinyURLs
sam foster
potatosculptor at gmail.com
Fri Aug 25 10:15:48 EDT 2006
You might also want to check the href attribute exists before you
attempt to match it. Some might just hold internal anchors: <a
name="top"></a>
So:
if ((alinkholder[i].href.match('http://'))&&(alinkholder[i].href.length>23))
becomes
var alink = alinkholder[i];
if(alink.href && (alink.href.match('http://'))&&(alink.href.length>23))
Sam
On 8/25/06, Brendan J <verifex at gmail.com> wrote:
> Hello,
>
> I threw this thing together today as thought it would be useful for getting
> TinyURLs from links without having to leave the page. Any comments are
> welcome.
>
> http://userscripts.org/scripts/show/5314
>
> Also, I was wondering if there was a cleaner way of achieving this same
> result? Creating an element to store the ID of the link to be converted so
> the GM_xmlhttpRequest function can find the unique URL seems really messy,
> but I couldn't think of another way to reference the calling element. Is
> there a DOM way to walk to the URL in question? Or is there a way to pass
> variables through these functions? Or is there some other method I'm
> missing?
>
> Thanks,
>
> Brendan Crosser-McGay
More information about the Greasemonkey
mailing list