summaryrefslogtreecommitdiff
path: root/help3xsl
diff options
context:
space:
mode:
Diffstat (limited to 'help3xsl')
-rw-r--r--help3xsl/help.js14
1 files changed, 13 insertions, 1 deletions
diff --git a/help3xsl/help.js b/help3xsl/help.js
index 48fdca8bb6..17d4909058 100644
--- a/help3xsl/help.js
+++ b/help3xsl/help.js
@@ -73,17 +73,29 @@ function fillIndex(indexEl, content, modules) {
// filter the index list based on search field input
function filter(indexList) {
var results = null;
+ var group = [];
var target = search.value.trim();
var filtered = '';
if (target.length < 1) {
fillIndex(indexEl, fullLinks, modules);
return;
}
+
results = fuzzysort.go(target, bookmarks, {threshold: -15000, key:'text'});
+ // tdf#123506 - Group the filtered list into module groups, keeping the ordering
+ modules.forEach(function(module) {
+ group[module] = '';
+ });
results.forEach(function(result) {
- filtered += '<a href="' + result.obj['url'] + '" class="' + result.obj['app'] + '">' + fuzzysort.highlight(result) + '</a>';
+ group[result.obj['app']] += '<a href="' + result.obj['url'] + '" class="' + result.obj['app'] + '">' + fuzzysort.highlight(result) + '</a>';
});
+ modules.forEach(function(module) {
+ if (group[module].length > 0) {
+ filtered += group[module];
+ }
+ });
+
fillIndex(indexList, filtered, modules);
};