diff options
Diffstat (limited to 'theme/javascript/app.js')
-rwxr-xr-x[-rw-r--r--] | theme/javascript/app.js | 46 |
1 files changed, 10 insertions, 36 deletions
diff --git a/theme/javascript/app.js b/theme/javascript/app.js index eba2f56..3829a42 100644..100755 --- a/theme/javascript/app.js +++ b/theme/javascript/app.js @@ -6,24 +6,20 @@ require([ "core/state", "core/keyboard", - "core/exercise", - "core/quiz", + "core/navigation", "core/progress", "core/sidebar", "core/search" -], function($, storage, analytic, sharing, state, keyboard, exercise, quiz, progress, sidebar, search){ - function changeNavigationPosition() - { - var bodyInnerWidth, pageWrapperWidth; - bodyInnerWidth = parseInt($('.body-inner').css('width'), 10); - pageWrapperWidth = parseInt($('.page-wrapper').css('width'), 10); - $('.navigation-next').css('margin-right', (bodyInnerWidth - pageWrapperWidth) + 'px'); - } - $(window).on('resize', changeNavigationPosition); +], function($, storage, analytic, sharing, state, keyboard, navigation, progress, sidebar, search){ $(document).ready(function() { var $book; $book = state.$book; + if (state.githubId) { + // Initialize storage + storage.setBaseKey(state.githubId); + } + // Init sidebar sidebar.init(); @@ -33,32 +29,10 @@ require([ // Init keyboard keyboard.init(); - 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 exercises - exercise.init(); - quiz.init(); - // Bind sharing button sharing.init(); - - // Show progress - progress.show(); - - // Focus on content - $(".book-body").focus(); - - // Move, if needed, right navigation control to allow scrolling. - changeNavigationPosition(); + + // Init navigation + navigation.init(); }); }); |