diff options
author | Gabriel Chiquini <gabrielchiquini@hotmail.com> | 2017-12-08 23:48:39 -0200 |
---|---|---|
committer | Olivier Hallot <olivier.hallot@libreoffice.org> | 2017-12-16 13:13:57 +0100 |
commit | fae24d85eb9fb736c9fdab08c78d25cafb213913 (patch) | |
tree | 02afb87705a0ecc5cc50bfe1503c10bb79aa8d8a /help3xsl/help.js | |
parent | b07c31d8dfa44e18560eaacfe7f63ef2e5e23ff7 (diff) |
Fixed remaining index search bugs
Show list only after typing 3 or more characters
Hide labels when module results is empty
Change-Id: Ifb7a255b6ac627a0448878df104e837d96074fce
Reviewed-on: https://gerrit.libreoffice.org/46134
Reviewed-by: Olivier Hallot <olivier.hallot@libreoffice.org>
Tested-by: Olivier Hallot <olivier.hallot@libreoffice.org>
Diffstat (limited to 'help3xsl/help.js')
-rw-r--r-- | help3xsl/help.js | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/help3xsl/help.js b/help3xsl/help.js index 2c230e91e8..09ebb34b85 100644 --- a/help3xsl/help.js +++ b/help3xsl/help.js @@ -97,15 +97,25 @@ $(document).ready(function() { clearTimeout(debouncer); } debouncer = setTimeout(function(){ - if ($('#search-bar').val()) { + if ($('#search-bar').val().length > 2) { var toShow = $('#Index ul a').filter(function(){ return $(this).text().toLowerCase().indexOf($('#search-bar').val().toLowerCase()) > -1; }); toShow.parent().show(); $("#Index ul a").not(toShow).parent().hide(); + $("#Bookmarks").show(); + + var listToShow = $(''); + $('#Index ul li').filter(':visible').each(function(){ + //add all module labels that have results in search + listToShow = listToShow.add($(this).parent().prev()); + }); + $(listToShow).show(); + //hide all labels with 0 results + $('#Bookmarks > p').not(listToShow).hide(); } else { - $("#Index ul li" ).show(); + $("#Bookmarks").hide(); } }, 200); }); @@ -124,6 +134,8 @@ $(document).ready(function() { $('#accordion-3').on('change', function(){ if($(this).is(':checked')){ $('#search-bar').focus(); + //prevent all results to be shown + $("#Bookmarks").toggle($('#search-bar').val().length > 2); } }); }); |