summaryrefslogtreecommitdiff
path: root/js/codeq/python.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/codeq/python.js')
-rw-r--r--js/codeq/python.js16
1 files changed, 14 insertions, 2 deletions
diff --git a/js/codeq/python.js b/js/codeq/python.js
index e856c08..c5f7df6 100644
--- a/js/codeq/python.js
+++ b/js/codeq/python.js
@@ -97,9 +97,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);
},
@@ -107,9 +109,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);
},
@@ -221,7 +225,8 @@
var makePythonTerminalHandler = function (jqConsole, editor, problem_id, activityHandler) {
var terminal = codeq.makeConsole(jqConsole, {
- 'greeting': 'CodeQ Python terminal proxy'
+ 'greeting': 'CodeQ Python terminal proxy',
+ 'autoHistory': true
}),
tcs = function terminalCommandSuccess (data) {
if (data.code !== 0) {
@@ -312,11 +317,12 @@
editor = CodeMirror(jqEditor[0], { cursorHeight: 0.85, lineNumbers: true, matchBrackets: true, mode: 'python' }),
activityHandler = makeActivityHandler(editor, problem.id),
terminal = makePythonTerminalHandler(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(),
@@ -331,6 +337,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 () {
var doc = editor.getDoc();
codeq.comms.sendHint({