startpage/scr/search.js
Carlos dff1d9a4d1
Removed and added variables
Removed useless variables and added a variable...
Added const/let to variable declaration...
2020-11-10 23:47:35 -03:00

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
})
}