logs/script.js
author Stiletto <blasux@blasux.ru>
Wed, 24 Oct 2012 00:37:31 +0400
changeset 7 a49fb1ec5e2a
parent 3 dd7a02c6d476
child 9 d3260253f0bd
permissions -rw-r--r--
Send a reason when interrupted by sigint
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3
dd7a02c6d476 muc log, updated example config
Stiletto <blasux@blasux.ru>
parents:
diff changeset
     1
window.onload = function () {
dd7a02c6d476 muc log, updated example config
Stiletto <blasux@blasux.ru>
parents:
diff changeset
     2
    var log = document.getElementById("log");
dd7a02c6d476 muc log, updated example config
Stiletto <blasux@blasux.ru>
parents:
diff changeset
     3
    var rows = log.getElementsByTagName("tr");
dd7a02c6d476 muc log, updated example config
Stiletto <blasux@blasux.ru>
parents:
diff changeset
     4
    var rownum = rows.length;
dd7a02c6d476 muc log, updated example config
Stiletto <blasux@blasux.ru>
parents:
diff changeset
     5
    for (var i = 0; i < rownum; i++) {
dd7a02c6d476 muc log, updated example config
Stiletto <blasux@blasux.ru>
parents:
diff changeset
     6
        var row = rows[i];
dd7a02c6d476 muc log, updated example config
Stiletto <blasux@blasux.ru>
parents:
diff changeset
     7
        if (row.getAttribute("class") == "message") {
dd7a02c6d476 muc log, updated example config
Stiletto <blasux@blasux.ru>
parents:
diff changeset
     8
            var nicktd = row.getElementsByClassName("nick")[0];
dd7a02c6d476 muc log, updated example config
Stiletto <blasux@blasux.ru>
parents:
diff changeset
     9
            if (nicktd) {
dd7a02c6d476 muc log, updated example config
Stiletto <blasux@blasux.ru>
parents:
diff changeset
    10
                var nick = nicktd.textContent;
dd7a02c6d476 muc log, updated example config
Stiletto <blasux@blasux.ru>
parents:
diff changeset
    11
                var sum = 0;
dd7a02c6d476 muc log, updated example config
Stiletto <blasux@blasux.ru>
parents:
diff changeset
    12
                for( var j = 0, iTop = nick.length; j < iTop; j++ ) {
dd7a02c6d476 muc log, updated example config
Stiletto <blasux@blasux.ru>
parents:
diff changeset
    13
                    sum += 0x56 ^ nick.charCodeAt(j);
dd7a02c6d476 muc log, updated example config
Stiletto <blasux@blasux.ru>
parents:
diff changeset
    14
                }
dd7a02c6d476 muc log, updated example config
Stiletto <blasux@blasux.ru>
parents:
diff changeset
    15
                nicktd.setAttribute("class","nick nick"+(sum % 10));
dd7a02c6d476 muc log, updated example config
Stiletto <blasux@blasux.ru>
parents:
diff changeset
    16
            }
dd7a02c6d476 muc log, updated example config
Stiletto <blasux@blasux.ru>
parents:
diff changeset
    17
        }
dd7a02c6d476 muc log, updated example config
Stiletto <blasux@blasux.ru>
parents:
diff changeset
    18
    }
dd7a02c6d476 muc log, updated example config
Stiletto <blasux@blasux.ru>
parents:
diff changeset
    19
};