dff1d9a4d1
Removed useless variables and added a variable... Added const/let to variable declaration...
19 lines
563 B
JavaScript
19 lines
563 B
JavaScript
window.onload = function() {
|
|
this.initSearchBar()
|
|
}
|
|
|
|
function initSearchBar() {
|
|
const searchBarInput = document.getElementById("search-bar-input")
|
|
|
|
searchBarInput.value = ""
|
|
searchBarInput.focus()
|
|
|
|
searchBarInput.addEventListener("keypress", (event) => {
|
|
if (event.key !== 'Enter') return
|
|
|
|
const searchEnginer = "https://www.duckduckgo.com/?q="
|
|
const endQuery = "&atb=v225-7&ia=web"
|
|
|
|
document.location = searchEnginer + searchBarInput.value.replace(/\ /g, "+") + endQuery
|
|
})
|
|
}
|