mirror of
https://github.com/zyllian/zyllian.github.io.git
synced 2025-01-17 19:22:30 -08:00
make pets once per page load
This commit is contained in:
parent
e081dbfe59
commit
da4ae7f9cc
1 changed files with 1 additions and 3 deletions
|
@ -1,8 +1,6 @@
|
|||
(function () {
|
||||
"use strict";
|
||||
|
||||
const DEBOUNCE_TIMER = 1500;
|
||||
|
||||
const url = document.body.classList.contains("debug")
|
||||
? "http://127.0.0.1:8787/api/pet"
|
||||
: "https://cf.zyllian.workers.dev/api/pet";
|
||||
|
@ -18,7 +16,7 @@
|
|||
|
||||
petButton.addEventListener("click", async () => {
|
||||
petButton.disabled = true;
|
||||
setTimeout(() => (petButton.disabled = false), DEBOUNCE_TIMER);
|
||||
petButton.innerText = "thanks! <3";
|
||||
const r = await (await fetch(url, { method: "post" })).json();
|
||||
if (r.count) {
|
||||
count.innerText = r.count;
|
||||
|
|
Loading…
Add table
Reference in a new issue