summaryrefslogtreecommitdiff
path: root/js/codeq
diff options
context:
space:
mode:
Diffstat (limited to 'js/codeq')
-rw-r--r--js/codeq/prolog.js14
-rw-r--r--js/codeq/python.js18
-rw-r--r--js/codeq/robot.js7
3 files changed, 29 insertions, 10 deletions
diff --git a/js/codeq/prolog.js b/js/codeq/prolog.js
index b73d037..6b7da9c 100644
--- a/js/codeq/prolog.js
+++ b/js/codeq/prolog.js
@@ -16,8 +16,8 @@
jqAllQuadrants = jqDescription.add(jqCode).add(jqConsole).add(jqInfo), // all the quadrants
// buttons
jqBtnPlan = jqScreen.find('.btn-plan'),
- jqBtnHint = jqScreen.find('.btn-hint'),
- jqBtnTest = jqScreen.find('.btn-test'),
+ jqBtnHint = jqScreen.find('.btn-hint').ladda(),
+ jqBtnTest = jqScreen.find('.btn-test').ladda(),
jqAllButtons = jqBtnPlan.add(jqBtnHint).add(jqBtnTest), // all the buttons
// misc
currentSubState = null,
@@ -245,7 +245,8 @@
jqBtnHint.on('click', function () {
terminal.append('hint.\n', 'input');
terminal.inputDisable();
- var doc = editor.getDoc();
+ jqBtnTest.prop('disabled', true);
+ jqBtnHint.ladda('start');
codeq.comms.sendHint({
'language': 'prolog',
'program': editor.getDoc().getValue(),
@@ -264,13 +265,16 @@
.fin(function () {
terminal.inputEnable();
terminal.append('?- ', 'output');
+ jqBtnHint.ladda('stop');
+ jqBtnTest.prop('disabled', false);
})
.done();
});
jqBtnTest.on('click', function () {
terminal.append('test.\n', 'input');
terminal.inputDisable();
- var doc = editor.getDoc();
+ jqBtnHint.prop('disabled', true);
+ jqBtnTest.ladda('start');
codeq.comms.sendTest({
'language': 'prolog',
'program': editor.getDoc().getValue(),
@@ -289,6 +293,8 @@
.fin(function () {
terminal.inputEnable();
terminal.append('?- ', 'output');
+ jqBtnTest.ladda('stop');
+ jqBtnHint.prop('disabled', false);
})
.done();
});
diff --git a/js/codeq/python.js b/js/codeq/python.js
index 35c4be8..bd5d96e 100644
--- a/js/codeq/python.js
+++ b/js/codeq/python.js
@@ -18,8 +18,8 @@
jqAllQuadrants = jqDescription.add(jqCode).add(jqConsole).add(jqInfo), // all the quadrants
// buttons
jqBtnPlan = jqScreen.find('.btn-plan'),
- jqBtnHint = jqScreen.find('.btn-hint'),
- jqBtnTest = jqScreen.find('.btn-test'),
+ jqBtnHint = jqScreen.find('.btn-hint').ladda(),
+ jqBtnTest = jqScreen.find('.btn-test').ladda(),
jqBtnRun = jqScreen.find('.btn-run'),
jqBtnStop = jqScreen.find('.btn-stop'),
jqInfoButtons = jqBtnPlan.add(jqBtnHint).add(jqBtnTest), // all info-focusing buttons
@@ -203,7 +203,8 @@
}
});
jqBtnHint.on('click', function () {
- var doc = editor.getDoc();
+ jqBtnTest.prop('disabled', true);
+ jqBtnHint.ladda('start');
codeq.comms.sendHint({
'language': 'python',
'program': editor.getDoc().getValue(),
@@ -219,10 +220,15 @@
}
})
.fail(commError)
+ .fin(function () {
+ jqBtnHint.ladda('stop');
+ jqBtnTest.prop('disabled', false);
+ })
.done();
});
jqBtnTest.on('click', function () {
- var doc = editor.getDoc();
+ jqBtnHint.prop('disabled', true);
+ jqBtnTest.ladda('start');
codeq.comms.sendTest({
'language': 'python',
'program': editor.getDoc().getValue(),
@@ -238,6 +244,10 @@
}
})
.fail(commError)
+ .fin(function () {
+ jqBtnTest.ladda('stop');
+ jqBtnHint.prop('disabled', false);
+ })
.done();
});
jqBtnRun.on('click', function () {
diff --git a/js/codeq/robot.js b/js/codeq/robot.js
index a1b76f1..be164ee 100644
--- a/js/codeq/robot.js
+++ b/js/codeq/robot.js
@@ -14,7 +14,7 @@
jqAllQuadrants = jqDescription.add(jqCode).add(jqConsole).add(jqInfo), // all the quadrants
// buttons
jqBtnPlan = jqScreen.find('.btn-plan'),
- jqBtnHint = jqScreen.find('.btn-hint'),
+ jqBtnHint = jqScreen.find('.btn-hint').ladda(),
jqBtnRun = jqScreen.find('.btn-run'),
jqBtnStop = jqScreen.find('.btn-stop'),
jqInfoButtons = jqBtnPlan.add(jqBtnHint), // all info-focusing buttons
@@ -199,7 +199,7 @@
}
});
jqBtnHint.on('click', function () {
- var doc = editor.getDoc();
+ jqBtnHint.ladda('start');
codeq.comms.sendHint({
'language': 'robot',
'program': editor.getDoc().getValue(),
@@ -215,6 +215,9 @@
}
})
.fail(commError)
+ .fin(function () {
+ jqBtnHint.ladda('stop');
+ })
.done();
});
jqBtnRun.on('click', function () {