diff options
Diffstat (limited to 'theme/javascript/core/sidebar.js')
-rw-r--r-- | theme/javascript/core/sidebar.js | 49 |
1 files changed, 4 insertions, 45 deletions
diff --git a/theme/javascript/core/sidebar.js b/theme/javascript/core/sidebar.js index 88ab639..e324e19 100644 --- a/theme/javascript/core/sidebar.js +++ b/theme/javascript/core/sidebar.js @@ -1,12 +1,9 @@ define([ "utils/storage", "utils/platform", - "core/state", - "core/search" -], function(storage, platform, state, search) { + "core/state" +], function(storage, platform, state) { var $summary = state.$book.find(".book-summary"); - var $searchInput = $summary.find(".book-search input") - // Toggle sidebar with or withour animation var toggleSidebar = function(_state, animation) { @@ -19,31 +16,11 @@ define([ storage.set("sidebar", isOpen()); }; - // Toggle search - var toggleSearch = function(_state) { - if (state != null && isSearchOpen() == _state) return; - - - $summary.toggleClass("with-search", _state); - - // If search bar is open: focus input - if (isSearchOpen()) { - $searchInput.focus(); - } else { - - } - }; - // Return true if sidebar is open var isOpen = function() { return state.$book.hasClass("with-summary"); }; - // Return true if search bar is open - var isSearchOpen = function() { - return $summary.hasClass("with-search"); - }; - // Prepare sidebar: state and toggle button var init = function() { // Toggle summary @@ -56,29 +33,11 @@ define([ if (!platform.isMobile) { toggleSidebar(storage.get("sidebar", true), false); } - - // Toggle search - state.$book.find(".book-header .toggle-search").click(function(e) { - e.preventDefault(); - toggleSearch(); - }); - - $searchInput.keyup(function(e) { - var key = (e.keyCode ? e.keyCode : e.which); - var q = $(this).val(); - - if (key == 27) { - e.preventDefault(); - toggleSearch(false); - return; - } - console.log("search", q); - }); }; return { + $el: $summary, init: init, - toggle: toggleSidebar, - toggleSearch: toggleSearch + toggle: toggleSidebar } });
\ No newline at end of file |