mirror of
https://github.com/manilarome/the-glorious-startpage.git
synced 2025-08-19 09:51:26 +02:00
dashboard add theme engine settings ui
This commit is contained in:
31
js/search-query-send.js
Normal file
31
js/search-query-send.js
Normal file
@@ -0,0 +1,31 @@
|
||||
// Search box
|
||||
var searchBox = document.getElementById("searchBox");
|
||||
|
||||
// Web Search
|
||||
const webSearch = () => {
|
||||
// Search
|
||||
window.location.href = encodeURI(searchQueryPrefix + searchBox.value);
|
||||
};
|
||||
|
||||
// Key release event
|
||||
searchBox.addEventListener(
|
||||
"keyup",
|
||||
(event) => {
|
||||
|
||||
// Number 13 is the "Enter" key on the keyboard
|
||||
if (event.key === 'Enter') {
|
||||
|
||||
// Don't accept empty strings
|
||||
if (searchBox.value < 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Cancel the default action, if needed
|
||||
event.preventDefault();
|
||||
|
||||
// Search the web
|
||||
webSearch()
|
||||
};
|
||||
|
||||
}
|
||||
);
|
Reference in New Issue
Block a user