summaryrefslogtreecommitdiff
path: root/js/codeq/prolog.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/codeq/prolog.js')
-rw-r--r--js/codeq/prolog.js37
1 files changed, 3 insertions, 34 deletions
diff --git a/js/codeq/prolog.js b/js/codeq/prolog.js
index b2ea3e1..3d34423 100644
--- a/js/codeq/prolog.js
+++ b/js/codeq/prolog.js
@@ -33,9 +33,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
jqAllQuadrants = jqDescription.add(jqCode).add(jqConsole).add(jqInfo), // all the quadrants
// buttons
jqBtnPlan = jqScreen.find('.btn-plan'),
- jqBtnHint = jqScreen.find('.btn-hint').ladda(),
jqBtnTest = jqScreen.find('.btn-test').ladda(),
- jqAllButtons = jqBtnPlan.add(jqBtnHint).add(jqBtnTest), // all the buttons
+ jqAllButtons = jqBtnPlan.add(jqBtnTest), // all the buttons
// misc
currentSubState = null,
transitionEventName = 'mousedown',//event name of the event which will trigger the transition between these substates - the most common transition at least (there are some corner cases on the hint and test buttons -> see the code below)
@@ -251,7 +250,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
}),
activityHandler = codeq.makeActivityHandler(editor, problemDef.id),
terminal = makePrologTerminalHandler(jqTerminal, editor, problemDef.id, activityHandler),
- hinter = codeq.makeHinter(jqHints, jqEditor, editor, 'prolog_hints', problemDef, commonDef),
+ hinter = codeq.makeHinter(jqHints, jqEditor, editor, 'prolog_hints', problemDef, commonDef, activityHandler),
commError = function (error) {
alert(error);
};
@@ -279,42 +278,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
});
jqBtnPlan.on('click', function () {
- activityHandler.queueTrace({'typ': 'plan'});
if (!hinter.planNext()) {
jqBtnPlan.prop('disabled', true).blur();
}
});
- jqBtnHint.on('click', function () {
- editor.setOption('readOnly', true);
- terminal.inputDisable();
- jqBtnTest.prop('disabled', true);
- jqBtnHint.ladda('start');
- codeq.comms.sendHint({
- 'program': editor.getDoc().getValue(),
- 'problem_id': problemDef.id
- })
- .then(function (data) {
- if (data.code === 0) {
- activityHandler.queueTrace({'typ': 'hint', 'feedback': data.hints});
- hinter.handle(data.hints);
- }
- else {
- terminal.append(data.message + '\n', 'error');
- }
- })
- .fail(commError)
- .fin(function () {
- editor.setOption('readOnly', false);
- terminal.inputEnable();
- jqBtnHint.ladda('stop');
- jqBtnTest.prop('disabled', false);
- })
- .done();
- });
+
jqBtnTest.on('click', function () {
editor.setOption('readOnly', true);
terminal.inputDisable();
- jqBtnHint.prop('disabled', true);
jqBtnTest.ladda('start');
codeq.comms.sendTest({
'program': editor.getDoc().getValue(),
@@ -322,7 +293,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
})
.then(function (data) {
if (data.code === 0) {
- activityHandler.queueTrace({'typ': 'test', 'feedback': data.hints});
hinter.handle(data.hints);
}
else {
@@ -334,7 +304,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
editor.setOption('readOnly', false);
terminal.inputEnable();
jqBtnTest.ladda('stop');
- jqBtnHint.prop('disabled', false);
})
.done();
});