mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-30 14:08:33 +00:00
Move search bar as global
This commit is contained in:
+6
-6
@@ -20995,11 +20995,11 @@ define('core/search',[
|
||||
"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() {
|
||||
@@ -21030,7 +21030,7 @@ define('core/search',[
|
||||
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()) {
|
||||
@@ -21042,7 +21042,7 @@ define('core/search',[
|
||||
|
||||
// Return true if search bar is open
|
||||
var isSearchOpen = function() {
|
||||
return sidebar.$el.hasClass("with-search");
|
||||
return state.$book.hasClass("with-search");
|
||||
};
|
||||
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -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");
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
.book {
|
||||
@searchHeight: 41px;
|
||||
|
||||
.book-summary {
|
||||
@width: 250px;
|
||||
@searchHeight: 41px;
|
||||
|
||||
position: fixed;
|
||||
top: 40px;
|
||||
@@ -37,16 +38,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
&.with-search {
|
||||
.book-search {
|
||||
top: 0px;
|
||||
}
|
||||
|
||||
ul.summary {
|
||||
top: @searchHeight;
|
||||
}
|
||||
}
|
||||
|
||||
ul.summary {
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
@@ -137,4 +128,16 @@
|
||||
.transition(none) !important;
|
||||
}
|
||||
}
|
||||
|
||||
&.with-search {
|
||||
.book-summary {
|
||||
.book-search {
|
||||
top: 0px;
|
||||
}
|
||||
|
||||
ul.summary {
|
||||
top: @searchHeight;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user