summaryrefslogtreecommitdiffstats
path: root/theme/javascript/core/sidebar.js
diff options
context:
space:
mode:
Diffstat (limited to 'theme/javascript/core/sidebar.js')
-rw-r--r--theme/javascript/core/sidebar.js18
1 files changed, 16 insertions, 2 deletions
diff --git a/theme/javascript/core/sidebar.js b/theme/javascript/core/sidebar.js
index e324e19..ab5b19a 100644
--- a/theme/javascript/core/sidebar.js
+++ b/theme/javascript/core/sidebar.js
@@ -1,8 +1,9 @@
define([
+ "lodash",
"utils/storage",
"utils/platform",
"core/state"
-], function(storage, platform, state) {
+], function(_, storage, platform, state) {
var $summary = state.$book.find(".book-summary");
// Toggle sidebar with or withour animation
@@ -35,9 +36,22 @@ define([
}
};
+ // Filter summary with a list of path
+ var filterSummary = function(paths) {
+ console.log("filter with", paths);
+ $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();
+ });
+ };
+
return {
$el: $summary,
init: init,
- toggle: toggleSidebar
+ toggle: toggleSidebar,
+ filter: filterSummary
}
}); \ No newline at end of file