-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjavascript.js
27 lines (24 loc) · 893 Bytes
/
javascript.js
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
$(document).ready(function() {
var i = 0;
$("#cmd0").focus();
$("body").on('keydown', '.cmd',function(e) {
if (e.keyCode == 13) {
e.preventDefault();
var id_old = "#cmd"+i;
$(id_old).attr('readonly', true);
var child_process = require('child_process');
function getChildProcessData(){
var child_process_exec = $(id_old).val();
return child_process_exec;
}
var output = child_process.execSync(getChildProcessData());
var text = '<li>'+output+'</li>';
$("#command_line").append(text);
i++;
var text = '<li>shell: <input type="textarea" class="cmd" id="cmd' + i + '"></li>';
$("#command_line").append(text);
var selector = "#cmd" + i;
$(selector).focus();
}
})
});