3
function make_query_string(pagename, args)
10
// vals can be an array, to make multiple args with the same name
11
// To handle this, make non-array objects into an array, then loop
12
if (!(vals instanceof Array))
14
for each (val in vals)
25
qs += encodeURI(key) + "=" + encodeURI(val);
31
function enter_line(inp)
33
var digest = hex_md5(inp + magic);
34
var url = make_query_string("chat", {"digest":digest, "text":inp});
35
var xmlhttp = XMLHttpRequest();
36
xmlhttp.open("POST", url, false);
38
var res = JSON.parse(xmlhttp..responseText);
42
// print out the output (res[0])
43
// print out the return value (res[1])
44
// set the prompt to >>>
49
// print out the error message (res[2])
53
// Need more input, so set the prompt to ...