Enter key sends command

Sending a command also clears the field.
master
Tom 2013-03-11 10:38:41 -04:00
parent 09adb8dfda
commit 2904bd62d7
1 changed files with 9 additions and 1 deletions

View File

@ -1480,7 +1480,7 @@ $(function() {
//~~ Terminal //~~ Terminal
$("#terminal-send").click(function () { $("#terminal-send").click(function () {
var command = $("#terminal-command").val(); var command = $("#terminal-command").val();
if (command) { if (command) {
$.ajax({ $.ajax({
@ -1490,7 +1490,15 @@ $(function() {
contentType: "application/json; charset=UTF-8", contentType: "application/json; charset=UTF-8",
data: JSON.stringify({"command": command}) data: JSON.stringify({"command": command})
}) })
$("#terminal-command").val('')
} }
})
$("#terminal-command").keyup(function(event){
if(event.keyCode == 13){
$("#terminal-send").click()
}
}) })
//~~ Gcode upload //~~ Gcode upload