summaryrefslogtreecommitdiff
path: root/js/codeq/language.js
blob: 0893e33b7e3b7878fd0238c002d37c5ec41e2044 (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
29
30
31
32
/**
 * 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', 'prolog');},
        choosePython = function () {codeq.globalStateMachine.transition('problem', 'python');},
        chooseRobot = function () {codeq.globalStateMachine.transition('problem', 'robot');};

    codeq.globalStateMachine.register('language',{
        'enter': function(){
            $("#navigation-language").addClass("active").css('display', '');

            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');

            $('#navigation-language').css('display', 'none').removeClass("active");
        }
    });
})();