summaryrefslogtreecommitdiff
path: root/js/codeq/language.js
blob: b8615605fbb2d559f06cbea9a2bd5dfb493423fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/**
 * Created by robert on 9/18/15.
 */

(function(){
    var jqScreen = $('#screen_language'),
        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');};

    codeq.globalStateMachine.register('language',{
        'enter': function(){
            jqScreen.css('display', '');
            jqProlog.on('click', chooseProlog);
            jqPython.on('click', choosePython);
            jqRobot.on('click', chooseRobot);
        },
        'exit' : function(){
            jqProlog.off();
            jqPython.off();
            jqRobot.off();
            jqScreen.css('display', 'none');
        }
    });
})();