From 7ea27bdfb403cadfdc92d9f9273e9e419be07306 Mon Sep 17 00:00:00 2001 From: Silver Kuusik Date: Sun, 8 Apr 2018 20:46:36 +0300 Subject: [PATCH] Update sumorobot.js --- assets/js/sumorobot.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/assets/js/sumorobot.js b/assets/js/sumorobot.js index 19b8bad..1fd71e0 100755 --- a/assets/js/sumorobot.js +++ b/assets/js/sumorobot.js @@ -52,7 +52,7 @@ Sumorobot.prototype.connect = function() { /* send a ping to the robot */ //console.log("ping the robot") self.send("ping"); - }, 2000); + }, 500); }; /* when the WebSocket closes */ this.websocket.onclose = function(evt) { @@ -518,6 +518,16 @@ window.onload = function() { $(".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 */ $(".btn-robot-go").click(function() {