diff options
author | Samy Pessé <samypesse@gmail.com> | 2014-04-09 08:17:37 +0200 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2014-04-09 08:17:37 +0200 |
commit | 1b432288f041baef2ebe54c96a7a86f547b14c67 (patch) | |
tree | 8856ef41c7f38e135d84c8f5f3e4363c91459569 /theme/javascript/app.js | |
parent | 2182baa2e9bf520943871c52340066cfdd28ba0b (diff) | |
parent | fa2f82d52f34b725483f0fd55be3cc9b04f7dc9b (diff) | |
download | gitbook-1b432288f041baef2ebe54c96a7a86f547b14c67.zip gitbook-1b432288f041baef2ebe54c96a7a86f547b14c67.tar.gz gitbook-1b432288f041baef2ebe54c96a7a86f547b14c67.tar.bz2 |
Merge branch 'optional-github' of https://github.com/mrpotes/gitbook into mrpotes-optional-github
Diffstat (limited to 'theme/javascript/app.js')
-rw-r--r-- | theme/javascript/app.js | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/theme/javascript/app.js b/theme/javascript/app.js index 34247ca..392d45b 100644 --- a/theme/javascript/app.js +++ b/theme/javascript/app.js @@ -14,9 +14,6 @@ require([ $(document).ready(function() { var $book = state.$book; - // Initialize storage - storage.setBaseKey(state.githubId); - // Init sidebar sidebar.init(); @@ -26,12 +23,17 @@ 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); - }); + 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); + }); + } // Bind exercise exercise.init(); @@ -45,4 +47,4 @@ require([ // Focus on content $(".book-body").focus(); }); -});
\ No newline at end of file +}); |