logs/script.js
changeset 3 dd7a02c6d476
child 9 d3260253f0bd
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/logs/script.js	Tue Oct 23 23:50:28 2012 +0400
@@ -0,0 +1,19 @@
+window.onload = function () {
+    var log = document.getElementById("log");
+    var rows = log.getElementsByTagName("tr");
+    var rownum = rows.length;
+    for (var i = 0; i < rownum; i++) {
+        var row = rows[i];
+        if (row.getAttribute("class") == "message") {
+            var nicktd = row.getElementsByClassName("nick")[0];
+            if (nicktd) {
+                var nick = nicktd.textContent;
+                var sum = 0;
+                for( var j = 0, iTop = nick.length; j < iTop; j++ ) {
+                    sum += 0x56 ^ nick.charCodeAt(j);
+                }
+                nicktd.setAttribute("class","nick nick"+(sum % 10));
+            }
+        }
+    }
+};