Skip to content

Commit c8b892a

Browse files
committed
js: add correct href to "Show all results..."
There was some js sourcery happening to make a click on the "Show all results..." entry in the search results dropdown go to the search page. Instead of doing the sourcery on click, set a proper `href` attribute on the `<a>`. This also makes browsers show a hand cursor when hovering the entry in the dropdown. Signed-off-by: Toon Claes <[email protected]>
1 parent dc59d03 commit c8b892a

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

assets/js/application.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,12 @@ var Search = {
223223
$("#show-results-label").text("No matching pages found.");
224224
return;
225225
}
226-
$("#show-results-label").text("Show all results...");
226+
227+
const language = document.querySelector("html")?.getAttribute("lang");
228+
$("#show-results-label")
229+
.text("Show all results...")
230+
.attr('href', `${baseURLPrefix}search/results?search=${term}${language && `&language=${language}`}`);
231+
227232
const loadButton = $("#load-more-results");
228233
loadButton.text(`Loading ${
229234
results.results.length < 2
@@ -300,11 +305,6 @@ var Search = {
300305
selectResultOption: function() {
301306
var link = $('#search-results a')[Search.selectedIndex];
302307
var url = $(link).attr('href');
303-
if(!url) {
304-
const term = $('#search-text').val();
305-
const language = document.querySelector("html")?.getAttribute("lang");
306-
url = `${baseURLPrefix}search/results?search=${term}${language && `&language=${language}`}`;
307-
}
308308
window.location.href = url;
309309
selectedIndex = 0;
310310
},

0 commit comments

Comments
 (0)