const data_get = document.getElementById("data_get"); function check_uptime(event, url) { const outElement = event.target; const startTime = performance.now(); let status, time, timer; outElement.disabled = true; fetch_ask(url, { mode: "no-cors", cache: "no-cache" }) .then((res) => { const endTime = performance.now(); time = ((endTime - startTime) / 1000).toFixed(2); outElement.innerHTML = `Check Status (${time}s)`; }) .catch((err) => { const endTime = performance.now(); time = ((endTime - startTime) / 1000).toFixed(2); outElement.innerHTML = `Check Status (${time}s - Error)`; }) .finally(() => { window.cancelAnimationFrame(timer); outElement.disabled = false; }); function timeCounter() { const curTime = performance.now(); time = (curTime - startTime) / 1000; if (time >= 5) outElement.innerHTML = `Check Status (${time.toFixed( 2 )}s - Taking longer than usual)`; else outElement.innerHTML = `Check Status (${time.toFixed(2)}s - Waiting)`; timer = window.requestAnimationFrame(timeCounter); } timer = window.requestAnimationFrame(timeCounter); } fetch_ask("https://blog.abtmtr.link/api/collections/paste/posts/domain") .then((x) => x.json()) .then((paste) => { const data = JSON.parse(paste.data.body); data.push({ name: "Broken Link", description: ["Broken on purpose. Get to testing!"], url: "https://xyz.abtmtr.link/", src: "https://cdn.abtmtr.link/88x31/abtmtr_link.png", }); data_get.innerHTML = data.reduce((html, subdomain) => { const id = `${subdomain.name.replaceAll(".", "")}-uptime`; return ( html + `

${ subdomain.name }

${subdomain.description.map((x) => `

${x}

`).join("")} ${subdomain.name}

` ); }, ""); });