Update sumorobot.js

This commit is contained in:
Silver Kuusik 2018-04-08 20:46:36 +03:00 committed by GitHub
parent fe28b73ec0
commit 7ea27bdfb4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -52,7 +52,7 @@ Sumorobot.prototype.connect = function() {
/* send a ping to the robot */ /* send a ping to the robot */
//console.log("ping the robot") //console.log("ping the robot")
self.send("ping"); self.send("ping");
}, 2000); }, 500);
}; };
/* when the WebSocket closes */ /* when the WebSocket closes */
this.websocket.onclose = function(evt) { this.websocket.onclose = function(evt) {
@ -518,6 +518,16 @@ window.onload = function() {
$(".btn-robot-go").click(); $(".btn-robot-go").click();
} }
}); });
/* when robot-id input field gets focused */
$("#robot-id").focus(function() {
/* if there is no value in the robot-id input field */
if (!$("#robot-id").val()) {
/* add "sumo-" to the input field so the user */
/* just has to add the robot ID */
$("#robot-id").val("sumo-");
}
});
/* robot number button listener */ /* robot number button listener */
$(".btn-robot-go").click(function() { $(".btn-robot-go").click(function() {