Wednesday, March 7, 2007

Greasemonkey script: Select text to make temporary link

Not the most impressive code (I still don't understand closures in JS fully), but it works with what I've tested it on..

Select a text-link, and a temporary pop-up with a real link is created from the selection. Se picture at the end.

Tested in Opera 9.x (download/put it in the user-script folder) and FireFox 2.0.

The script

Example URLs:
www.google.com
www.google.com/analytics



Opera - User JS
About greasemonkey

Update 1: I've found some sites it doesn't work on. I will try to find out the difference between sites that work, and sites that don't. Probably JS-libs used on the sites messing with my script. :8

Update2: I've no rewritten the script so that is doesn't add any symbols to the global namespace.

Result of running the script through JSLint:
Global: document (?), setTimeout (?), window (?)

0 comments: