Consumiendo frases de chuck norris porque la vida no tiene sentido
This commit is contained in:
20
script.js
20
script.js
@@ -227,9 +227,29 @@ const weather = new function () {
|
||||
}
|
||||
}
|
||||
|
||||
const quotes = new function () {
|
||||
this.query_quotes = async () => {
|
||||
const data = await fetch(`https://home.danielcortes.xyz/quotes`)
|
||||
return await data.json()
|
||||
}
|
||||
|
||||
this.show_quote = async () => {
|
||||
const quote_p = document.getElementById('quote')
|
||||
const quote = await this.query_quotes()
|
||||
|
||||
quote_p.innerHTML = quote.quote
|
||||
}
|
||||
|
||||
this.on_load = async () => {
|
||||
this.show_quote()
|
||||
document.getElementById('new-quote').addEventListener('click', this.show_quote)
|
||||
}
|
||||
}
|
||||
|
||||
window.addEventListener('load', () => {
|
||||
currency.on_load()
|
||||
photos.on_load()
|
||||
search.on_load()
|
||||
weather.on_load()
|
||||
quotes.on_load()
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user