summaryrefslogtreecommitdiff
path: root/js/codeq/language.js
blob: 97691e6b1d53e0c081851cfab0b97a647f7c47a6 (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'),
        choose = function (language) {
            codeq.globalStateMachine.transition('problem_list', language);
        };

    codeq.globalStateMachine.register('language',{
        'enter': function(){
            jqScreen.css('display', '');
            jqProlog.on('click', function (e) { e.preventDefault(); choose('prolog') });
            jqPython.on('click', function (e) { e.preventDefault(); choose('python') });
            jqRobot.on('click', function (e) { e.preventDefault(); choose('robot') });
        },
        'exit' : function(){
            jqProlog.off();
            jqPython.off();
            jqRobot.off();
            jqScreen.css('display', 'none');
        }
    });
})();