-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
30 additions
and
106 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,6 @@ | ||
/** | ||
* Selects the input element for the search box | ||
* @type {HTMLInputElement} | ||
*/ | ||
const searchBox = document.querySelector('input') | ||
|
||
/** | ||
* Redirects the user to the search results page with the query parameter | ||
*/ | ||
function searchWeb() { | ||
const query = searchBox.value.trim() | ||
try { | ||
let safeSearchLevel = document.querySelector('.search_options select').value | ||
if (query) { | ||
window.location.href = `search?q=${encodeURIComponent( | ||
query, | ||
)}&safesearch=${encodeURIComponent(safeSearchLevel)}` | ||
} | ||
} catch (error) { | ||
if (query) { | ||
window.location.href = `search?q=${encodeURIComponent(query)}` | ||
} | ||
} | ||
} | ||
|
||
/** | ||
* Listens for the 'Enter' key press event on the search box and calls the searchWeb function | ||
* @param {KeyboardEvent} e - The keyboard event object | ||
*/ | ||
searchBox.addEventListener('keyup', (e) => { | ||
if (e.key === 'Enter') { | ||
searchWeb() | ||
} | ||
}) | ||
|
||
/** | ||
* A function that clears the search input text when the clear button is clicked. | ||
*/ | ||
function clearSearchText() { | ||
document.querySelector('.search_bar input').value = '' | ||
document.querySelector('.search_bar > input').value = '' | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -129,6 +129,7 @@ pub async fn search( | |
&config.style.theme, | ||
&config.style.animation, | ||
query, | ||
page, | ||
&results.0, | ||
) | ||
.0, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters