Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //-----javascript---code
- var D=document;
- D.body.normalize();
- F(D.body);
- 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);
- }
- }
- //-----bookmarklet---version
- 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]*[^.,;'">\s\)\]]/);%20if(u>=0)%20{%20M=n.splitText(u);%20R=M.splitText(RegExp.lastMatch.length);%20A=document.createElement("A");%20A.href=M.data;%20A.appendChild(M);%20R.parentNode.insertBefore(A,R);%20}%20}else%20if(n.tagName!="STYLE"%20&&%20n.tagName!="SCRIPT"%20&&%20n.tagName!="A")for(c=0;x=n.childNodes[c];++c)F(x);%20}%20})();
- Source: http://forums.mozillazine.org/viewtopic.php?f=38&t=1045955
Advertisement
Add Comment
Please, Sign In to add comment