slayeroffice - web experiments gone horribly awry

Looking for the drawings? They're over here, and my drawing blog is this way.

Text To Link Favelet

  • Current Version: 1.0
  • Last Revision: 02.10.04
  • Requires: MSIE 6, Firefox 0.8+, Mozilla 1.3+, Netscape 7+, Opera 7+
  • Language: Javascript

This favelet will loop over an HTML document and turn any text it finds that looks like a URL into a link.

It works by splitting any text node it finds into an array, checking each index in the resulting array for common characters found in a URL, wrapping that index in an A tag, inserting a SPAN element with the href as its innerHTML using insertBefore and finally removing the original text node from the DOM.

To add to your favorites, right click the appropriate link for you browser of choice and select "Add to Favorites" or "Bookmark this Link" depending on what that choice is.

For Non-MSIE 6: Text To Link
For MSIE 6: Text To Link

The source code for the two are identical, but I wasn't able to get it down to MSIE6's required 506 (or is it 502? I cant recall...) character maximum, so its link creates a script object that references the source on slayeroffice. I went with two options because the way its done for MSIE works in most things but Opera 7 and I didn't want to exclude that browser.

The following is a bunch of text for demonstration purposes. Click on the favelet link to see it turn the text into links.