]> git.scottworley.com Git - reliable-chat/blobdiff - webclient/rc.html
Minor syntax cleanup
[reliable-chat] / webclient / rc.html
index ff78fc0bad03aea4f3f4d1c79738cc3bda5f3a49..97491cdc885decba9854a7c0a0b000f55b56dae2 100644 (file)
 
        function rcaddmessagetohistory(message) {
                var d = document.createElement("div");
-               d.appendChild(document.createTextNode(message));
+               d.appendChild(document.createTextNode(message.Text));
                var h = document.getElementById("history");
                h.appendChild(d);
                window.scrollTo(0, document.body.scrollHeight);
 
        function rcreceivemessages(server, messages) {
                for (var i in messages) {
-                       var seen_key = make_seen_key(messages[i]['ID'], messages[i]['Text']);
+                       var m = messages[i];
+                       var seen_key = make_seen_key(m.ID, m.Text);
                        if (!(seen_key in seen)) {
                                seen[seen_key] = true;
-                               rcaddmessagetohistory(messages[i]['Text']);
+                               rcaddmessagetohistory(m);
                                for (var i in servers) {
                                        rcchangeserverstatus(servers[i], "sad");
                                }
                                                        rcreceivemessages(server, messages);
                                                        delay = 40;
                                                        if (messages.length >= 1 && "Time" in messages[messages.length-1]) {
-                                                               since[server] = messages[messages.length-1]["Time"];
+                                                               since[server] = messages[messages.length-1].Time;
                                                        }
                                                }
                                        }
                        message = "<" + rcnick() + "> " + input;
                }
 
-               var d = rcaddmessagetohistory(message);
+               var d = rcaddmessagetohistory({'Text': message});
                rcsend(d, message);
        }