« June 2011 | Main | September 2011 »
July 25, 2011
Link bare URLs in a HTML element
function link_em(da_id){
try{ var tml = document.getElementById(da_id).innerHTML; } catch(e){ return false; }
var reg = /[^href\=\"](http|https):\/\/([-\w\.]+)+(:\d+)?(\/([\w/_\.]*(\?\S+)?)?)?\/?/gm;
var list = [];
list = tml.match(reg);
var count = 0;
for(i in list){
if(list[i]){ if(list[i] != document.getElementById(da_id).innerHTML){ if( parseInt(list[i]) + '' != list[i]){
count++;
tml = tml.replace(list[i].replace(/\(/,''), '<a href="' + list[i].replace(/\(/,'') + '">' + list[i].replace(/\(/,'') + '</a>');
}}}
}
try{ if(list[0]){
document.getElementById(da_id).innerHTML = tml;
} } catch(e){ var blah = ''; }
}
Posted by pj at 04:38 PM | Comments (0)
July 12, 2011
Online IDE for Node.js
Interwebs IDE hits the mother Node • The Register
Posted by pj at 06:20 PM | Comments (0)