summaryrefslogtreecommitdiffstats
path: root/theme/javascript/app.js
diff options
context:
space:
mode:
Diffstat (limited to 'theme/javascript/app.js')
-rw-r--r--theme/javascript/app.js22
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
+});