diff options
author | Samy Pessé <samypesse@gmail.com> | 2016-02-17 14:07:15 +0100 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2016-02-17 14:07:15 +0100 |
commit | 6ee9a3a64c76109719227a056ae2b29cb447cd76 (patch) | |
tree | 4cc2f8202a83369501a74625ee953b10b286de5b /theme/javascript/sidebar.js | |
parent | c0196c97a50786cd28c9b72197b39fefb47be333 (diff) | |
download | gitbook-6ee9a3a64c76109719227a056ae2b29cb447cd76.zip gitbook-6ee9a3a64c76109719227a056ae2b29cb447cd76.tar.gz gitbook-6ee9a3a64c76109719227a056ae2b29cb447cd76.tar.bz2 |
Remove old theme
Diffstat (limited to 'theme/javascript/sidebar.js')
-rw-r--r-- | theme/javascript/sidebar.js | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/theme/javascript/sidebar.js b/theme/javascript/sidebar.js deleted file mode 100644 index 9fc1e8e..0000000 --- a/theme/javascript/sidebar.js +++ /dev/null @@ -1,56 +0,0 @@ -var $ = require('jquery'); -var _ = require('lodash'); - -var storage = require('./storage'); -var platform = require('./platform'); -var state = require('./state'); - - -// Toggle sidebar with or withour animation -function toggleSidebar(_state, animation) { - if (state != null && isOpen() == _state) return; - if (animation == null) animation = true; - - state.$book.toggleClass('without-animation', !animation); - state.$book.toggleClass('with-summary', _state); - - storage.set('sidebar', isOpen()); -} - -// Return true if sidebar is open -function isOpen() { - return state.$book.hasClass('with-summary'); -} - -// Prepare sidebar: state and toggle button -function init() { - // Init last state if not mobile - if (!platform.isMobile()) { - toggleSidebar(storage.get('sidebar', true), false); - } - - // Close sidebar after clicking a link on mobile - $(document).on('click', '.book-summary li.chapter a', function(e) { - if (platform.isMobile()) toggleSidebar(false, false); - }); -} - -// Filter summary with a list of path -function filterSummary(paths) { - var $summary = $('.book-summary'); - - $summary.find('li').each(function() { - var path = $(this).data('path'); - var st = paths == null || _.contains(paths, path); - - $(this).toggle(st); - if (st) $(this).parents('li').show(); - }); -} - -module.exports = { - init: init, - isOpen: isOpen, - toggle: toggleSidebar, - filter: filterSummary -}; |