Commit d7dbbefa authored by Taddeüs Kroes's avatar Taddeüs Kroes

Editor now allows only one request at a time to prevent duplicated input statements

parent 19388045
...@@ -217,11 +217,15 @@ ...@@ -217,11 +217,15 @@
error.hide(); error.hide();
}; };
var pending_request = false;
function show_loader() { function show_loader() {
pending_request = true;
loader.css('visibility', 'visible'); loader.css('visibility', 'visible');
}; };
function hide_loader() { function hide_loader() {
pending_request = false;
loader.css('visibility', 'hidden'); loader.css('visibility', 'hidden');
clear_error(); clear_error();
}; };
...@@ -251,7 +255,7 @@ ...@@ -251,7 +255,7 @@
$('#btn-hint').click(function() { $('#btn-hint').click(function() {
var input = input_textarea.val(); var input = input_textarea.val();
if (!$.trim(input).length) if (pending_request || !$.trim(input).length)
return; return;
show_loader(); show_loader();
...@@ -276,7 +280,7 @@ ...@@ -276,7 +280,7 @@
$('#btn-step').click(function() { $('#btn-step').click(function() {
var input = input_textarea.val(); var input = input_textarea.val();
if (!$.trim(input).length) if (pending_request || !$.trim(input).length)
return; return;
show_loader(); show_loader();
...@@ -307,7 +311,7 @@ ...@@ -307,7 +311,7 @@
$('#btn-validate').click(function() { $('#btn-validate').click(function() {
var input = input_textarea.val(); var input = input_textarea.val();
if (!$.trim(input).length) if (pending_request || !$.trim(input).length)
return; return;
show_loader(); show_loader();
...@@ -353,7 +357,7 @@ ...@@ -353,7 +357,7 @@
$('#btn-answer').click(function() { $('#btn-answer').click(function() {
var input = input_textarea.val(); var input = input_textarea.val();
if (!$.trim(input).length) if (pending_request || !$.trim(input).length)
return; return;
show_loader(); show_loader();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment