Extra caution is recommended when installing recently uploaded/updated scripts (read more)
Be sure you trust any scripts you install

Link Accoutrements

Append a small icon to mailto, PDF, doc, xls, & ppt links

Append a small icon to mailto, PDF, doc, xls, & ppt links.

This is based off of b10m's Link Warning script and utilizing the free icons from famfamfam.

updated 10.01.2006. case insensitive matching. improved styling. email icon not placed when link text is email address or says email.

updated 10.17.2006. icon not placed if img is inside the link.

note 11.28.2006. I likely won't be updating this script again. I'm now using the firefox extension Link Alert to accomplish the same feat. I suggest you check it out. (And of course, play with my code all you like)




Jun 21, 2008
FAOD User

@az1d:
Just add an extra \ to the regular expression so that the . is quoted as regular expression:

var re_pdf = new RegExp("\\.pdf$","i");
...

 
Jul 4, 2007
az1d User

Great script. I used the original for ages but find this much better.

Any chance you can update this script so that it only picks up on .pdf .doc etc, rather than without the dot, cause I get a lot of false positives.

Thanks for the recommendation of the similar extension, unfortunately I tend to click without hovering.

 
Jan 6, 2007
Aaron 2 User

Love it, very cool!

 
Nov 29, 2006
Andrew Penne... Scriptwright

I made a prepending one: http://userscripts.org/scripts/show/6539. Thanks for using Creative Commons.

 
Nov 11, 2006
B10m Scriptwright

Nice work :)

 
Nov 10, 2006
Schlick User

Thanks for the quick response Paul. It works as expected.

 
Oct 17, 2006
Paul Irish Script's author

Hi Michael. I updated the script to do this. If the lastChild of the link element is an IMG, it won't place an image. Hopefully that works nicely. Thanks for the feedback!

 
Oct 5, 2006
Schlick User

Is it possible to not display the icons if the link element surrounds an image? For example, an author may have already added icons to their links and linked both the text and the icon. In this case your script will add an extra icon.

 
Oct 4, 2006
Schlick User

Fantastic!

You could comment on this script if you were logged in.