Skip to content

Commit 643557b

Browse files
committed
custom.js: Fix "See all results" initialization
1 parent 80c8cfc commit 643557b

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

docs/js/custom.js

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -132,19 +132,14 @@ $(document).ready(function() {
132132
});
133133

134134
let link = $('.ds-dropdown-menu a.search-page-link');
135-
const href = '/en/' + branchName + '/search_results/?sq=' + encodeURI($('#search_input').val()) + '&p=1';
136-
137135
if (!link.length) {
138-
link = $('.ds-dropdown-menu').append(`<div class="search-page-link-wrapper">
136+
$('.ds-dropdown-menu').append(`<div class="search-page-link-wrapper">
139137
<a class="search-page-link" href="">See all results</a>
140138
</div>`);
139+
link = $('.ds-dropdown-menu a.search-page-link');
141140
}
142-
143-
link.attr('href', href).show();
144-
145-
if (hits.length < hitsPerPage) {
146-
link.hide();
147-
}
141+
const href = '/en/' + branchName + '/search_results/?sq=' + encodeURI($('#search_input').val()) + '&p=1';
142+
link.attr('href', href).toggle(hits.length >= hitsPerPage);
148143
},
149144
algoliaOptions: {
150145
facetFilters: ['lang:en', 'version:' + branchName],

0 commit comments

Comments
 (0)