summaryrefslogtreecommitdiff
path: root/js/codeq/prolog.js
diff options
context:
space:
mode:
authorRobert Zorko <robertz@gurucue.com>2015-09-18 18:54:32 +0200
committerRobert Zorko <robertz@gurucue.com>2015-09-18 18:54:32 +0200
commitd1445d6af226de21ecf513ff7aff7d6f7bb82b1c (patch)
tree7a448edac2d6b66feb8979e97ccd7e4ba5e3f6d3 /js/codeq/prolog.js
parent9113815d16d38373b378c6d34000a75f019b219f (diff)
parent5ae5ffc6e86a0181799b6f45167bfb57ea91a32c (diff)
merge conflict occured and is now fixed
Diffstat (limited to 'js/codeq/prolog.js')
-rw-r--r--js/codeq/prolog.js18
1 files changed, 15 insertions, 3 deletions
diff --git a/js/codeq/prolog.js b/js/codeq/prolog.js
index 96c3077..e411bc4 100644
--- a/js/codeq/prolog.js
+++ b/js/codeq/prolog.js
@@ -95,9 +95,11 @@
* add the above function to the buttons
*/
addClickListenerTranstions = function(){
+ $('#btn_code_plan').on('click',clickListenerTransitionFun);
$('#btn_code_hint').on('click',clickListenerTransitionFun);
$('#btn_code_test').on('click',clickListenerTransitionFun);
+ $('#btn_code_plan').on(transitionEventName,mouseDownEventIgnoreFun);
$('#btn_code_hint').on(transitionEventName,mouseDownEventIgnoreFun);
$('#btn_code_test').on(transitionEventName,mouseDownEventIgnoreFun);
},
@@ -105,9 +107,11 @@
* and a function to remove it
*/
removeClickListenerTransition = function(){
+ $('#btn_code_plan').off('click',clickListenerTransitionFun);
$('#btn_code_hint').off('click',clickListenerTransitionFun);
$('#btn_code_test').off('click',clickListenerTransitionFun);
+ $('#btn_code_plan').off(transitionEventName,mouseDownEventIgnoreFun);
$('#btn_code_hint').off(transitionEventName,mouseDownEventIgnoreFun);
$('#btn_code_test').off(transitionEventName,mouseDownEventIgnoreFun);
},
@@ -223,7 +227,8 @@
var promptMode = true, // default: query composition; alternative: query result browsing
manualStop = false,// if the user stopped showing next answers (false) or if there are no more answers (true)
terminal = codeq.makeConsole(jqConsole, {
- 'greeting': 'CodeQ Prolog terminal proxy'
+ 'greeting': 'CodeQ Prolog terminal proxy',
+ 'autoHistory': true
}),
tcs = function terminalCommandSuccess (data) {
var t, lines, i;
@@ -362,11 +367,12 @@
editor = CodeMirror(jqEditor[0], { cursorHeight: 0.85, lineNumbers: true, matchBrackets: true }),
activityHandler = makeActivityHandler(editor, problem.id),
terminal = makePrologTerminalHandler(jqConsole, editor, problem.id, activityHandler),
- hinter = codeq.makeHinter(jqHints, jqEditor, editor, problem.hint);
+ hinter = codeq.makeHinter(jqHints, jqEditor, editor, problem.hint, problem.plan);
editor.setValue(info.solution);
$('#title').text(problem.slug);
jqDescription.html(problem.description);
+ $('#btn_code_plan').prop('disabled', (problem.plan || '').length == 0);
editor.on('change', function (instance, changeObj) {
var doc = editor.getDoc(),
@@ -381,6 +387,12 @@
}
});
+ $('#btn_code_plan').on('click', function () {
+ if (!hinter.planNext()) {
+ $('#btn_code_plan').prop('disabled', true);
+ $('#btn_code_plan').blur();
+ }
+ });
$('#btn_code_hint').on('click', function () {
terminal.append('hint.\n', 'input');
terminal.inputDisable();
@@ -451,4 +463,4 @@
}
};
};
-})(); \ No newline at end of file
+})();