📝 新增全球统计

This commit is contained in:
远野千束 2024-08-01 12:28:44 +08:00
parent 850dd75822
commit 61680d9e87
2 changed files with 27 additions and 28 deletions

View File

@ -1 +1,27 @@
function updatePageData() {
fetch("https://api.liteyuki.icu/count")
.then(res => res.json())
.then(data => {
let total = document.getElementById("total");
if(total !== null) {
total.innerText = data.register;
}
})
.catch(err => console.error(err));
fetch("https://api.liteyuki.icu/online")
.then(res => res.json())
.then(data => {
let online = document.getElementById("online");
if(online !== null) {
online.innerText = data.online;
}
})
.catch(err => console.error(err));
}
updatePageData();
setInterval(() => {
updatePageData();
}, 1000);

View File

@ -81,30 +81,3 @@ highlights:
copyright: © 2021-2024 SnowyKami All Rights Reserved copyright: © 2021-2024 SnowyKami All Rights Reserved
--- ---
<script>
function updatePageData() {
fetch("https://api.liteyuki.icu/count")
.then(res => res.json())
.then(data => {
let total = document.getElementById("total");
if(total !== null) {
total.innerText = data.register;
}
})
.catch(err => console.error(err));
fetch("https://api.liteyuki.icu/online")
.then(res => res.json())
.then(data => {
let online = document.getElementById("online");
if(online !== null) {
online.innerText = data.online;
}
})
.catch(err => console.error(err));
}
updatePageData();
setInterval(updatePageData, 1000);
</script>