blob: 50146e2cf5d9f2884fafaa7c36904243b49cead8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
output_html = ''
urllib = importModule('urllib');
function servlet_comm(s) {
urllib.sendRequest('post',
'?_action_=postrun',
'command=' + escape(s, true),
[['Content-type', 'application/x-www-form-urlencoded']],
add_response);
}
function send_command() {
var command_short = document.getElementById('command');
var command_long = document.getElementById('command_long');
var command = command_short.value;
if (command == '') {
command = command_long.value;
}
if (command == '') {
return false;
}
command_short.value = '';
command_long.value = '';
output_html += '<span class="input">>>> '
+ html_quote(command) + '</span>\n';
servlet_comm(command);
return false;
}
function add_response(res) {
var result = res.responseText;
var command_short = document.getElementById('command');
if (result != null) {
output_html += '<span class="output">'
+ html_quote(result) + '<span>\n';
}
refresh_display();
command_short.focus();
}
function refresh_display() {
var output_div = document.getElementById('output');
output_div.innerHTML = output_html;
}
function html_quote(s) {
return s.replace('&', '&').replace('<', '<');
}
function clear() {
alert(output_html);
output_html = '';
refresh_display();
return false;
}
|