diff options
-rw-r--r-- | js/prolog.js | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/js/prolog.js b/js/prolog.js index df2a1b0..c405200 100644 --- a/js/prolog.js +++ b/js/prolog.js @@ -52,7 +52,7 @@ hintHandlers = { 'static': function (type, template, serverHint) { codeq.log.debug('Processing static hint'); - jqHints.append(template); // TODO: incorporate any serverHint.args + jqHints.append('<div class="hint-static">' + template + '</div>'); // TODO: incorporate any serverHint.args // no hint cleaner here, a static hint remains on the screen }, 'popup': function (type, template, serverHint) { @@ -96,8 +96,10 @@ mark = null; });*/ - jqMark.popover({content: template, html: true, placement: 'auto bottom', trigger: 'click', container: 'body'}); + jqMark.popover({content: template, html: true, placement: 'auto bottom', trigger: 'hover focus click', container: 'body'}); hintCleaners.push(function () { if (jqMark) { jqMark.popover('destroy'); jqMark = null; } }); + + mark.mark.on('', function () {}); }, 'dropdown': function (type, template, serverHint) { codeq.log.debug('Processing dropdown hint'); @@ -134,7 +136,7 @@ editor.setValue('sister(X, Y) :-\n female(X),\n parent(Z, X),\n parent(Z, Y),\n X \\== Y.'); // demo jqDescription.html(info.description); - return { + var handler = { destroy: function () { jqDescription.empty(); jqEditor.empty(); // TODO: perhaps you do not want to "free" the editor, just empty it @@ -186,5 +188,12 @@ } } }; + + var jqButtons = $('#block-toolbar button'); + $(jqButtons.get(0)).on('click', function () { handler.processServerHints([{id:'x_must_be_female'}]); }); + $(jqButtons.get(1)).on('click', function () { handler.processServerHints([{id:'popup_unknown', start: 20, end: 26}]); }); + $(jqButtons.get(2)).on('click', function () { handler.processServerHints([{id:'drop_down', start: 20, end: 26, choices:['ena', 'dva', 'tri']}]); }); + + return handler; }; })();
\ No newline at end of file |