Merge pull request #1 from okaabe/patch-1

Removed and added variables
This commit is contained in:
Kainoa Kanter 2020-11-10 18:57:06 -08:00 committed by GitHub
commit c38e704ecb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3,15 +3,17 @@ window.onload = function() {
} }
function initSearchBar() { function initSearchBar() {
document.getElementById("search-bar-input").value = "" const searchBarInput = document.getElementById("search-bar-input")
document.getElementById("search-bar-input").focus()
searchBarInput.value = ""
searchBarInput.focus()
document.getElementById("search-bar-input").addEventListener("keypress", (event) => { searchBarInput.addEventListener("keypress", (event) => {
if (event.key != 'Enter') return if (event.key !== 'Enter') return
googleSearchUrl = "https://www.duckduckgo.com/?q=" const searchEnginer = "https://www.duckduckgo.com/?q="
otherThing = "&atb=v225-7&ia=web" const endQuery = "&atb=v225-7&ia=web"
query = document.getElementById("search-bar-input").value.replace(/\ /g, "+")
document.location = googleSearchUrl + query + otherThing document.location = searchEnginer + searchBarInput.value.replace(/\ /g, "+") + endQuery
}) })
} }