From 9fa30708644ced53eef94625347d86c4d88061fd Mon Sep 17 00:00:00 2001 From: Silver Kuusik Date: Sat, 27 Jan 2018 13:03:21 +0100 Subject: [PATCH] add enter key listener to robot ID input --- sumorobot.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sumorobot.js b/sumorobot.js index b03033c..bc883fc 100755 --- a/sumorobot.js +++ b/sumorobot.js @@ -511,6 +511,14 @@ window.onload = function() { workspace.highlightBlock(lastHighlighted, false); }); + /* enter listener on robot ID field */ + $("#robot-id").keypress(function(e) { + if (e.which == 13) { + /* simulate robot GO button click */ + $(".btn-robot-go").click(); + } + }); + /* robot number button listener */ $(".btn-robot-go").click(function() { /* extract and validate the selected robot ID */