diff options
author | codepiano <codepiano.li@gmail.com> | 2014-08-04 17:04:31 +0800 |
---|---|---|
committer | codepiano <codepiano.li@gmail.com> | 2014-08-05 15:14:10 +0800 |
commit | 7ba86539350937fea170586a744ab955cb99be57 (patch) | |
tree | d564b2b269d1cac89628d8bbf775022679016330 /theme/javascript/core/navigation.js | |
parent | 5692bdd229020f5b01ca9b24658d6a7b253b6515 (diff) | |
download | gitbook-7ba86539350937fea170586a744ab955cb99be57.zip gitbook-7ba86539350937fea170586a744ab955cb99be57.tar.gz gitbook-7ba86539350937fea170586a744ab955cb99be57.tar.bz2 |
keep the search result list after user click a link
Record search keyword to LocalStorage, when navigate to a new url,fetch
keyword from LocalStorage, init the search input element,then filter the
sidebar menu.
So User can iterator the result list without type the keyword every
time.
Diffstat (limited to 'theme/javascript/core/navigation.js')
-rwxr-xr-x | theme/javascript/core/navigation.js | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/theme/javascript/core/navigation.js b/theme/javascript/core/navigation.js index c1018e0..bcf7e65 100755 --- a/theme/javascript/core/navigation.js +++ b/theme/javascript/core/navigation.js @@ -6,8 +6,9 @@ define([ "core/progress", "core/exercise", "core/quiz", - "core/loading" -], function($, URL, events, state, progress, exercises, quiz, loading) { + "core/loading", + "core/search" +], function($, URL, events, state, progress, exercises, quiz, loading, search) { var prev, next; var usePushState = (typeof history.pushState !== "undefined"); @@ -55,6 +56,8 @@ define([ // Update state state.update($("html")); + // recover search keyword + search.recover(); preparePage(); }) .fail(function (e) { @@ -146,4 +149,5 @@ define([ goNext: goNext, goPrev: goPrev }; -});
\ No newline at end of file +}); + |