From afe9be265a122fd02370a5daa276cada08875c80 Mon Sep 17 00:00:00 2001 From: Logan Date: Tue, 2 Jul 2024 16:16:35 -0400 Subject: [PATCH] Many modifications to play screen stopwatch May be added back in the future, but it really is just terrible ui wise rn --- src/routes/play/+page.svelte | 51 ++++------------------------ src/routes/singleplayer/+page.svelte | 2 +- 2 files changed, 7 insertions(+), 46 deletions(-) diff --git a/src/routes/play/+page.svelte b/src/routes/play/+page.svelte index 9951a29..7727039 100644 --- a/src/routes/play/+page.svelte +++ b/src/routes/play/+page.svelte @@ -8,11 +8,13 @@ let game = ""; let core = ""; let url = ""; + let title = ""; if (browser) { const urlParams = new URLSearchParams(window.location.search); game = urlParams.get("game"); core = urlParams.get("core"); + title = urlParams.get("title"); url = base + "/launch.html?core=" + core + "&game=" + game; } @@ -33,46 +35,6 @@ let newURL = window.location.origin + url; navigator.clipboard.writeText(""); } - - // https://www.educative.io/answers/how-to-create-a-stopwatch-in-javascript - // I'll update UI later - var startTime; - var stopwatchInterval; - var elapsedPausedTime = 0; - let timevalue; - - function startStopwatch() { - if (!stopwatchInterval) { - startTime = new Date().getTime() - elapsedPausedTime; - stopwatchInterval = setInterval(updateStopwatch, 1000); - } - } - - function stopStopwatch() { - clearInterval(stopwatchInterval); - elapsedPausedTime = new Date().getTime() - startTime; - stopwatchInterval = null; - } - - function resetStopwatch() { - stopStopwatch(); - elapsedPausedTime = 0; - timevalue = "00:00:00"; - } - - function updateStopwatch() { - var currentTime = new Date().getTime(); - var elapsedTime = currentTime - startTime; - var seconds = Math.floor(elapsedTime / 1000) % 60; - var minutes = Math.floor(elapsedTime / 1000 / 60) % 60; - var hours = Math.floor(elapsedTime / 1000 / 60 / 60); - var displayTime = pad(hours) + ":" + pad(minutes) + ":" + pad(seconds); - timevalue = displayTime; - } - - function pad(number) { - return (number < 10 ? "0" : "") + number; - } @@ -80,13 +42,12 @@
-
+
- - -

{timevalue || "00:00:00"}

+

Now Playing:

+

Core: {core}

-
+
diff --git a/src/routes/singleplayer/+page.svelte b/src/routes/singleplayer/+page.svelte index 4831a7c..7bff004 100644 --- a/src/routes/singleplayer/+page.svelte +++ b/src/routes/singleplayer/+page.svelte @@ -147,7 +147,7 @@ {#if games[selectedStatus.value] && games[selectedStatus.value].length > 0} {#each games[selectedStatus.value] as game (game.file)} {#if game.title.toLowerCase().includes(searchTerm.toLowerCase())} - +

{game.title}

{selectedStatus.label}