From 55e255220b3a3c5996e8309a15c93bc9b82f3ee6 Mon Sep 17 00:00:00 2001 From: binary-husky Date: Wed, 17 Jul 2024 17:12:32 +0000 Subject: [PATCH] update --- themes/common.css | 2 +- themes/welcome.js | 21 ++++++++++++++------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/themes/common.css b/themes/common.css index 6d139b63..9e620aca 100644 --- a/themes/common.css +++ b/themes/common.css @@ -172,7 +172,7 @@ padding: 15px; margin: 10px; flex: 0 0 calc(30% - 10px); - transition: opacity 0.5s ease-in-out; + transition: opacity 0.2s ease-in-out; opacity: 1; } diff --git a/themes/welcome.js b/themes/welcome.js index fdf94275..221d15c9 100644 --- a/themes/welcome.js +++ b/themes/welcome.js @@ -54,18 +54,21 @@ class WelcomeMessage { this.max_welcome_card_num = 6; this.card_array = []; this.static_welcome_message_previous = []; + this.reflesh_time_interval = 15*1000; } begin_render() { this.update(); - this.startRefleshCards(); } async startRefleshCards() { + await new Promise(r => setTimeout(r, this.reflesh_time_interval)); await this.reflesh_cards(); - setTimeout(() => { - this.startRefleshCards.call(this); - }, 15000); + if (this.visible){ + setTimeout(() => { + this.startRefleshCards.call(this); + }, 1); + } } async reflesh_cards() { @@ -110,8 +113,8 @@ class WelcomeMessage { card.classList.add('hide'); - // 等待 500 毫秒 - await new Promise(r => setTimeout(r, 250)); + // 等待 250 毫秒 + await new Promise(r => setTimeout(r, 200)); } })(); } @@ -135,19 +138,23 @@ class WelcomeMessage { } async update() { - console.log('update') + // console.log('update') if (!await this.isChatbotEmpty()) { if (this.visible) { this.removeWelcome(); this.visible = false; + this.card_array = []; + this.static_welcome_message_previous = []; } return; } if (this.visible){ return; } + // console.log("welcome"); this.showWelcome(); this.visible = true; + this.startRefleshCards(); } showCard(message) {