Fix incorrect links in search suggestions
This commit is contained in:
parent
2741c2ff3d
commit
0d083f53e7
7 changed files with 13 additions and 3 deletions
|
@ -101,9 +101,13 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||
searchInput.value = query;
|
||||
resultsWrapper.innerHTML = '';
|
||||
searchWrapper.classList.remove('wrapper-searching');
|
||||
const form = searchInput.closest('form');
|
||||
form ? form.submit() : window.location.href = `/search?q=${encodeURIComponent(query)}&t=web`;
|
||||
}
|
||||
|
||||
// Retrieve the `t` parameter from the hidden input or set a default
|
||||
const currentTemplateType = document.querySelector('input[name="t"]').value || 'web';
|
||||
|
||||
// Redirect to the appropriate results page
|
||||
window.location.href = `/search?q=${encodeURIComponent(query)}&t=${encodeURIComponent(currentTemplateType)}`;
|
||||
}
|
||||
|
||||
// Handle clicks on search suggestions
|
||||
resultsWrapper.addEventListener('click', (event) => {
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
</head>
|
||||
<body>
|
||||
<form action="/search" id="prev-next-form" class="results-search-container" method="GET" autocomplete="off">
|
||||
<input type="hidden" name="t" value="file" />
|
||||
<h1 class="logomobile">
|
||||
<div class="logo-container" herf="/">
|
||||
<a href="/">
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
</head>
|
||||
<body>
|
||||
<form action="/search" id="prev-next-form" class="results-search-container" method="GET" autocomplete="off">
|
||||
<input type="hidden" name="t" value="forum" />
|
||||
<h1 class="logomobile">
|
||||
<div class="logo-container" herf="/">
|
||||
<a href="/">
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
</head>
|
||||
<body>
|
||||
<form action="/search" id="prev-next-form" class="results-search-container" method="GET" autocomplete="off">
|
||||
<input type="hidden" name="t" value="image" />
|
||||
<h1 class="logomobile">
|
||||
<div class="logo-container" herf="/">
|
||||
<a href="/">
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
</head>
|
||||
<body>
|
||||
<form action="/search" id="prev-next-form" class="results-search-container" method="GET" autocomplete="off">
|
||||
<input type="hidden" name="t" value="map" />
|
||||
<h1 class="logomobile">
|
||||
<div class="logo-container" herf="/">
|
||||
<a href="/">
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
</head>
|
||||
<body>
|
||||
<form action="/search" id="prev-next-form" class="results-search-container" method="GET" autocomplete="off">
|
||||
<input type="hidden" name="t" value="text" />
|
||||
<h1 class="logomobile">
|
||||
<div class="logo-container" herf="/">
|
||||
<a href="/">
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
</head>
|
||||
<body>
|
||||
<form action="/search" id="prev-next-form" class="results-search-container" method="GET" autocomplete="off">
|
||||
<input type="hidden" name="t" value="video" />
|
||||
<h1 class="logomobile">
|
||||
<div class="logo-container" herf="/">
|
||||
<a href="/">
|
||||
|
|
Loading…
Add table
Reference in a new issue