summaryrefslogtreecommitdiffstats
path: root/theme/javascript/core
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2015-10-05 15:55:39 +0200
committerSamy Pessé <samypesse@gmail.com>2015-10-05 15:55:39 +0200
commit7f0e4803e266e11ef3aedc041c63b99cd2cce7e2 (patch)
tree22d70a8389336ecd4231f7e84efdf265a2eb7230 /theme/javascript/core
parentfa76029a1789d23f80d8eaac2fc7b872440fd75e (diff)
downloadgitbook-7f0e4803e266e11ef3aedc041c63b99cd2cce7e2.zip
gitbook-7f0e4803e266e11ef3aedc041c63b99cd2cce7e2.tar.gz
gitbook-7f0e4803e266e11ef3aedc041c63b99cd2cce7e2.tar.bz2
Start removing search and lunr from core
Diffstat (limited to 'theme/javascript/core')
-rwxr-xr-xtheme/javascript/core/keyboard.js39
-rwxr-xr-xtheme/javascript/core/navigation.js6
2 files changed, 22 insertions, 23 deletions
diff --git a/theme/javascript/core/keyboard.js b/theme/javascript/core/keyboard.js
index 22fe953..27a9247 100755
--- a/theme/javascript/core/keyboard.js
+++ b/theme/javascript/core/keyboard.js
@@ -1,38 +1,39 @@
define([
- "jQuery",
- "Mousetrap",
- "core/navigation",
- "core/sidebar",
- "core/search"
-], function($, Mousetrap, navigation, sidebar, search){
+ 'jQuery',
+ 'Mousetrap',
+ 'core/navigation',
+ 'core/sidebar'
+], function($, Mousetrap, navigation, sidebar){
+
+ // Bind a keyboard shortcuts
+ function bindShortcut(keys, fn) {
+ Mousetrap.bind(keys, function(e) {
+ fn();
+ return false;
+ });
+ }
+
+
// Bind keyboard shortcuts
var init = function() {
// Next
- Mousetrap.bind(['right'], function(e) {
+ bindShortcut(['right'], function(e) {
navigation.goNext();
- return false;
});
// Prev
- Mousetrap.bind(['left'], function(e) {
+ bindShortcut(['left'], function(e) {
navigation.goPrev();
- return false;
});
// Toggle Summary
- Mousetrap.bind(['s'], function(e) {
+ bindShortcut(['s'], function(e) {
sidebar.toggle();
- return false;
- });
-
- // Toggle Search
- Mousetrap.bind(['f'], function(e) {
- search.toggle();
- return false;
});
};
return {
- init: init
+ init: init,
+ bind: bindShortcut
};
}); \ No newline at end of file
diff --git a/theme/javascript/core/navigation.js b/theme/javascript/core/navigation.js
index c1766ab..060eb7a 100755
--- a/theme/javascript/core/navigation.js
+++ b/theme/javascript/core/navigation.js
@@ -4,9 +4,8 @@ define([
"core/events",
"core/state",
"core/progress",
- "core/loading",
- "core/search"
-], function($, URL, events, state, progress, loading, search) {
+ "core/loading"
+], function($, URL, events, state, progress, loading) {
var prev, next;
var usePushState = (typeof history.pushState !== "undefined");
@@ -67,7 +66,6 @@ define([
// Update state
state.update($("html"));
// recover search keyword
- search.recover();
preparePage();
})
.fail(function (e) {