// ==UserScript==
// @name           linkify
// @namespace      http://www.squarefree.com/bookmarklets/loganalysis.html#linkify
// @description    turns text URLs to links
// @include        *
// ==/UserScript==

// reformatted source of:
// the "Linkify" bookmarklet by (most probably) Jesse Ruderman
// http://www.squarefree.com/bookmarklets/loganalysis.html#linkify
// you may try more complex (and demanding) variation, try:
// the "Linkifier Plus" GM script
// http://userscripts.org/scripts/show/6128

function linkify() {
 // reformatted source of
 // http://www.squarefree.com/bookmarklets/loganalysis.html#linkify
 var D = document;
 D.body.normalize();
 function F(n){
  var u, A, M, R, c, x;
  if ( n.nodeType == 3 ) {
   u = n.data.search(/https?\:\/\/[^\s]*[^.,;'">\s\)\]]/);
   if ( u >= 0 ) {
    M = n.splitText(u);
    R = M.splitText(RegExp.lastMatch.length);
    A = document.createElement("A");
    A.href = M.data;
    A.appendChild(M);
    R.parentNode.insertBefore(A,R);
   }
  } else if ( n.tagName != "STYLE"
           && n.tagName != "SCRIPT"
           && n.tagName != "A" ) {
   for ( c = 0; x = n.childNodes[c]; ++c ) {
    F(x);
   }
  }
 }
 F(D.body);
 // end
}

try {
 linkify();
} catch(er) {
 GM_log(er);
}

