3
|
1 |
window.onload = function () { |
|
2 |
var log = document.getElementById("log"); |
|
3 |
var rows = log.getElementsByTagName("tr"); |
|
4 |
var rownum = rows.length; |
|
5 |
for (var i = 0; i < rownum; i++) { |
|
6 |
var row = rows[i]; |
|
7 |
if (row.getAttribute("class") == "message") { |
|
8 |
var nicktd = row.getElementsByClassName("nick")[0]; |
|
9 |
if (nicktd) { |
|
10 |
var nick = nicktd.textContent; |
|
11 |
var sum = 0; |
|
12 |
for( var j = 0, iTop = nick.length; j < iTop; j++ ) { |
|
13 |
sum += 0x56 ^ nick.charCodeAt(j); |
|
14 |
} |
|
15 |
nicktd.setAttribute("class","nick nick"+(sum % 10)); |
|
16 |
} |
|
17 |
} |
|
18 |
} |
|
19 |
}; |