summaryrefslogtreecommitdiffstats
path: root/assets/javascript/app.js
blob: 55e3546ee9b981a64e107eff2b2c8f6eb5051172 (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
require([
    "jQuery",
    "core/state",
    "core/exercise",
    "core/progress",
    "core/sidebar"
], function($, _state, exercise, progress, sidebar){
    $(document).ready(function() {
        var state = _state();
        var $book = state.$book;

        // Init sidebar
        sidebar.init();

        // Star and watch count
        $.getJSON("https://api.github.com/repos/"+state.githubId)
        .done(function(repo) {
            $book.find(".count-star span").text(repo.stargazers_count);
            $book.find(".count-watch span").text(repo.subscribers_count);
        });

        // Bind exercise
        exercise.init();

        // Show progress
        progress.show();
    });
});