diff options
author | Samy Pessé <samypesse@gmail.com> | 2014-04-14 00:49:09 +0200 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2014-04-14 00:49:09 +0200 |
commit | ca71a1c9e67b5c3b51bebe6c5c694c1c63326524 (patch) | |
tree | 904811c4a2c16a594c07b601397753be96299f59 /theme/javascript | |
parent | 01bc283638e3dbbfe04914bd70c07676b25f1b54 (diff) | |
download | gitbook-ca71a1c9e67b5c3b51bebe6c5c694c1c63326524.zip gitbook-ca71a1c9e67b5c3b51bebe6c5c694c1c63326524.tar.gz gitbook-ca71a1c9e67b5c3b51bebe6c5c694c1c63326524.tar.bz2 |
Fix regression on github as an option
Diffstat (limited to 'theme/javascript')
-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(); |