diff options
Diffstat (limited to 'theme/javascript/app.js')
-rwxr-xr-x | theme/javascript/app.js | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/theme/javascript/app.js b/theme/javascript/app.js index 3638092..20dfcd7 100755 --- a/theme/javascript/app.js +++ b/theme/javascript/app.js @@ -14,8 +14,17 @@ require([ $(document).ready(function() { var $book = state.$book; - // Initialize storage - storage.setBaseKey(state.githubId); + if (state.githubId) { + // Initialize storage + storage.setBaseKey(state.githubId); + + // 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); + }); + } // Init sidebar sidebar.init(); @@ -26,12 +35,6 @@ require([ // Init keyboard keyboard.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(); |