From 666a497696c80df08bdff7f8ce049565a46541b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ale=C5=A1=20Smodi=C5=A1?= Date: Fri, 18 Sep 2015 13:29:32 +0200 Subject: Bugfix: off-by-one when displaying an array of hints. --- js/codeq/hint.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'js') 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 = $('
'); jqButton = $(''); // TODO: translate "more" jqHints.append(jqContainer); - lastIndex = template.length - 1; + N = template.length; jqContainer.append('
' + processTemplate(template[0], args) + '
'); jqContainer.append(jqButton); i = 1; jqButton.on('click', function () { var jqNext = $('
' + processTemplate(template[i], args) + '
'); i++; - if (i < lastIndex) { + if (i < N) { jqButton.before(jqNext); } else { -- cgit v1.2.1