title | permalink |
---|---|
Error |
/404.html |
<style>
img, #quote, #comment-cat {
display: block;
margin-left: auto;
margin-right: auto;
}
#author {
float: right;
}
</style>
<script type="text/javascript"> /* https://docs.thecatapi.com/ */ const URL = 'https://api.thecatapi.com/v1/images/search?size=full'; (async function() { try { // CAT let divTitle = document.getElementById("comment-cat"); let divcat = document.getElementById("cat"); let response = await fetch(URL, { headers: { 'x-api-key': "56a4f1cc-7f60-468d-9dba-e4b6f04b7c7d" } }); let cat = await response.json(); // console.log(cat); let img = document.createElement("img"); let title = document.createElement("h2"); title.innerText = "Consuélate con un gatito"; divTitle.append(title); img.src = cat[0].url; divcat.appendChild(img); // QUOTE const quoteDiv = document.getElementById("quote"); const authorDiv = document.getElementById("author"); const quoteRes = await fetch('https://api.quotable.io/random'); const data = await quoteRes.json(); quoteDiv.innerHTML = ``; authorDiv.innerHTML = ``; } catch(e) { console.log(e); } })(); </script>
<script type="text/javascript"> /* https://docs.thecatapi.com/ */ const URL = 'https://api.thecatapi.com/v1/images/search?size=full'; (async function() { try { // CAT let divTitle = document.getElementById("comment-cat"); let divcat = document.getElementById("cat"); let response = await fetch(URL, { headers: { 'x-api-key': "56a4f1cc-7f60-468d-9dba-e4b6f04b7c7d" } }); let cat = await response.json(); // console.log(cat); let img = document.createElement("img"); let title = document.createElement("h2"); title.innerText = "Consuélate con un gatito"; divTitle.append(title); img.src = cat[0].url; divcat.appendChild(img); // QUOTE const quoteDiv = document.getElementById("quote"); const authorDiv = document.getElementById("author"); const quoteRes = await fetch('https://api.quotable.io/random'); const data = await quoteRes.json(); quoteDiv.innerHTML = ``; authorDiv.innerHTML = ``; } catch(e) { console.log(e); } })(); </script>