summaryrefslogtreecommitdiff
path: root/js/codeq/hint.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/codeq/hint.js')
-rw-r--r--js/codeq/hint.js23
1 files changed, 22 insertions, 1 deletions
diff --git a/js/codeq/hint.js b/js/codeq/hint.js
index e1c7a6b..1b97afc 100644
--- a/js/codeq/hint.js
+++ b/js/codeq/hint.js
@@ -7,10 +7,11 @@
var firstCharacterPos = {'line': 0, 'ch': 0},
sel_no_scroll = {'scroll': false};
- codeq.makeHinter = function (jqHints, jqEditor, editor, hintDefs, planDef) {
+ codeq.makeHinter = function (jqHints, jqEditor, editor, trNamespace, hintDefsA, commonHintDefsA, planDef) {
var hintCounter = 0, // for generating unique class-names
hintCleaners = [],
planIdx = 0,
+ dictionary = [],
clearHints = function () {
var i;
@@ -130,6 +131,25 @@
}
};
+ codeq.tr.registerDictionary(trNamespace, dictionary);
+
+ // TODO: below is a temporary code to bridge the old implementation with the new data format
+ if (planDef.sl) planDef = planDef.sl;
+ else planDef = planDef.en || [];
+ var hintDefs = {}, t1, t2, k;
+ if (hintDefsA.sl) t1 = hintDefsA.sl;
+ else t1 = hintDefsA.en || {};
+ if (commonHintDefsA.sl) t2 = commonHintDefsA.sl;
+ else t2 = commonHintDefsA.en || {};
+ for (k in t2) {
+ if (!t2.hasOwnProperty(k)) continue;
+ hintDefs[k] = t2[k];
+ }
+ for (k in t1) {
+ if (!t1.hasOwnProperty(k)) continue;
+ hintDefs[k] = t1[k];
+ }
+
return {
/** Display the next "planning" hint and return whether there are
* any more available.
@@ -195,6 +215,7 @@
'destroy': function () {
clearHints();
+ codeq.tr.unregisterDictionary(trNamespace);
jqHints.empty();
jqHints = null;
jqEditor = null;