Fix incorrect links in search suggestions

This commit is contained in:
partisan 2024-11-16 12:34:40 +01:00
parent 2741c2ff3d
commit 0d083f53e7
7 changed files with 13 additions and 3 deletions

View file

@ -101,8 +101,12 @@ 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

View file

@ -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="/">

View file

@ -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="/">

View file

@ -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="/">

View file

@ -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="/">

View file

@ -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="/">

View file

@ -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="/">