diff options
Diffstat (limited to 'js')
-rw-r--r-- | js/codeq/language.js | 13 | ||||
-rw-r--r-- | js/codeq/problem_list.js | 9 |
2 files changed, 13 insertions, 9 deletions
diff --git a/js/codeq/language.js b/js/codeq/language.js index b861560..e86b09e 100644 --- a/js/codeq/language.js +++ b/js/codeq/language.js @@ -7,16 +7,17 @@ jqProlog = $('#choose-prolog'),
jqPython = $('#choose-python'),
jqRobot = $('#choose-robot'),
- chooseProlog = function () {codeq.globalStateMachine.transition('problem_list', 'prolog');},
- choosePython = function () {codeq.globalStateMachine.transition('problem_list', 'python');},
- chooseRobot = function () {codeq.globalStateMachine.transition('problem_list', 'robot');};
+ choose = function (language) {
+ codeq.globalStateMachine.transition('problem_list', language);
+ return false;
+ };
codeq.globalStateMachine.register('language',{
'enter': function(){
jqScreen.css('display', '');
- jqProlog.on('click', chooseProlog);
- jqPython.on('click', choosePython);
- jqRobot.on('click', chooseRobot);
+ jqProlog.on('click', function () { return choose('prolog') });
+ jqPython.on('click', function () { return choose('python') });
+ jqRobot.on('click', function () { return choose('robot') });
},
'exit' : function(){
jqProlog.off();
diff --git a/js/codeq/problem_list.js b/js/codeq/problem_list.js index 853c8cb..cc9e716 100644 --- a/js/codeq/problem_list.js +++ b/js/codeq/problem_list.js @@ -200,7 +200,8 @@ Ngroups = groups.length, html = [], problemReferences = [], - group, problems, Nproblems, problem, i, j; + group, problems, Nproblems, problem, i, j, nrefs, + baseTabIndex = 200; // tabindex attribute of the first problem link var langDict = convertTranslations(rawTranslations, 'name', 'description'), // this will be the resulting dictionary: multi-level keys that lead up to the lang-dict groupDict, problemDict; // title: HTML structure for "name" and "desc" @@ -218,9 +219,10 @@ problems = group.problems || []; Nproblems = problems.length; for (j = 0; j < Nproblems; j++) { + nrefs = problemReferences.length; problem = problems[j] || {}; problemDict = convertTranslations(problem.translations, 'name'); - html.push('<li><a class="problem-', '' + problemReferences.length, '" ', ta(problemDict.name), '></a></li>'); + html.push('<li><a href="#" tabindex="' + (baseTabIndex+nrefs) + '"' + ' class="problem-', '' + nrefs, '" ', ta(problemDict.name), '></a></li>'); problemReferences.push({'g': group.identifier || 'nogroup', 'p': problem.identifier || 'noproblem', 'id': problem.id}); } html.push('</ul>'); @@ -254,7 +256,7 @@ ref = data.refs[index]; if (!ref) { codeq.log.error('Clicked on a problem link having erroneous index: ' + index); - return; + return false; } codeq.wait( Q.all([ @@ -272,6 +274,7 @@ alert('Failed to obtain the problem definition: ' + reason); }) .done(); + return false; }); }, |