summaryrefslogtreecommitdiffstats
path: root/theme/javascript/core
diff options
context:
space:
mode:
Diffstat (limited to 'theme/javascript/core')
-rwxr-xr-xtheme/javascript/core/navigation.js1
-rwxr-xr-xtheme/javascript/core/sidebar.js53
2 files changed, 24 insertions, 30 deletions
diff --git a/theme/javascript/core/navigation.js b/theme/javascript/core/navigation.js
index 060eb7a..2e3f9eb 100755
--- a/theme/javascript/core/navigation.js
+++ b/theme/javascript/core/navigation.js
@@ -65,7 +65,6 @@ define([
// Update state
state.update($("html"));
- // recover search keyword
preparePage();
})
.fail(function (e) {
diff --git a/theme/javascript/core/sidebar.js b/theme/javascript/core/sidebar.js
index 828dc73..2d9417e 100755
--- a/theme/javascript/core/sidebar.js
+++ b/theme/javascript/core/sidebar.js
@@ -1,56 +1,51 @@
define([
- "jQuery",
- "lodash",
- "utils/storage",
- "utils/platform",
- "core/state"
+ 'jQuery',
+ 'lodash',
+ 'utils/storage',
+ 'utils/platform',
+ 'core/state'
], function($, _, storage, platform, state) {
// Toggle sidebar with or withour animation
- var toggleSidebar = function(_state, animation) {
+ function toggleSidebar(_state, animation) {
if (state != null && isOpen() == _state) return;
if (animation == null) animation = true;
- state.$book.toggleClass("without-animation", !animation);
- state.$book.toggleClass("with-summary", _state);
+ state.$book.toggleClass('without-animation', !animation);
+ state.$book.toggleClass('with-summary', _state);
- storage.set("sidebar", isOpen());
- };
+ storage.set('sidebar', isOpen());
+ }
// Return true if sidebar is open
- var isOpen = function() {
- return state.$book.hasClass("with-summary");
- };
+ function isOpen() {
+ return state.$book.hasClass('with-summary');
+ }
// Prepare sidebar: state and toggle button
- var init = function() {
- // Toggle summary
- $(document).on("click", ".book-header .toggle-summary", function(e) {
- e.preventDefault();
- toggleSidebar();
- });
-
+ function init() {
// Init last state if not mobile
if (!platform.isMobile) {
- toggleSidebar(storage.get("sidebar", true), false);
+ toggleSidebar(storage.get('sidebar', true), false);
}
- };
+ }
// Filter summary with a list of path
- var filterSummary = function(paths) {
- var $summary = $(".book-summary");
+ function filterSummary(paths) {
+ var $summary = $('.book-summary');
- $summary.find("li").each(function() {
- var path = $(this).data("path");
+ $summary.find('li').each(function() {
+ var path = $(this).data('path');
var st = paths == null || _.contains(paths, path);
$(this).toggle(st);
- if (st) $(this).parents("li").show();
+ if (st) $(this).parents('li').show();
});
- };
+ }
return {
init: init,
+ isOpen: isOpen,
toggle: toggleSidebar,
filter: filterSummary
- }
+ };
}); \ No newline at end of file