修复作者卡片只有一条skills时,连续点击会发生崩溃

This commit is contained in:
1152958806@qq.com 2023-09-23 00:24:25 +08:00
parent af501aca46
commit 16dcba410d
1 changed files with 12 additions and 7 deletions

View File

@ -434,13 +434,18 @@ var heo = {
document.getElementById("toPageButton").href = e)
},
changeSayHelloText: function() {
const e = GLOBAL_CONFIG.helloText.length == 0 ? ["🤖️ 数码科技爱好者", "🔍 分享与热心帮助", "🏠 智能家居小能手", "🔨 设计开发一条龙", "🤝 专修交互与设计", "🏃 脚踏实地行动派", "🧱 团队小组发动机", "💢 壮汉人狠话不多"] : GLOBAL_CONFIG.helloText
, t = document.getElementById("author-info__sayhi");
let o = e[Math.floor(Math.random() * e.length)];
for (; o === lastSayHello; )
o = e[Math.floor(Math.random() * e.length)];
t.textContent = o,
lastSayHello = o
const greetings = GLOBAL_CONFIG.helloText.length == 0 ? ["🤖️ 数码科技爱好者", "🔍 分享与热心帮助", "🏠 智能家居小能手", "🔨 设计开发一条龙", "🤝 专修交互与设计", "🏃 脚踏实地行动派", "🧱 团队小组发动机", "💢 壮汉人狠话不多"] : GLOBAL_CONFIG.helloText
, authorInfoSayHiElement = document.getElementById("author-info__sayhi");
// 如果只有一个问候语,设置为默认值
if (greetings.length === 1) {
authorInfoSayHiElement.textContent = greetings[0];
return;
}
let randomGreeting = greetings[Math.floor(Math.random() * greetings.length)];
for (; randomGreeting === lastSayHello; )
randomGreeting = greetings[Math.floor(Math.random() * greetings.length)];
authorInfoSayHiElement.textContent = randomGreeting,
lastSayHello = randomGreeting
},
//匿名评论