diff --git a/navig-driver.js b/navig-driver.js index e2464b12719100675aa05f1a21228f5e28e6d257..63b1dc1059e0326b84ceb8c8968c44508da76771 100644 --- a/navig-driver.js +++ b/navig-driver.js @@ -99,6 +99,7 @@ function setSourceCode(text) { $("#source_code").val(text); if (source !== null) { source.setValue(text); + buttonRunHandler(); } } @@ -203,11 +204,13 @@ $("#navigation_step").change(function(e) { stepTo(n); }); -$("#button_run").click(function() { +function buttonRunHandler() { var message = readSourceParseAndRun(); $("#action_output").html(message); var timeoutID = window.setTimeout(function() { $("#action_output").html(""); }, 1000); -}); +}; + +$("#button_run").click(buttonRunHandler); $("#button_reset").click(function() { reset(); }); // stepTo(0);