show splash screen on logout
authorGeoffrey Allott <geoffrey@allott.email>
Sat, 17 Jun 2023 15:17:33 +0000 (16:17 +0100)
committerGeoffrey Allott <geoffrey@allott.email>
Sat, 17 Jun 2023 15:17:33 +0000 (16:17 +0100)
site/modules/socket.js
site/modules/splash.js

index 0e11f0fffd8373d2f449cd078ed338b542db4b70..ce92836d2663e7a76800287911c24a2977b8ed8d 100644 (file)
@@ -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"});
index 908e8a779da46d9b44f7ac15894d392b98022c8e..87ad01f293bfb8d99fdf1db06e40888131dbb902 100644 (file)
@@ -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);
+        }
+    }
 }