Convert non-clickable links to clickable links

Dec 04, '09 07:30:02AM

Contributed by: dzg

This bookmarklet will convert "cold-links" (i.e. URLs which do not link) into clickable hotlinks. This is from the krapplack.de collection of bookmarklets, where you can find a number of other potentially useful bookmarklets.

Create a new bookmark with a name like Linkify, and use the following text as the address (or whatever your browser labels the URL field):

javascript:(function(){var%20D=document;%20D.body.normalize();%20F(D.body);%20function%20F(n){var%20u,A,M,R,c,x;%20if(n.nodeType==3){%20u=n.data.search(/https?\:\/\/[^\s]*[^.,;'%22>\s\)\]]/);%20if(u>=0)%20{%20M=n.splitText(u);%20R=M.splitText(RegExp.lastMatch.length);%20A=document.createElement(%22A%22);%20A.href=M.data;%20A.appendChild(M);%20R.parentNode.insertBefore(A,R);%20}%20}else%20if(n.tagName!=%22STYLE%22%20&&%20n.tagName!=%22SCRIPT%22%20&&%20n.tagName!=%22A%22)for(c=0;x=n.childNodes[c];++c)F(x);%20}%20})();
I added this to my Safari bookmarks bar at the far left, so I can invoke it just by hitting Command-1.

[robg adds: I haven't tested this one.]

Comments (7)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20091122135346690