~mika/www.m1kadev.nl

ref: e291afa7da9a4613a6633dd10e3ecaad54506b0a www.m1kadev.nl/scripts/fetch-greet.js -rw-r--r-- 549 bytes
e291afa7 — m1ka kethel: switch fxg to md 8 days ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
addEventListener("load", async (ev) => {
    const isMobile = window.matchMedia("(max-width: 900px)").matches;
    if (isMobile) return;

    const authorElem = document.getElementById("author");
    const greetElem = document.getElementById("greet");
    const request = await fetch("https://api.m1kadev.nl/greet");
    const repsonse = await request.json();
    greetElem.innerHTML = repsonse.quote;
    greetElem.lang = repsonse.lang;
    authorElem.innerHTML = `- ${repsonse.author}`;

    greetElem.parentElement.style.display = "initial";
});