Deploying to gh-pages from @ LiteyukiStudio/LiteyukiBot@61680d9e87 🚀

This commit is contained in:
2024-08-01 04:29:28 +00:00
parent 4ced64846f
commit 58dfdbdfc5
41 changed files with 145 additions and 109 deletions

27
js/get_data.js Normal file
View File

@ -0,0 +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

@ -1,10 +1,15 @@
function applyStyle() {
// 先检测页面中是否有macos-tab有则不再添加
let tabs = document.body.querySelectorAll('.macos-tab')
if (tabs.length > 0) {
return
}
let lineNumbers = document.body.querySelectorAll('[class^="language-"].line-numbers-mode')
lineNumbers.forEach((item) => {
// 插入现成的html文本
let title = item.getAttribute('data-title')
let tabStr =
"<div class='tab' style='display: flex; background-color: #d0e9ff'>" +
"<div class='tab macos-tab' style='display: flex; background-color: #d0e9ff'>" +
" <div class='tab-buttons'>" +
" <div class='tab-button' style='background-color: #FF5F57'></div>" +
" <div class='tab-button' style='background-color: #FFBD2E'></div>" +
@ -19,4 +24,8 @@ function applyStyle() {
}
applyStyle()
applyStyle()
// 定时器每隔1s检查一次
setInterval(() => {
applyStyle()
}, 1000)