LiteyukiBot/liteyuki/resources/vanilla_resource/templates/js/card.js

28 lines
856 B
JavaScript
Raw Normal View History

2024-04-12 05:07:19 +00:00
const bgs = [
"bg1.webp",
"bg2.webp",
"bg3.webp",
"bg4.webp",
"bg5.webp",
"bg6.webp",
"bg7.webp",
2024-04-12 05:07:19 +00:00
]
// 随机选择背景图片
document.body.style.backgroundImage = `url(./img/${bgs[Math.floor(Math.random() * bgs.length)]})`;
2024-04-26 18:20:44 +00:00
// body后插入info-box id=description
let descriptionDiv = document.createElement("div");
descriptionDiv.className = 'info-box'
descriptionDiv.id = 'author-description'
2024-04-27 03:42:58 +00:00
// 添加一副头像且垂直居中
let avatar = document.createElement("img");
avatar.src = 'https://q.qlogo.cn/g?b=qq&nk=2751454815&s=640'
avatar.style.height = '50px';
avatar.style.borderRadius = '50%';
let text = document.createElement("div");
text.id = 'author-text';
text.innerText = 'Designed by SnowyKami';
descriptionDiv.appendChild(avatar);
descriptionDiv.appendChild(text);
2024-04-26 18:20:44 +00:00
document.body.appendChild(descriptionDiv);