Move search bar as global

This commit is contained in:
Samy Pessé
2014-04-06 16:20:31 -07:00
parent f24b66f2c4
commit d2f62fd109
4 changed files with 27 additions and 24 deletions
+6 -6
View File
@@ -2,11 +2,11 @@ define([
"jQuery",
"lodash",
"lunr",
"core/state",
"core/sidebar"
], function($, _, lunr, state, sidebar) {
"core/state"
], function($, _, lunr, state) {
var index = null;
var $searchInput = sidebar.$el.find(".book-search input");
var $searchBar = state.$book.find(".book-search");
var $searchInput = $searchBar.find("input");
// Load complete index
var loadIndex = function() {
@@ -37,7 +37,7 @@ define([
if (state != null && isSearchOpen() == _state) return;
sidebar.$el.toggleClass("with-search", _state);
state.$book.toggleClass("with-search", _state);
// If search bar is open: focus input
if (isSearchOpen()) {
@@ -49,7 +49,7 @@ define([
// Return true if search bar is open
var isSearchOpen = function() {
return sidebar.$el.hasClass("with-search");
return state.$book.hasClass("with-search");
};