summaryrefslogtreecommitdiff
path: root/js/codeq
diff options
context:
space:
mode:
authorAleš Smodiš <aless@guru.si>2015-09-18 13:29:32 +0200
committerAleš Smodiš <aless@guru.si>2015-09-18 13:29:32 +0200
commit666a497696c80df08bdff7f8ce049565a46541b7 (patch)
tree0efbb42baf51b24629b975c66eb6fecb6c1f1cea /js/codeq
parent99bad1571ed306678d9b0416bf87f37f5f882058 (diff)
Bugfix: off-by-one when displaying an array of hints.
Diffstat (limited to 'js/codeq')
-rw-r--r--js/codeq/hint.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/js/codeq/hint.js b/js/codeq/hint.js
index d090c4d..dc774ba 100644
--- a/js/codeq/hint.js
+++ b/js/codeq/hint.js
@@ -44,7 +44,7 @@
typeHandlers = {
'static': function (type, template, serverHint) {
var args = serverHint.args,
- jqContainer, jqButton, i, lastIndex;
+ jqContainer, jqButton, i, N;
if (template instanceof Array) { // unwrap the template if there's only one
if (template.length == 0) template = '';
else if (template.length == 1) template = template[0] + ''; // it must be a string
@@ -54,14 +54,14 @@
jqContainer = $('<div class="hint-static-group"></div>');
jqButton = $('<button type="button">More...</button>'); // TODO: translate "more"
jqHints.append(jqContainer);
- lastIndex = template.length - 1;
+ N = template.length;
jqContainer.append('<div class="hint-static">' + processTemplate(template[0], args) + '</div>');
jqContainer.append(jqButton);
i = 1;
jqButton.on('click', function () {
var jqNext = $('<div class="hint-static">' + processTemplate(template[i], args) + '</div>');
i++;
- if (i < lastIndex) {
+ if (i < N) {
jqButton.before(jqNext);
}
else {