summaryrefslogtreecommitdiff
path: root/js/codeq/hint.js
diff options
context:
space:
mode:
authorTimotej Lazar <timotej.lazar@araneo.org>2015-09-18 16:24:32 +0200
committerTimotej Lazar <timotej.lazar@araneo.org>2015-09-18 16:24:32 +0200
commitffeb1a12491780d489d96dd7159a09b5fd16090c (patch)
treefc3e83f2c56799d6855d05b91c49574cdaf3c6ff /js/codeq/hint.js
parentb9ff4650857cc34a795613281d576196345359ee (diff)
Add "Plan" button to display next "planning" hint
Diffstat (limited to 'js/codeq/hint.js')
-rw-r--r--js/codeq/hint.js13
1 files changed, 12 insertions, 1 deletions
diff --git a/js/codeq/hint.js b/js/codeq/hint.js
index 06eceb0..c06aef7 100644
--- a/js/codeq/hint.js
+++ b/js/codeq/hint.js
@@ -7,9 +7,10 @@
var firstCharacterPos = {'line': 0, 'ch': 0},
sel_no_scroll = {'scroll': false};
- codeq.makeHinter = function (jqHints, jqEditor, editor, hintDefs) {
+ codeq.makeHinter = function (jqHints, jqEditor, editor, hintDefs, planDef) {
var hintCounter = 0, // for generating unique class-names
hintCleaners = [],
+ planIdx = 0,
clearHints = function () {
var i;
@@ -124,6 +125,16 @@
};
return {
+ /** Display the next "planning" hint and return whether there are
+ * any more available.
+ */
+ 'planNext': function () {
+ if (planIdx < planDef.length) {
+ jqHints.append('<div class="plan">' + planDef[planIdx++] + '</div>');
+ }
+ return planIdx < planDef.length;
+ },
+
/**
* Processes and display appropriately the server hints.
* TODO: sort hints so static and popup hints come first, and a (single) drop-down hint last