From 6014fa0de9af0c319ddd416c0180e74259536156 Mon Sep 17 00:00:00 2001 From: mileswa1q22 Date: Fri, 4 Apr 2025 13:09:41 +0000 Subject: [PATCH] Implement FPS Counter with Cookie Management Across Multiple Games - Added functionality to display an FPS counter in various games based on a cookie setting. - Introduced a utility function to retrieve cookies and check if the FPS counter is enabled. - Updated the FPS calculation logic to start or hide the counter based on user preferences. - Ensured consistent implementation across multiple HTML files, including games like "Bubble Game", "Basketball Legends", and others. - Enhanced the main index and settings pages to manage FPS counter visibility and added a clock feature. --- Fanf.html | 57 +++++++++++----- .../WebGames-master/BubbleGame/index.html | 57 +++++++++++----- .../index.html | 57 +++++++++++----- .../HexGL-master/HexGL-master/index.html | 57 +++++++++++----- .../Learn-To-Fly-2-main/index.html | 57 +++++++++++----- .../Slope-Game-main/index.html | 57 +++++++++++----- .../Snow-Rider3D-main/index.html | 58 +++++++++++----- .../games/tanuki-sunset-master/index.html | 57 +++++++++++----- .../WebGames-master/games/zTunnel-Rush.html | 57 +++++++++++----- WebGames-master/WebGames-master/index.html | 8 +++ .../flasharchive-main/html/hs-ftc.html | 67 ++++++++++++------- .../flasharchive-main/html/hs-ita-1.html | 57 +++++++++++----- games/henreystikman/BreakingTheBank.html | 57 +++++++++++----- games/henreystikman/Crossing The Pit.html | 57 +++++++++++----- games/henreystikman/Escaping The Prison.html | 57 +++++++++++----- games/henreystikman/Stealing_the_Diamond.html | 57 +++++++++++----- index.html | 53 +++++++++++++++ setting.html | 26 +++++++ stikpage.ht.html | 57 +++++++++++----- 19 files changed, 717 insertions(+), 293 deletions(-) diff --git a/Fanf.html b/Fanf.html index 85529039..73192305 100644 --- a/Fanf.html +++ b/Fanf.html @@ -46,26 +46,47 @@ function yes(){ } \ No newline at end of file diff --git a/WebGames-master/WebGames-master/BubbleGame/index.html b/WebGames-master/WebGames-master/BubbleGame/index.html index 02ec1c54..521df640 100644 --- a/WebGames-master/WebGames-master/BubbleGame/index.html +++ b/WebGames-master/WebGames-master/BubbleGame/index.html @@ -81,26 +81,47 @@ } \ No newline at end of file diff --git a/WebGames-master/WebGames-master/games/Basketball-Legends-2020-gh-pages/Basketball-Legends-2020-gh-pages/index.html b/WebGames-master/WebGames-master/games/Basketball-Legends-2020-gh-pages/Basketball-Legends-2020-gh-pages/index.html index 2f1763c3..34472401 100644 --- a/WebGames-master/WebGames-master/games/Basketball-Legends-2020-gh-pages/Basketball-Legends-2020-gh-pages/index.html +++ b/WebGames-master/WebGames-master/games/Basketball-Legends-2020-gh-pages/Basketball-Legends-2020-gh-pages/index.html @@ -47,26 +47,47 @@ } \ No newline at end of file diff --git a/WebGames-master/WebGames-master/games/HexGL-master/HexGL-master/index.html b/WebGames-master/WebGames-master/games/HexGL-master/HexGL-master/index.html index 93357ad2..ab7bc563 100644 --- a/WebGames-master/WebGames-master/games/HexGL-master/HexGL-master/index.html +++ b/WebGames-master/WebGames-master/games/HexGL-master/HexGL-master/index.html @@ -142,26 +142,47 @@ } \ No newline at end of file diff --git a/WebGames-master/WebGames-master/games/Learn-To-Fly-2-main/Learn-To-Fly-2-main/index.html b/WebGames-master/WebGames-master/games/Learn-To-Fly-2-main/Learn-To-Fly-2-main/index.html index 11c35e61..4d92e6e2 100644 --- a/WebGames-master/WebGames-master/games/Learn-To-Fly-2-main/Learn-To-Fly-2-main/index.html +++ b/WebGames-master/WebGames-master/games/Learn-To-Fly-2-main/Learn-To-Fly-2-main/index.html @@ -38,26 +38,47 @@ } \ No newline at end of file diff --git a/WebGames-master/WebGames-master/games/Slope-Game-main/Slope-Game-main/index.html b/WebGames-master/WebGames-master/games/Slope-Game-main/Slope-Game-main/index.html index c6523dc5..5a651a3b 100644 --- a/WebGames-master/WebGames-master/games/Slope-Game-main/Slope-Game-main/index.html +++ b/WebGames-master/WebGames-master/games/Slope-Game-main/Slope-Game-main/index.html @@ -81,26 +81,47 @@ Drop a star on the repo if you enjoy. } \ No newline at end of file diff --git a/WebGames-master/WebGames-master/games/Snow-Rider3D-main/Snow-Rider3D-main/index.html b/WebGames-master/WebGames-master/games/Snow-Rider3D-main/Snow-Rider3D-main/index.html index f2656afb..0168cc5b 100644 --- a/WebGames-master/WebGames-master/games/Snow-Rider3D-main/Snow-Rider3D-main/index.html +++ b/WebGames-master/WebGames-master/games/Snow-Rider3D-main/Snow-Rider3D-main/index.html @@ -38,27 +38,49 @@ z-index: 1000; /* Ensure it stays on top */ } + \ No newline at end of file diff --git a/WebGames-master/WebGames-master/games/tanuki-sunset-master/index.html b/WebGames-master/WebGames-master/games/tanuki-sunset-master/index.html index b9b8a36c..7db30cec 100644 --- a/WebGames-master/WebGames-master/games/tanuki-sunset-master/index.html +++ b/WebGames-master/WebGames-master/games/tanuki-sunset-master/index.html @@ -38,26 +38,47 @@ } \ No newline at end of file diff --git a/WebGames-master/WebGames-master/games/zTunnel-Rush.html b/WebGames-master/WebGames-master/games/zTunnel-Rush.html index 3fa22def..a13197b2 100644 --- a/WebGames-master/WebGames-master/games/zTunnel-Rush.html +++ b/WebGames-master/WebGames-master/games/zTunnel-Rush.html @@ -162,26 +162,47 @@ window.JOT_formatRelativeToNow=function(a,b){a=((new Date).getTime()-a)/6E4;if(1 } \ No newline at end of file diff --git a/WebGames-master/WebGames-master/index.html b/WebGames-master/WebGames-master/index.html index c4d7b74a..ab349fdd 100644 --- a/WebGames-master/WebGames-master/index.html +++ b/WebGames-master/WebGames-master/index.html @@ -240,6 +240,14 @@
Fnaf Collection
+ + + + + + + +
The Shadow Reform diff --git a/games/flasharchive-main/flasharchive-main/html/hs-ftc.html b/games/flasharchive-main/flasharchive-main/html/hs-ftc.html index 00b6b99e..7712e826 100644 --- a/games/flasharchive-main/flasharchive-main/html/hs-ftc.html +++ b/games/flasharchive-main/flasharchive-main/html/hs-ftc.html @@ -34,26 +34,47 @@ } \ No newline at end of file + const fpsCounter = document.getElementById("fps-counter"); + + // Utility function to get a cookie + function getCookie(name) { + const cookies = document.cookie.split(';'); + for (let i = 0; i < cookies.length; i++) { + const cookie = cookies[i].trim(); + if (cookie.startsWith(name + '=')) { + return cookie.substring(name.length + 1); + } + } + return null; + } + + // Check if FPS Counter is enabled + const fpsCounterEnabled = getCookie('fpsCounter') === 'true'; + + if (fpsCounterEnabled) { + fpsCounter.style.display = 'block'; // Show FPS counter + + function calculateFPS() { + let lastFrameTime = performance.now(); + let frames = 0; + + function frameLoop() { + const now = performance.now(); + frames++; + + if (now - lastFrameTime >= 1000) { + const fps = Math.round(frames / ((now - lastFrameTime) / 1000)); + fpsCounter.textContent = `FPS: ${fps}`; + frames = 0; + lastFrameTime = now; + } + requestAnimationFrame(frameLoop); + } + frameLoop(); + } + + calculateFPS(); // Start FPS calculation + } else { + fpsCounter.style.display = 'none'; // Hide FPS counter + } + \ No newline at end of file diff --git a/games/flasharchive-main/flasharchive-main/html/hs-ita-1.html b/games/flasharchive-main/flasharchive-main/html/hs-ita-1.html index ac94f153..c0839d01 100644 --- a/games/flasharchive-main/flasharchive-main/html/hs-ita-1.html +++ b/games/flasharchive-main/flasharchive-main/html/hs-ita-1.html @@ -34,26 +34,47 @@ } \ No newline at end of file diff --git a/games/henreystikman/BreakingTheBank.html b/games/henreystikman/BreakingTheBank.html index 27ff2b78..99d13e8d 100644 --- a/games/henreystikman/BreakingTheBank.html +++ b/games/henreystikman/BreakingTheBank.html @@ -28,26 +28,47 @@ } \ No newline at end of file diff --git a/games/henreystikman/Crossing The Pit.html b/games/henreystikman/Crossing The Pit.html index 1740d49b..e634dbb0 100644 --- a/games/henreystikman/Crossing The Pit.html +++ b/games/henreystikman/Crossing The Pit.html @@ -31,26 +31,47 @@ } \ No newline at end of file diff --git a/games/henreystikman/Escaping The Prison.html b/games/henreystikman/Escaping The Prison.html index 1b367a8c..7de48184 100644 --- a/games/henreystikman/Escaping The Prison.html +++ b/games/henreystikman/Escaping The Prison.html @@ -28,26 +28,47 @@ } \ No newline at end of file diff --git a/games/henreystikman/Stealing_the_Diamond.html b/games/henreystikman/Stealing_the_Diamond.html index 454e08fe..df69f58a 100644 --- a/games/henreystikman/Stealing_the_Diamond.html +++ b/games/henreystikman/Stealing_the_Diamond.html @@ -31,26 +31,47 @@ } \ No newline at end of file diff --git a/index.html b/index.html index 645094ac..63658108 100644 --- a/index.html +++ b/index.html @@ -82,6 +82,7 @@ +

