1
0
forked from bot/app

🔥 小型重构

This commit is contained in:
2024-06-26 13:52:04 +08:00
parent 35823be13e
commit 8b01943d14
268 changed files with 25225 additions and 24996 deletions

View File

@ -0,0 +1,25 @@
let data = JSON.parse(document.getElementById("data").innerText) // object
const rowDiv = document.importNode(document.getElementById("row-template").content, true)
function randomHideChar(str) {
// 随机隐藏6位以上字符串的中间连续四位字符用*代替
if (str.length <= 6) {
return str
}
let start = Math.floor(str.length / 2) - 2
return str.slice(0, start) + "****" + str.slice(start + 4)
}
data["ranking"].forEach((item) => {
let row = rowDiv.cloneNode(true)
let rowID = item["name"]
let rowIconSrc = item["icon"]
let rowCount = item["count"]
row.querySelector(".row-name").innerText = randomHideChar(rowID)
row.querySelector(".row-icon").src = rowIconSrc
row.querySelector(".row-count").innerText = rowCount
document.body.appendChild(row)
})