]>
git.scottworley.com Git - reliable-chat/blob - webclient/rc.js
8e565c588ffd93a7a5ddd171670a2becf33f2b84
1 var servers
= ['chkno.net', 'localhost']
3 var session
= Math
.random();
5 function addport(server
) {
6 // Add the default port if server doesn't contain a port number already
7 if (server
.indexOf(":") == -1) {
8 return server
+ ":21059";
14 function rcsend(d
, message
) {
15 var id
= new Date().getTime() + "-" + session
+ "-" + Math
.random();
17 "?id=" + encodeURIComponent(id
) +
18 "&text=" + encodeURIComponent(message
);
20 var uri
= "http://" + addport(servers
[i
]) + path
;
21 var img
= document
.createElement("img");
22 img
.setAttribute("src", uri
);
27 function rckeydown(event
) {
28 if (event
.keyCode
== 13) {
29 var d
= document
.createElement("div");
30 d
.appendChild(document
.createTextNode(document
.input
.say
.value
));
31 var h
= document
.getElementById("history");
33 window
.scrollTo(0, document
.body
.scrollHeight
);
34 rcsend(d
, document
.input
.say
.value
);
35 document
.input
.say
.value
= "";