3
|
1 |
window.onload = function () { |
|
2 |
var log = document.getElementById("log"); |
|
3 |
var rows = log.getElementsByTagName("tr"); |
|
4 |
var rownum = rows.length; |
9
|
5 |
var urlRegex =/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig; |
3
|
6 |
for (var i = 0; i < rownum; i++) { |
|
7 |
var row = rows[i]; |
|
8 |
if (row.getAttribute("class") == "message") { |
9
|
9 |
/*var nicktd = row.getElementsByClassName("nick")[0]; |
3
|
10 |
if (nicktd) { |
|
11 |
var nick = nicktd.textContent; |
|
12 |
var sum = 0; |
|
13 |
for( var j = 0, iTop = nick.length; j < iTop; j++ ) { |
|
14 |
sum += 0x56 ^ nick.charCodeAt(j); |
|
15 |
} |
|
16 |
nicktd.setAttribute("class","nick nick"+(sum % 10)); |
9
|
17 |
}*/ |
|
18 |
var texttd = row.getElementsByClassName("text")[0]; |
|
19 |
if (texttd) { |
|
20 |
texttd.innerHTML = texttd.innerHTML.replace(urlRegex, function(url) { |
|
21 |
return '<a href="' + url + '">' + url + '</a>'; |
|
22 |
}); |
3
|
23 |
} |
|
24 |
} |
|
25 |
} |
|
26 |
}; |