From: Geoffrey Allott Date: Sat, 17 Jun 2023 15:17:33 +0000 (+0100) Subject: show splash screen on logout X-Git-Url: https://git.pointlesshacks.com/?a=commitdiff_plain;h=2a26add09966fd9ddc6167e5cb24534bc3964f3c;p=pokerwave.git show splash screen on logout --- diff --git a/site/modules/socket.js b/site/modules/socket.js index 0e11f0f..ce92836 100644 --- a/site/modules/socket.js +++ b/site/modules/socket.js @@ -280,6 +280,7 @@ export class Socket { case "LoggedIn": this.send({type: "Logout"}); window.localStorage.removeItem("auth"); + this.splash.show(); break; case "InLobby": this.send({type: "LeaveLobby"}); diff --git a/site/modules/splash.js b/site/modules/splash.js index 908e8a7..87ad01f 100644 --- a/site/modules/splash.js +++ b/site/modules/splash.js @@ -67,6 +67,8 @@ export class SplashScreen { this.svg.onclick = () => this.hide(); this.waves = []; this.card_wave(2000); + + this.scheduled = null; this.schedule_card_wave(2000); } @@ -76,9 +78,13 @@ export class SplashScreen { } schedule_card_wave(time) { + if (this.scheduled !== null) { + clearTimeout(this.scheduled); + this.scheduled = null; + } if (!this.hidden) { this.card_wave(time); - setTimeout(() => this.schedule_card_wave(0), 1500); + this.scheduled = setTimeout(() => this.schedule_card_wave(0), 1500); } } @@ -92,4 +98,17 @@ export class SplashScreen { this.logo.classList.add("hidden"); } } + + show() { + if (this.hidden) { + this.hidden = false; + this.container.classList.remove("no-pointer"); + this.upper_bar.classList.remove("retract"); + this.banner.classList.remove("hidden"); + this.lower_bar.classList.remove("retract"); + this.logo.classList.remove("hidden"); + this.card_wave(2000); + this.schedule_card_wave(2000); + } + } }