Moon Gaming

@@ -133,6 +134,58 @@ // Apply saved mode on load const darkModeEnabled = getCookie('darkMode') === 'true'; applyDarkMode(darkModeEnabled); + + // Clock Functionality + function updateClock() { + const now = new Date(); + const hours = String(now.getHours()).padStart(2, '0'); + const minutes = String(now.getMinutes()).padStart(2, '0'); + const seconds = String(now.getSeconds()).padStart(2, '0'); + const timeString = `${hours}:${minutes}:${seconds}`; + const dateString = now.toDateString(); // Get the current date as a string + document.getElementById('clock').innerHTML = `${dateString}
${timeString}`; + } + + // Update the clock every second + setInterval(updateClock, 1000); + updateClock(); // Initialize clock immediately + + // Ensure FPS Counter is enabled by default + if (getCookie('fpsCounter') === null) { + setCookie('fpsCounter', 'true', 30); // Default to enabled + } + + // Check if FPS Counter is enabled + const fpsCounterEnabled = getCookie('fpsCounter') === 'true'; + + if (fpsCounterEnabled) { + const fpsCounter = document.getElementById('fpsCounter'); + let lastFrameTime = performance.now(); + let frames = 0; + + function calculateFPS() { + const now = performance.now(); + frames++; + + if (now - lastFrameTime >= 1000) { + const fps = Math.round(frames / ((now - lastFrameTime) / 1000)); + fpsCounter.textContent = `FPS: ${fps}`; + frames = 0; + lastFrameTime = now; + } + + requestAnimationFrame(calculateFPS); + } + + calculateFPS(); // Start FPS calculation + } + + // Check if Date and Time is enabled + const dateTimeEnabled = getCookie('dateTime') === 'true'; + + if (dateTimeEnabled) { + document.getElementById('clock').style.display = 'block'; // Show the clock + } diff --git a/setting.html b/setting.html index 21c602e3..9c62d0ed 100644 --- a/setting.html +++ b/setting.html @@ -91,6 +91,10 @@ Enable Text-to-Speech
+
+ Show Date and Time + +
Clear Cookies @@ -237,6 +241,27 @@ // Apply saved Text-to-Speech preference on load applyTextToSpeechSetting(textToSpeechEnabled); + // Date and Time Toggle + const toggleDateTimeButton = document.getElementById('toggleDateTime'); + const dateTimeEnabled = getCookie('dateTime') === 'true'; + + function applyDateTimeSetting(enabled) { + if (enabled) { + toggleDateTimeButton.textContent = 'Disable'; + } else { + toggleDateTimeButton.textContent = 'Enable'; + } + } + + toggleDateTimeButton.addEventListener('click', () => { + const isDateTimeEnabled = getCookie('dateTime') === 'true'; + setCookie('dateTime', !isDateTimeEnabled, 30); // Save preference for 30 days + applyDateTimeSetting(!isDateTimeEnabled); + }); + + // Apply saved Date and Time preference on load + applyDateTimeSetting(dateTimeEnabled); + // Regional Settings const regionSelect = document.getElementById('regionSelect'); const savedRegion = getCookie('region') || 'us'; // Default to 'us' @@ -279,6 +304,7 @@ applyFPSCounterSetting(false); // Default: FPS Counter disabled applyMaturityFilterSetting(false); // Default: Maturity Filter disabled applyTextToSpeechSetting(false); // Default: Text-to-Speech disabled + applyDateTimeSetting(false); // Default: Date and Time disabled alert('Settings have been reset to default!'); }); diff --git a/stikpage.ht.html b/stikpage.ht.html index 397990f8..943c6e1f 100644 --- a/stikpage.ht.html +++ b/stikpage.ht.html @@ -28,26 +28,47 @@ } \ No newline at end of file