From f02a56cf84a8bb3ebcdae392818c750ba1a2e4dc Mon Sep 17 00:00:00 2001 From: Mark Towers Date: Wed, 2 Apr 2025 21:49:43 +0100 Subject: [PATCH] Fixes Atari redirect for different themes (#1354) --- docs/environments/atari.md | 150 ++++++++----------- docs/environments/atari/adventure.md | 150 ++++++++----------- docs/environments/atari/air_raid.md | 150 ++++++++----------- docs/environments/atari/alien.md | 150 ++++++++----------- docs/environments/atari/amidar.md | 150 ++++++++----------- docs/environments/atari/assault.md | 150 ++++++++----------- docs/environments/atari/asterix.md | 150 ++++++++----------- docs/environments/atari/asteroids.md | 150 ++++++++----------- docs/environments/atari/atlantis.md | 150 ++++++++----------- docs/environments/atari/atlantis2.md | 150 ++++++++----------- docs/environments/atari/backgammon.md | 150 ++++++++----------- docs/environments/atari/bank_heist.md | 150 ++++++++----------- docs/environments/atari/basic_math.md | 150 ++++++++----------- docs/environments/atari/battle_zone.md | 150 ++++++++----------- docs/environments/atari/beam_rider.md | 150 ++++++++----------- docs/environments/atari/berzerk.md | 150 ++++++++----------- docs/environments/atari/blackjack.md | 150 ++++++++----------- docs/environments/atari/bowling.md | 150 ++++++++----------- docs/environments/atari/boxing.md | 150 ++++++++----------- docs/environments/atari/breakout.md | 150 ++++++++----------- docs/environments/atari/carnival.md | 150 ++++++++----------- docs/environments/atari/casino.md | 150 ++++++++----------- docs/environments/atari/centipede.md | 150 ++++++++----------- docs/environments/atari/chopper_command.md | 150 ++++++++----------- docs/environments/atari/crazy_climber.md | 150 ++++++++----------- docs/environments/atari/crossbow.md | 150 ++++++++----------- docs/environments/atari/darkchambers.md | 150 ++++++++----------- docs/environments/atari/defender.md | 150 ++++++++----------- docs/environments/atari/demon_attack.md | 150 ++++++++----------- docs/environments/atari/donkey_kong.md | 150 ++++++++----------- docs/environments/atari/double_dunk.md | 150 ++++++++----------- docs/environments/atari/earthworld.md | 150 ++++++++----------- docs/environments/atari/elevator_action.md | 150 ++++++++----------- docs/environments/atari/enduro.md | 150 ++++++++----------- docs/environments/atari/entombed.md | 150 ++++++++----------- docs/environments/atari/et.md | 150 ++++++++----------- docs/environments/atari/fishing_derby.md | 150 ++++++++----------- docs/environments/atari/flag_capture.md | 150 ++++++++----------- docs/environments/atari/freeway.md | 150 ++++++++----------- docs/environments/atari/frogger.md | 150 ++++++++----------- docs/environments/atari/frostbite.md | 150 ++++++++----------- docs/environments/atari/galaxian.md | 150 ++++++++----------- docs/environments/atari/gopher.md | 150 ++++++++----------- docs/environments/atari/gravitar.md | 150 ++++++++----------- docs/environments/atari/hangman.md | 150 ++++++++----------- docs/environments/atari/haunted_house.md | 150 ++++++++----------- docs/environments/atari/hero.md | 150 ++++++++----------- docs/environments/atari/human_cannonball.md | 150 ++++++++----------- docs/environments/atari/ice_hockey.md | 150 ++++++++----------- docs/environments/atari/jamesbond.md | 150 ++++++++----------- docs/environments/atari/journey_escape.md | 150 ++++++++----------- docs/environments/atari/kaboom.md | 150 ++++++++----------- docs/environments/atari/kangaroo.md | 150 ++++++++----------- docs/environments/atari/keystone_kapers.md | 150 ++++++++----------- docs/environments/atari/king_kong.md | 150 ++++++++----------- docs/environments/atari/klax.md | 150 ++++++++----------- docs/environments/atari/koolaid.md | 150 ++++++++----------- docs/environments/atari/krull.md | 150 ++++++++----------- docs/environments/atari/kung_fu_master.md | 150 ++++++++----------- docs/environments/atari/laser_gates.md | 150 ++++++++----------- docs/environments/atari/lost_luggage.md | 150 ++++++++----------- docs/environments/atari/mario_bros.md | 150 ++++++++----------- docs/environments/atari/miniature_golf.md | 150 ++++++++----------- docs/environments/atari/montezuma_revenge.md | 150 ++++++++----------- docs/environments/atari/mr_do.md | 150 ++++++++----------- docs/environments/atari/ms_pacman.md | 150 ++++++++----------- docs/environments/atari/name_this_game.md | 150 ++++++++----------- docs/environments/atari/othello.md | 150 ++++++++----------- docs/environments/atari/pacman.md | 150 ++++++++----------- docs/environments/atari/phoenix.md | 150 ++++++++----------- docs/environments/atari/pitfall.md | 150 ++++++++----------- docs/environments/atari/pitfall2.md | 150 ++++++++----------- docs/environments/atari/pong.md | 150 ++++++++----------- docs/environments/atari/pooyan.md | 150 ++++++++----------- docs/environments/atari/private_eye.md | 150 ++++++++----------- docs/environments/atari/qbert.md | 150 ++++++++----------- docs/environments/atari/riverraid.md | 150 ++++++++----------- docs/environments/atari/road_runner.md | 150 ++++++++----------- docs/environments/atari/robotank.md | 150 ++++++++----------- docs/environments/atari/seaquest.md | 150 ++++++++----------- docs/environments/atari/sir_lancelot.md | 150 ++++++++----------- docs/environments/atari/skiing.md | 150 ++++++++----------- docs/environments/atari/solaris.md | 150 ++++++++----------- docs/environments/atari/space_invaders.md | 150 ++++++++----------- docs/environments/atari/space_war.md | 150 ++++++++----------- docs/environments/atari/star_gunner.md | 150 ++++++++----------- docs/environments/atari/superman.md | 150 ++++++++----------- docs/environments/atari/surround.md | 150 ++++++++----------- docs/environments/atari/tennis.md | 150 ++++++++----------- docs/environments/atari/tetris.md | 150 ++++++++----------- docs/environments/atari/tic_tac_toe_3d.md | 150 ++++++++----------- docs/environments/atari/time_pilot.md | 150 ++++++++----------- docs/environments/atari/trondead.md | 150 ++++++++----------- docs/environments/atari/turmoil.md | 150 ++++++++----------- docs/environments/atari/tutankham.md | 150 ++++++++----------- docs/environments/atari/up_n_down.md | 150 ++++++++----------- docs/environments/atari/venture.md | 150 ++++++++----------- docs/environments/atari/video_checkers.md | 150 ++++++++----------- docs/environments/atari/video_chess.md | 150 ++++++++----------- docs/environments/atari/video_cube.md | 150 ++++++++----------- docs/environments/atari/video_pinball.md | 150 ++++++++----------- docs/environments/atari/wizard_of_wor.md | 150 ++++++++----------- docs/environments/atari/word_zapper.md | 150 ++++++++----------- docs/environments/atari/yars_revenge.md | 150 ++++++++----------- docs/environments/atari/zaxxon.md | 150 ++++++++----------- 105 files changed, 6195 insertions(+), 9555 deletions(-) diff --git a/docs/environments/atari.md b/docs/environments/atari.md index 2be20a3eb..7a567695c 100644 --- a/docs/environments/atari.md +++ b/docs/environments/atari.md @@ -10,104 +10,41 @@ lastpage: Redirecting to Atari's documentation @@ -145,8 +82,39 @@ lastpage: document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/"; diff --git a/docs/environments/atari/adventure.md b/docs/environments/atari/adventure.md index 0aad2d380..894d0ca8b 100644 --- a/docs/environments/atari/adventure.md +++ b/docs/environments/atari/adventure.md @@ -8,104 +8,41 @@ title: Adventure Redirecting to Adventure's documentation @@ -143,8 +80,39 @@ title: Adventure document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/adventure"; diff --git a/docs/environments/atari/air_raid.md b/docs/environments/atari/air_raid.md index 6eac09b93..10e9ccfbe 100644 --- a/docs/environments/atari/air_raid.md +++ b/docs/environments/atari/air_raid.md @@ -8,104 +8,41 @@ title: Air Raid Redirecting to Air Raid's documentation @@ -143,8 +80,39 @@ title: Air Raid document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/air_raid"; diff --git a/docs/environments/atari/alien.md b/docs/environments/atari/alien.md index 8bcbc92e9..1f7b2c626 100644 --- a/docs/environments/atari/alien.md +++ b/docs/environments/atari/alien.md @@ -8,104 +8,41 @@ title: Alien Redirecting to Alien's documentation @@ -143,8 +80,39 @@ title: Alien document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/alien"; diff --git a/docs/environments/atari/amidar.md b/docs/environments/atari/amidar.md index fb6a74baf..5fe346969 100644 --- a/docs/environments/atari/amidar.md +++ b/docs/environments/atari/amidar.md @@ -8,104 +8,41 @@ title: Amidar Redirecting to Amidar's documentation @@ -143,8 +80,39 @@ title: Amidar document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/amidar"; diff --git a/docs/environments/atari/assault.md b/docs/environments/atari/assault.md index b188a2897..55e5a8e71 100644 --- a/docs/environments/atari/assault.md +++ b/docs/environments/atari/assault.md @@ -8,104 +8,41 @@ title: Assault Redirecting to Assault's documentation @@ -143,8 +80,39 @@ title: Assault document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/assault"; diff --git a/docs/environments/atari/asterix.md b/docs/environments/atari/asterix.md index bcd15be02..ba5aa7882 100644 --- a/docs/environments/atari/asterix.md +++ b/docs/environments/atari/asterix.md @@ -8,104 +8,41 @@ title: Asterix Redirecting to Asterix's documentation @@ -143,8 +80,39 @@ title: Asterix document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/asterix"; diff --git a/docs/environments/atari/asteroids.md b/docs/environments/atari/asteroids.md index 1a82f7cc0..630395234 100644 --- a/docs/environments/atari/asteroids.md +++ b/docs/environments/atari/asteroids.md @@ -8,104 +8,41 @@ title: Asteroids Redirecting to Asteroids's documentation @@ -143,8 +80,39 @@ title: Asteroids document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/asteroids"; diff --git a/docs/environments/atari/atlantis.md b/docs/environments/atari/atlantis.md index d73f5dbcd..b7a1c6b68 100644 --- a/docs/environments/atari/atlantis.md +++ b/docs/environments/atari/atlantis.md @@ -8,104 +8,41 @@ title: Atlantis Redirecting to Atlantis's documentation @@ -143,8 +80,39 @@ title: Atlantis document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/atlantis"; diff --git a/docs/environments/atari/atlantis2.md b/docs/environments/atari/atlantis2.md index f456eb520..3b5d9e183 100644 --- a/docs/environments/atari/atlantis2.md +++ b/docs/environments/atari/atlantis2.md @@ -8,104 +8,41 @@ title: Atlantis2 Redirecting to Atlantis2's documentation @@ -143,8 +80,39 @@ title: Atlantis2 document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/atlantis2"; diff --git a/docs/environments/atari/backgammon.md b/docs/environments/atari/backgammon.md index bb29b6177..1fbd57304 100644 --- a/docs/environments/atari/backgammon.md +++ b/docs/environments/atari/backgammon.md @@ -8,104 +8,41 @@ title: Backgammon Redirecting to Backgammon's documentation @@ -143,8 +80,39 @@ title: Backgammon document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/backgammon"; diff --git a/docs/environments/atari/bank_heist.md b/docs/environments/atari/bank_heist.md index 2f423bc03..91671df92 100644 --- a/docs/environments/atari/bank_heist.md +++ b/docs/environments/atari/bank_heist.md @@ -8,104 +8,41 @@ title: Bank Heist Redirecting to Bank Heist's documentation @@ -143,8 +80,39 @@ title: Bank Heist document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/bank_heist"; diff --git a/docs/environments/atari/basic_math.md b/docs/environments/atari/basic_math.md index b1afba8e9..6f1902fbd 100644 --- a/docs/environments/atari/basic_math.md +++ b/docs/environments/atari/basic_math.md @@ -8,104 +8,41 @@ title: Basic Math Redirecting to Basic Math's documentation @@ -143,8 +80,39 @@ title: Basic Math document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/basic_math"; diff --git a/docs/environments/atari/battle_zone.md b/docs/environments/atari/battle_zone.md index 659db95da..6950ba954 100644 --- a/docs/environments/atari/battle_zone.md +++ b/docs/environments/atari/battle_zone.md @@ -8,104 +8,41 @@ title: Battle Zone Redirecting to Battle Zone's documentation @@ -143,8 +80,39 @@ title: Battle Zone document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/battle_zone"; diff --git a/docs/environments/atari/beam_rider.md b/docs/environments/atari/beam_rider.md index 39d2aa473..9a0fefa5b 100644 --- a/docs/environments/atari/beam_rider.md +++ b/docs/environments/atari/beam_rider.md @@ -8,104 +8,41 @@ title: Beam Rider Redirecting to Beam Rider's documentation @@ -143,8 +80,39 @@ title: Beam Rider document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/beam_rider"; diff --git a/docs/environments/atari/berzerk.md b/docs/environments/atari/berzerk.md index 5d1ae65fc..d5a8d0380 100644 --- a/docs/environments/atari/berzerk.md +++ b/docs/environments/atari/berzerk.md @@ -8,104 +8,41 @@ title: Berzerk Redirecting to Berzerk's documentation @@ -143,8 +80,39 @@ title: Berzerk document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/berzerk"; diff --git a/docs/environments/atari/blackjack.md b/docs/environments/atari/blackjack.md index 0f5822a83..d4955548b 100644 --- a/docs/environments/atari/blackjack.md +++ b/docs/environments/atari/blackjack.md @@ -8,104 +8,41 @@ title: Blackjack Redirecting to Blackjack's documentation @@ -143,8 +80,39 @@ title: Blackjack document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/blackjack"; diff --git a/docs/environments/atari/bowling.md b/docs/environments/atari/bowling.md index bb2aca714..b09a2246b 100644 --- a/docs/environments/atari/bowling.md +++ b/docs/environments/atari/bowling.md @@ -8,104 +8,41 @@ title: Bowling Redirecting to Bowling's documentation @@ -143,8 +80,39 @@ title: Bowling document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/bowling"; diff --git a/docs/environments/atari/boxing.md b/docs/environments/atari/boxing.md index cba79289f..41cdeedfc 100644 --- a/docs/environments/atari/boxing.md +++ b/docs/environments/atari/boxing.md @@ -8,104 +8,41 @@ title: Boxing Redirecting to Boxing's documentation @@ -143,8 +80,39 @@ title: Boxing document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/boxing"; diff --git a/docs/environments/atari/breakout.md b/docs/environments/atari/breakout.md index 139a123b6..6bc734e4a 100644 --- a/docs/environments/atari/breakout.md +++ b/docs/environments/atari/breakout.md @@ -8,104 +8,41 @@ title: Breakout Redirecting to Breakout's documentation @@ -143,8 +80,39 @@ title: Breakout document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/breakout"; diff --git a/docs/environments/atari/carnival.md b/docs/environments/atari/carnival.md index 1a770cb61..0b3bb56fc 100644 --- a/docs/environments/atari/carnival.md +++ b/docs/environments/atari/carnival.md @@ -8,104 +8,41 @@ title: Carnival Redirecting to Carnival's documentation @@ -143,8 +80,39 @@ title: Carnival document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/carnival"; diff --git a/docs/environments/atari/casino.md b/docs/environments/atari/casino.md index cb8d2595a..523d42edd 100644 --- a/docs/environments/atari/casino.md +++ b/docs/environments/atari/casino.md @@ -8,104 +8,41 @@ title: Casino Redirecting to Casino's documentation @@ -143,8 +80,39 @@ title: Casino document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/casino"; diff --git a/docs/environments/atari/centipede.md b/docs/environments/atari/centipede.md index 675711e47..600852d3e 100644 --- a/docs/environments/atari/centipede.md +++ b/docs/environments/atari/centipede.md @@ -8,104 +8,41 @@ title: Centipede Redirecting to Centipede's documentation @@ -143,8 +80,39 @@ title: Centipede document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/centipede"; diff --git a/docs/environments/atari/chopper_command.md b/docs/environments/atari/chopper_command.md index 25b0212c1..1cad6bf49 100644 --- a/docs/environments/atari/chopper_command.md +++ b/docs/environments/atari/chopper_command.md @@ -8,104 +8,41 @@ title: Chopper Command Redirecting to Chopper Command's documentation @@ -143,8 +80,39 @@ title: Chopper Command document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/chopper_command"; diff --git a/docs/environments/atari/crazy_climber.md b/docs/environments/atari/crazy_climber.md index d07d71c37..4bed3a134 100644 --- a/docs/environments/atari/crazy_climber.md +++ b/docs/environments/atari/crazy_climber.md @@ -8,104 +8,41 @@ title: Crazy Climber Redirecting to Crazy Climber's documentation @@ -143,8 +80,39 @@ title: Crazy Climber document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/crazy_climber"; diff --git a/docs/environments/atari/crossbow.md b/docs/environments/atari/crossbow.md index d8108295d..8e380ce1a 100644 --- a/docs/environments/atari/crossbow.md +++ b/docs/environments/atari/crossbow.md @@ -8,104 +8,41 @@ title: Crossbow Redirecting to Crossbow's documentation @@ -143,8 +80,39 @@ title: Crossbow document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/crossbow"; diff --git a/docs/environments/atari/darkchambers.md b/docs/environments/atari/darkchambers.md index fb0f5f3a2..139cd193d 100644 --- a/docs/environments/atari/darkchambers.md +++ b/docs/environments/atari/darkchambers.md @@ -8,104 +8,41 @@ title: Darkchambers Redirecting to Darkchambers's documentation @@ -143,8 +80,39 @@ title: Darkchambers document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/darkchambers"; diff --git a/docs/environments/atari/defender.md b/docs/environments/atari/defender.md index 31173684d..0b89acd71 100644 --- a/docs/environments/atari/defender.md +++ b/docs/environments/atari/defender.md @@ -8,104 +8,41 @@ title: Defender Redirecting to Defender's documentation @@ -143,8 +80,39 @@ title: Defender document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/defender"; diff --git a/docs/environments/atari/demon_attack.md b/docs/environments/atari/demon_attack.md index fc4aa688c..357a8dbf5 100644 --- a/docs/environments/atari/demon_attack.md +++ b/docs/environments/atari/demon_attack.md @@ -8,104 +8,41 @@ title: Demon Attack Redirecting to Demon Attack's documentation @@ -143,8 +80,39 @@ title: Demon Attack document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/demon_attack"; diff --git a/docs/environments/atari/donkey_kong.md b/docs/environments/atari/donkey_kong.md index 368c0c632..32d4195ec 100644 --- a/docs/environments/atari/donkey_kong.md +++ b/docs/environments/atari/donkey_kong.md @@ -8,104 +8,41 @@ title: Donkey Kong Redirecting to Donkey Kong's documentation @@ -143,8 +80,39 @@ title: Donkey Kong document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/donkey_kong"; diff --git a/docs/environments/atari/double_dunk.md b/docs/environments/atari/double_dunk.md index 963c68a5b..9a8583a85 100644 --- a/docs/environments/atari/double_dunk.md +++ b/docs/environments/atari/double_dunk.md @@ -8,104 +8,41 @@ title: Double Dunk Redirecting to Double Dunk's documentation @@ -143,8 +80,39 @@ title: Double Dunk document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/double_dunk"; diff --git a/docs/environments/atari/earthworld.md b/docs/environments/atari/earthworld.md index 0dbd1caa6..8a1474331 100644 --- a/docs/environments/atari/earthworld.md +++ b/docs/environments/atari/earthworld.md @@ -8,104 +8,41 @@ title: Earthworld Redirecting to Earthworld's documentation @@ -143,8 +80,39 @@ title: Earthworld document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/earthworld"; diff --git a/docs/environments/atari/elevator_action.md b/docs/environments/atari/elevator_action.md index f26b17fea..9eb667a0f 100644 --- a/docs/environments/atari/elevator_action.md +++ b/docs/environments/atari/elevator_action.md @@ -8,104 +8,41 @@ title: Elevator Action Redirecting to Elevator Action's documentation @@ -143,8 +80,39 @@ title: Elevator Action document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/elevator_action"; diff --git a/docs/environments/atari/enduro.md b/docs/environments/atari/enduro.md index 4699e3a93..2cab22143 100644 --- a/docs/environments/atari/enduro.md +++ b/docs/environments/atari/enduro.md @@ -8,104 +8,41 @@ title: Enduro Redirecting to Enduro's documentation @@ -143,8 +80,39 @@ title: Enduro document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/enduro"; diff --git a/docs/environments/atari/entombed.md b/docs/environments/atari/entombed.md index a77f7188a..e6faf13c4 100644 --- a/docs/environments/atari/entombed.md +++ b/docs/environments/atari/entombed.md @@ -8,104 +8,41 @@ title: Entombed Redirecting to Entombed's documentation @@ -143,8 +80,39 @@ title: Entombed document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/entombed"; diff --git a/docs/environments/atari/et.md b/docs/environments/atari/et.md index f0807c46f..ce1424a12 100644 --- a/docs/environments/atari/et.md +++ b/docs/environments/atari/et.md @@ -8,104 +8,41 @@ title: Et Redirecting to Et's documentation @@ -143,8 +80,39 @@ title: Et document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/et"; diff --git a/docs/environments/atari/fishing_derby.md b/docs/environments/atari/fishing_derby.md index a2e4fcf64..e542e09e7 100644 --- a/docs/environments/atari/fishing_derby.md +++ b/docs/environments/atari/fishing_derby.md @@ -8,104 +8,41 @@ title: Fishing Derby Redirecting to Fishing Derby's documentation @@ -143,8 +80,39 @@ title: Fishing Derby document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/fishing_derby"; diff --git a/docs/environments/atari/flag_capture.md b/docs/environments/atari/flag_capture.md index 307b045b5..2ff409958 100644 --- a/docs/environments/atari/flag_capture.md +++ b/docs/environments/atari/flag_capture.md @@ -8,104 +8,41 @@ title: Flag Capture Redirecting to Flag Capture's documentation @@ -143,8 +80,39 @@ title: Flag Capture document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/flag_capture"; diff --git a/docs/environments/atari/freeway.md b/docs/environments/atari/freeway.md index 94d0c7f2b..f17e0569a 100644 --- a/docs/environments/atari/freeway.md +++ b/docs/environments/atari/freeway.md @@ -8,104 +8,41 @@ title: Freeway Redirecting to Freeway's documentation @@ -143,8 +80,39 @@ title: Freeway document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/freeway"; diff --git a/docs/environments/atari/frogger.md b/docs/environments/atari/frogger.md index 540d7b0e3..ce2e3b11c 100644 --- a/docs/environments/atari/frogger.md +++ b/docs/environments/atari/frogger.md @@ -8,104 +8,41 @@ title: Frogger Redirecting to Frogger's documentation @@ -143,8 +80,39 @@ title: Frogger document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/frogger"; diff --git a/docs/environments/atari/frostbite.md b/docs/environments/atari/frostbite.md index f8877502a..34023004a 100644 --- a/docs/environments/atari/frostbite.md +++ b/docs/environments/atari/frostbite.md @@ -8,104 +8,41 @@ title: Frostbite Redirecting to Frostbite's documentation @@ -143,8 +80,39 @@ title: Frostbite document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/frostbite"; diff --git a/docs/environments/atari/galaxian.md b/docs/environments/atari/galaxian.md index 95c75fd38..fb6a90aef 100644 --- a/docs/environments/atari/galaxian.md +++ b/docs/environments/atari/galaxian.md @@ -8,104 +8,41 @@ title: Galaxian Redirecting to Galaxian's documentation @@ -143,8 +80,39 @@ title: Galaxian document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/galaxian"; diff --git a/docs/environments/atari/gopher.md b/docs/environments/atari/gopher.md index 411b2c319..9094876c2 100644 --- a/docs/environments/atari/gopher.md +++ b/docs/environments/atari/gopher.md @@ -8,104 +8,41 @@ title: Gopher Redirecting to Gopher's documentation @@ -143,8 +80,39 @@ title: Gopher document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/gopher"; diff --git a/docs/environments/atari/gravitar.md b/docs/environments/atari/gravitar.md index 2fe463f14..51290511d 100644 --- a/docs/environments/atari/gravitar.md +++ b/docs/environments/atari/gravitar.md @@ -8,104 +8,41 @@ title: Gravitar Redirecting to Gravitar's documentation @@ -143,8 +80,39 @@ title: Gravitar document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/gravitar"; diff --git a/docs/environments/atari/hangman.md b/docs/environments/atari/hangman.md index 2076703a8..31e940fff 100644 --- a/docs/environments/atari/hangman.md +++ b/docs/environments/atari/hangman.md @@ -8,104 +8,41 @@ title: Hangman Redirecting to Hangman's documentation @@ -143,8 +80,39 @@ title: Hangman document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/hangman"; diff --git a/docs/environments/atari/haunted_house.md b/docs/environments/atari/haunted_house.md index 56fa45522..28f8b2ab0 100644 --- a/docs/environments/atari/haunted_house.md +++ b/docs/environments/atari/haunted_house.md @@ -8,104 +8,41 @@ title: Haunted House Redirecting to Haunted House's documentation @@ -143,8 +80,39 @@ title: Haunted House document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/haunted_house"; diff --git a/docs/environments/atari/hero.md b/docs/environments/atari/hero.md index 7d30cae68..03a635482 100644 --- a/docs/environments/atari/hero.md +++ b/docs/environments/atari/hero.md @@ -8,104 +8,41 @@ title: Hero Redirecting to Hero's documentation @@ -143,8 +80,39 @@ title: Hero document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/hero"; diff --git a/docs/environments/atari/human_cannonball.md b/docs/environments/atari/human_cannonball.md index f70ca981a..acf71295b 100644 --- a/docs/environments/atari/human_cannonball.md +++ b/docs/environments/atari/human_cannonball.md @@ -8,104 +8,41 @@ title: Human Cannonball Redirecting to Human Cannonball's documentation @@ -143,8 +80,39 @@ title: Human Cannonball document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/human_cannonball"; diff --git a/docs/environments/atari/ice_hockey.md b/docs/environments/atari/ice_hockey.md index 41121d723..d9a7899fe 100644 --- a/docs/environments/atari/ice_hockey.md +++ b/docs/environments/atari/ice_hockey.md @@ -8,104 +8,41 @@ title: Ice Hockey Redirecting to Ice Hockey's documentation @@ -143,8 +80,39 @@ title: Ice Hockey document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/ice_hockey"; diff --git a/docs/environments/atari/jamesbond.md b/docs/environments/atari/jamesbond.md index 0fb549606..e0fd92923 100644 --- a/docs/environments/atari/jamesbond.md +++ b/docs/environments/atari/jamesbond.md @@ -8,104 +8,41 @@ title: Jamesbond Redirecting to Jamesbond's documentation @@ -143,8 +80,39 @@ title: Jamesbond document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/jamesbond"; diff --git a/docs/environments/atari/journey_escape.md b/docs/environments/atari/journey_escape.md index aa054bc54..aa850bf74 100644 --- a/docs/environments/atari/journey_escape.md +++ b/docs/environments/atari/journey_escape.md @@ -8,104 +8,41 @@ title: Journey Escape Redirecting to Journey Escape's documentation @@ -143,8 +80,39 @@ title: Journey Escape document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/journey_escape"; diff --git a/docs/environments/atari/kaboom.md b/docs/environments/atari/kaboom.md index fb2e23598..041a2a2dd 100644 --- a/docs/environments/atari/kaboom.md +++ b/docs/environments/atari/kaboom.md @@ -8,104 +8,41 @@ title: Kaboom Redirecting to Kaboom's documentation @@ -143,8 +80,39 @@ title: Kaboom document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/kaboom"; diff --git a/docs/environments/atari/kangaroo.md b/docs/environments/atari/kangaroo.md index 84c36d157..4d23b318b 100644 --- a/docs/environments/atari/kangaroo.md +++ b/docs/environments/atari/kangaroo.md @@ -8,104 +8,41 @@ title: Kangaroo Redirecting to Kangaroo's documentation @@ -143,8 +80,39 @@ title: Kangaroo document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/kangaroo"; diff --git a/docs/environments/atari/keystone_kapers.md b/docs/environments/atari/keystone_kapers.md index 05755dd19..0db0c7d1f 100644 --- a/docs/environments/atari/keystone_kapers.md +++ b/docs/environments/atari/keystone_kapers.md @@ -8,104 +8,41 @@ title: Keystone Kapers Redirecting to Keystone Kapers's documentation @@ -143,8 +80,39 @@ title: Keystone Kapers document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/keystone_kapers"; diff --git a/docs/environments/atari/king_kong.md b/docs/environments/atari/king_kong.md index c4bc65155..de69e7e06 100644 --- a/docs/environments/atari/king_kong.md +++ b/docs/environments/atari/king_kong.md @@ -8,104 +8,41 @@ title: King Kong Redirecting to King Kong's documentation @@ -143,8 +80,39 @@ title: King Kong document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/king_kong"; diff --git a/docs/environments/atari/klax.md b/docs/environments/atari/klax.md index 1fdecb096..b452d21a0 100644 --- a/docs/environments/atari/klax.md +++ b/docs/environments/atari/klax.md @@ -8,104 +8,41 @@ title: Klax Redirecting to Klax's documentation @@ -143,8 +80,39 @@ title: Klax document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/klax"; diff --git a/docs/environments/atari/koolaid.md b/docs/environments/atari/koolaid.md index 4566331e4..752f689eb 100644 --- a/docs/environments/atari/koolaid.md +++ b/docs/environments/atari/koolaid.md @@ -8,104 +8,41 @@ title: Koolaid Redirecting to Koolaid's documentation @@ -143,8 +80,39 @@ title: Koolaid document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/koolaid"; diff --git a/docs/environments/atari/krull.md b/docs/environments/atari/krull.md index ce864b136..a181114ff 100644 --- a/docs/environments/atari/krull.md +++ b/docs/environments/atari/krull.md @@ -8,104 +8,41 @@ title: Krull Redirecting to Krull's documentation @@ -143,8 +80,39 @@ title: Krull document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/krull"; diff --git a/docs/environments/atari/kung_fu_master.md b/docs/environments/atari/kung_fu_master.md index 573b42395..15a56740f 100644 --- a/docs/environments/atari/kung_fu_master.md +++ b/docs/environments/atari/kung_fu_master.md @@ -8,104 +8,41 @@ title: Kung Fu Master Redirecting to Kung Fu Master's documentation @@ -143,8 +80,39 @@ title: Kung Fu Master document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/kung_fu_master"; diff --git a/docs/environments/atari/laser_gates.md b/docs/environments/atari/laser_gates.md index 01425d010..34195e87e 100644 --- a/docs/environments/atari/laser_gates.md +++ b/docs/environments/atari/laser_gates.md @@ -8,104 +8,41 @@ title: Laser Gates Redirecting to Laser Gates's documentation @@ -143,8 +80,39 @@ title: Laser Gates document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/laser_gates"; diff --git a/docs/environments/atari/lost_luggage.md b/docs/environments/atari/lost_luggage.md index 08ae9ed0c..e5ea5f5a4 100644 --- a/docs/environments/atari/lost_luggage.md +++ b/docs/environments/atari/lost_luggage.md @@ -8,104 +8,41 @@ title: Lost Luggage Redirecting to Lost Luggage's documentation @@ -143,8 +80,39 @@ title: Lost Luggage document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/lost_luggage"; diff --git a/docs/environments/atari/mario_bros.md b/docs/environments/atari/mario_bros.md index 2ca1c14ec..945b0bcdf 100644 --- a/docs/environments/atari/mario_bros.md +++ b/docs/environments/atari/mario_bros.md @@ -8,104 +8,41 @@ title: Mario Bros Redirecting to Mario Bros's documentation @@ -143,8 +80,39 @@ title: Mario Bros document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/mario_bros"; diff --git a/docs/environments/atari/miniature_golf.md b/docs/environments/atari/miniature_golf.md index cd361964d..52defe6e7 100644 --- a/docs/environments/atari/miniature_golf.md +++ b/docs/environments/atari/miniature_golf.md @@ -8,104 +8,41 @@ title: Miniature Golf Redirecting to Miniature Golf's documentation @@ -143,8 +80,39 @@ title: Miniature Golf document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/miniature_golf"; diff --git a/docs/environments/atari/montezuma_revenge.md b/docs/environments/atari/montezuma_revenge.md index ebc6dc6ad..3c1ceea06 100644 --- a/docs/environments/atari/montezuma_revenge.md +++ b/docs/environments/atari/montezuma_revenge.md @@ -8,104 +8,41 @@ title: Montezuma Revenge Redirecting to Montezuma Revenge's documentation @@ -143,8 +80,39 @@ title: Montezuma Revenge document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/montezuma_revenge"; diff --git a/docs/environments/atari/mr_do.md b/docs/environments/atari/mr_do.md index fde23c987..1a0e3297d 100644 --- a/docs/environments/atari/mr_do.md +++ b/docs/environments/atari/mr_do.md @@ -8,104 +8,41 @@ title: Mr Do Redirecting to Mr Do's documentation @@ -143,8 +80,39 @@ title: Mr Do document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/mr_do"; diff --git a/docs/environments/atari/ms_pacman.md b/docs/environments/atari/ms_pacman.md index 203ca44cd..cc1476e02 100644 --- a/docs/environments/atari/ms_pacman.md +++ b/docs/environments/atari/ms_pacman.md @@ -8,104 +8,41 @@ title: Ms Pacman Redirecting to Ms Pacman's documentation @@ -143,8 +80,39 @@ title: Ms Pacman document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/ms_pacman"; diff --git a/docs/environments/atari/name_this_game.md b/docs/environments/atari/name_this_game.md index 0eafcd365..d98e30ac2 100644 --- a/docs/environments/atari/name_this_game.md +++ b/docs/environments/atari/name_this_game.md @@ -8,104 +8,41 @@ title: Name This Game Redirecting to Name This Game's documentation @@ -143,8 +80,39 @@ title: Name This Game document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/name_this_game"; diff --git a/docs/environments/atari/othello.md b/docs/environments/atari/othello.md index f7cc1151f..e0b481c49 100644 --- a/docs/environments/atari/othello.md +++ b/docs/environments/atari/othello.md @@ -8,104 +8,41 @@ title: Othello Redirecting to Othello's documentation @@ -143,8 +80,39 @@ title: Othello document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/othello"; diff --git a/docs/environments/atari/pacman.md b/docs/environments/atari/pacman.md index 04b946f7f..48a21397c 100644 --- a/docs/environments/atari/pacman.md +++ b/docs/environments/atari/pacman.md @@ -8,104 +8,41 @@ title: Pacman Redirecting to Pacman's documentation @@ -143,8 +80,39 @@ title: Pacman document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/pacman"; diff --git a/docs/environments/atari/phoenix.md b/docs/environments/atari/phoenix.md index fc6232c08..e3d7a3a50 100644 --- a/docs/environments/atari/phoenix.md +++ b/docs/environments/atari/phoenix.md @@ -8,104 +8,41 @@ title: Phoenix Redirecting to Phoenix's documentation @@ -143,8 +80,39 @@ title: Phoenix document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/phoenix"; diff --git a/docs/environments/atari/pitfall.md b/docs/environments/atari/pitfall.md index dfbed590f..340b82163 100644 --- a/docs/environments/atari/pitfall.md +++ b/docs/environments/atari/pitfall.md @@ -8,104 +8,41 @@ title: Pitfall Redirecting to Pitfall's documentation @@ -143,8 +80,39 @@ title: Pitfall document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/pitfall"; diff --git a/docs/environments/atari/pitfall2.md b/docs/environments/atari/pitfall2.md index 34b553c43..58ed92582 100644 --- a/docs/environments/atari/pitfall2.md +++ b/docs/environments/atari/pitfall2.md @@ -8,104 +8,41 @@ title: Pitfall2 Redirecting to Pitfall2's documentation @@ -143,8 +80,39 @@ title: Pitfall2 document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/pitfall2"; diff --git a/docs/environments/atari/pong.md b/docs/environments/atari/pong.md index 6c556f60e..c2013ede4 100644 --- a/docs/environments/atari/pong.md +++ b/docs/environments/atari/pong.md @@ -8,104 +8,41 @@ title: Pong Redirecting to Pong's documentation @@ -143,8 +80,39 @@ title: Pong document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/pong"; diff --git a/docs/environments/atari/pooyan.md b/docs/environments/atari/pooyan.md index 70076f9b3..09e7f6177 100644 --- a/docs/environments/atari/pooyan.md +++ b/docs/environments/atari/pooyan.md @@ -8,104 +8,41 @@ title: Pooyan Redirecting to Pooyan's documentation @@ -143,8 +80,39 @@ title: Pooyan document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/pooyan"; diff --git a/docs/environments/atari/private_eye.md b/docs/environments/atari/private_eye.md index 107855d24..7d93e416e 100644 --- a/docs/environments/atari/private_eye.md +++ b/docs/environments/atari/private_eye.md @@ -8,104 +8,41 @@ title: Private Eye Redirecting to Private Eye's documentation @@ -143,8 +80,39 @@ title: Private Eye document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/private_eye"; diff --git a/docs/environments/atari/qbert.md b/docs/environments/atari/qbert.md index 801ae6704..0000c8482 100644 --- a/docs/environments/atari/qbert.md +++ b/docs/environments/atari/qbert.md @@ -8,104 +8,41 @@ title: Qbert Redirecting to Qbert's documentation @@ -143,8 +80,39 @@ title: Qbert document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/qbert"; diff --git a/docs/environments/atari/riverraid.md b/docs/environments/atari/riverraid.md index 94ba48fe7..4bb1a14e1 100644 --- a/docs/environments/atari/riverraid.md +++ b/docs/environments/atari/riverraid.md @@ -8,104 +8,41 @@ title: Riverraid Redirecting to Riverraid's documentation @@ -143,8 +80,39 @@ title: Riverraid document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/riverraid"; diff --git a/docs/environments/atari/road_runner.md b/docs/environments/atari/road_runner.md index 62018b322..096ce4d33 100644 --- a/docs/environments/atari/road_runner.md +++ b/docs/environments/atari/road_runner.md @@ -8,104 +8,41 @@ title: Road Runner Redirecting to Road Runner's documentation @@ -143,8 +80,39 @@ title: Road Runner document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/road_runner"; diff --git a/docs/environments/atari/robotank.md b/docs/environments/atari/robotank.md index cb2c359ae..62fa79791 100644 --- a/docs/environments/atari/robotank.md +++ b/docs/environments/atari/robotank.md @@ -8,104 +8,41 @@ title: Robotank Redirecting to Robotank's documentation @@ -143,8 +80,39 @@ title: Robotank document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/robotank"; diff --git a/docs/environments/atari/seaquest.md b/docs/environments/atari/seaquest.md index 7aaca84e9..12c19e850 100644 --- a/docs/environments/atari/seaquest.md +++ b/docs/environments/atari/seaquest.md @@ -8,104 +8,41 @@ title: Seaquest Redirecting to Seaquest's documentation @@ -143,8 +80,39 @@ title: Seaquest document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/seaquest"; diff --git a/docs/environments/atari/sir_lancelot.md b/docs/environments/atari/sir_lancelot.md index 0d742f0e7..a2548324c 100644 --- a/docs/environments/atari/sir_lancelot.md +++ b/docs/environments/atari/sir_lancelot.md @@ -8,104 +8,41 @@ title: Sir Lancelot Redirecting to Sir Lancelot's documentation @@ -143,8 +80,39 @@ title: Sir Lancelot document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/sir_lancelot"; diff --git a/docs/environments/atari/skiing.md b/docs/environments/atari/skiing.md index 20e519459..3e95d515d 100644 --- a/docs/environments/atari/skiing.md +++ b/docs/environments/atari/skiing.md @@ -8,104 +8,41 @@ title: Skiing Redirecting to Skiing's documentation @@ -143,8 +80,39 @@ title: Skiing document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/skiing"; diff --git a/docs/environments/atari/solaris.md b/docs/environments/atari/solaris.md index 4e6163517..90d6933f1 100644 --- a/docs/environments/atari/solaris.md +++ b/docs/environments/atari/solaris.md @@ -8,104 +8,41 @@ title: Solaris Redirecting to Solaris's documentation @@ -143,8 +80,39 @@ title: Solaris document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/solaris"; diff --git a/docs/environments/atari/space_invaders.md b/docs/environments/atari/space_invaders.md index a9cb3f38b..429f204e8 100644 --- a/docs/environments/atari/space_invaders.md +++ b/docs/environments/atari/space_invaders.md @@ -8,104 +8,41 @@ title: Space Invaders Redirecting to Space Invaders's documentation @@ -143,8 +80,39 @@ title: Space Invaders document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/space_invaders"; diff --git a/docs/environments/atari/space_war.md b/docs/environments/atari/space_war.md index 2394b6dfd..3ecc962f9 100644 --- a/docs/environments/atari/space_war.md +++ b/docs/environments/atari/space_war.md @@ -8,104 +8,41 @@ title: Space War Redirecting to Space War's documentation @@ -143,8 +80,39 @@ title: Space War document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/space_war"; diff --git a/docs/environments/atari/star_gunner.md b/docs/environments/atari/star_gunner.md index 71fdecc36..13b673a88 100644 --- a/docs/environments/atari/star_gunner.md +++ b/docs/environments/atari/star_gunner.md @@ -8,104 +8,41 @@ title: Star Gunner Redirecting to Star Gunner's documentation @@ -143,8 +80,39 @@ title: Star Gunner document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/star_gunner"; diff --git a/docs/environments/atari/superman.md b/docs/environments/atari/superman.md index 88c0764bf..08f4496d9 100644 --- a/docs/environments/atari/superman.md +++ b/docs/environments/atari/superman.md @@ -8,104 +8,41 @@ title: Superman Redirecting to Superman's documentation @@ -143,8 +80,39 @@ title: Superman document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/superman"; diff --git a/docs/environments/atari/surround.md b/docs/environments/atari/surround.md index 00e09b8a1..417984a46 100644 --- a/docs/environments/atari/surround.md +++ b/docs/environments/atari/surround.md @@ -8,104 +8,41 @@ title: Surround Redirecting to Surround's documentation @@ -143,8 +80,39 @@ title: Surround document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/surround"; diff --git a/docs/environments/atari/tennis.md b/docs/environments/atari/tennis.md index 088cdc6eb..57db86ae3 100644 --- a/docs/environments/atari/tennis.md +++ b/docs/environments/atari/tennis.md @@ -8,104 +8,41 @@ title: Tennis Redirecting to Tennis's documentation @@ -143,8 +80,39 @@ title: Tennis document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/tennis"; diff --git a/docs/environments/atari/tetris.md b/docs/environments/atari/tetris.md index f3e00aca7..792dbb963 100644 --- a/docs/environments/atari/tetris.md +++ b/docs/environments/atari/tetris.md @@ -8,104 +8,41 @@ title: Tetris Redirecting to Tetris's documentation @@ -143,8 +80,39 @@ title: Tetris document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/tetris"; diff --git a/docs/environments/atari/tic_tac_toe_3d.md b/docs/environments/atari/tic_tac_toe_3d.md index 5c6ac3ff6..583ea309c 100644 --- a/docs/environments/atari/tic_tac_toe_3d.md +++ b/docs/environments/atari/tic_tac_toe_3d.md @@ -8,104 +8,41 @@ title: Tic Tac Toe 3D Redirecting to Tic Tac Toe 3D's documentation @@ -143,8 +80,39 @@ title: Tic Tac Toe 3D document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/tic_tac_toe_3d"; diff --git a/docs/environments/atari/time_pilot.md b/docs/environments/atari/time_pilot.md index 7159db117..2d08beed2 100644 --- a/docs/environments/atari/time_pilot.md +++ b/docs/environments/atari/time_pilot.md @@ -8,104 +8,41 @@ title: Time Pilot Redirecting to Time Pilot's documentation @@ -143,8 +80,39 @@ title: Time Pilot document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/time_pilot"; diff --git a/docs/environments/atari/trondead.md b/docs/environments/atari/trondead.md index e2b7eb19b..7bf410e6f 100644 --- a/docs/environments/atari/trondead.md +++ b/docs/environments/atari/trondead.md @@ -8,104 +8,41 @@ title: Trondead Redirecting to Trondead's documentation @@ -143,8 +80,39 @@ title: Trondead document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/trondead"; diff --git a/docs/environments/atari/turmoil.md b/docs/environments/atari/turmoil.md index 6dc129285..5cc1db0da 100644 --- a/docs/environments/atari/turmoil.md +++ b/docs/environments/atari/turmoil.md @@ -8,104 +8,41 @@ title: Turmoil Redirecting to Turmoil's documentation @@ -143,8 +80,39 @@ title: Turmoil document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/turmoil"; diff --git a/docs/environments/atari/tutankham.md b/docs/environments/atari/tutankham.md index 27c64cb05..a084dd98b 100644 --- a/docs/environments/atari/tutankham.md +++ b/docs/environments/atari/tutankham.md @@ -8,104 +8,41 @@ title: Tutankham Redirecting to Tutankham's documentation @@ -143,8 +80,39 @@ title: Tutankham document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/tutankham"; diff --git a/docs/environments/atari/up_n_down.md b/docs/environments/atari/up_n_down.md index a3f2b299c..c30e88bc7 100644 --- a/docs/environments/atari/up_n_down.md +++ b/docs/environments/atari/up_n_down.md @@ -8,104 +8,41 @@ title: Up N Down Redirecting to Up N Down's documentation @@ -143,8 +80,39 @@ title: Up N Down document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/up_n_down"; diff --git a/docs/environments/atari/venture.md b/docs/environments/atari/venture.md index 794ef8ea0..1473d833e 100644 --- a/docs/environments/atari/venture.md +++ b/docs/environments/atari/venture.md @@ -8,104 +8,41 @@ title: Venture Redirecting to Venture's documentation @@ -143,8 +80,39 @@ title: Venture document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/venture"; diff --git a/docs/environments/atari/video_checkers.md b/docs/environments/atari/video_checkers.md index 4fc62351b..459c4c355 100644 --- a/docs/environments/atari/video_checkers.md +++ b/docs/environments/atari/video_checkers.md @@ -8,104 +8,41 @@ title: Video Checkers Redirecting to Video Checkers's documentation @@ -143,8 +80,39 @@ title: Video Checkers document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/video_checkers"; diff --git a/docs/environments/atari/video_chess.md b/docs/environments/atari/video_chess.md index 0cfc23fc3..8bc0d2dce 100644 --- a/docs/environments/atari/video_chess.md +++ b/docs/environments/atari/video_chess.md @@ -8,104 +8,41 @@ title: Video Chess Redirecting to Video Chess's documentation @@ -143,8 +80,39 @@ title: Video Chess document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/video_chess"; diff --git a/docs/environments/atari/video_cube.md b/docs/environments/atari/video_cube.md index 6e1d8989c..dea23586a 100644 --- a/docs/environments/atari/video_cube.md +++ b/docs/environments/atari/video_cube.md @@ -8,104 +8,41 @@ title: Video Cube Redirecting to Video Cube's documentation @@ -143,8 +80,39 @@ title: Video Cube document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/video_cube"; diff --git a/docs/environments/atari/video_pinball.md b/docs/environments/atari/video_pinball.md index f05dddc96..8fe1c3ad9 100644 --- a/docs/environments/atari/video_pinball.md +++ b/docs/environments/atari/video_pinball.md @@ -8,104 +8,41 @@ title: Video Pinball Redirecting to Video Pinball's documentation @@ -143,8 +80,39 @@ title: Video Pinball document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/video_pinball"; diff --git a/docs/environments/atari/wizard_of_wor.md b/docs/environments/atari/wizard_of_wor.md index b92398a25..50704b77d 100644 --- a/docs/environments/atari/wizard_of_wor.md +++ b/docs/environments/atari/wizard_of_wor.md @@ -8,104 +8,41 @@ title: Wizard Of Wor Redirecting to Wizard Of Wor's documentation @@ -143,8 +80,39 @@ title: Wizard Of Wor document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/wizard_of_wor"; diff --git a/docs/environments/atari/word_zapper.md b/docs/environments/atari/word_zapper.md index 07e1550c6..2e66e26c7 100644 --- a/docs/environments/atari/word_zapper.md +++ b/docs/environments/atari/word_zapper.md @@ -8,104 +8,41 @@ title: Word Zapper Redirecting to Word Zapper's documentation @@ -143,8 +80,39 @@ title: Word Zapper document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/word_zapper"; diff --git a/docs/environments/atari/yars_revenge.md b/docs/environments/atari/yars_revenge.md index 23603eb95..8995dffe7 100644 --- a/docs/environments/atari/yars_revenge.md +++ b/docs/environments/atari/yars_revenge.md @@ -8,104 +8,41 @@ title: Yars Revenge Redirecting to Yars Revenge's documentation @@ -143,8 +80,39 @@ title: Yars Revenge document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/yars_revenge"; diff --git a/docs/environments/atari/zaxxon.md b/docs/environments/atari/zaxxon.md index de78aa02d..9d46a30b7 100644 --- a/docs/environments/atari/zaxxon.md +++ b/docs/environments/atari/zaxxon.md @@ -8,104 +8,41 @@ title: Zaxxon Redirecting to Zaxxon's documentation @@ -143,8 +80,39 @@ title: Zaxxon document.cookie = `${name}=${value}; ${expires}; path=/`; // environments/atari/ } + // Function to apply theme to the popup + function applyTheme() { + const theme = localStorage.getItem("theme") || "auto"; + const body = document.body; + + // Remove any existing theme classes + body.classList.remove("dark-theme", "light-theme"); + + if (theme === "dark") { + body.classList.add("dark-theme"); + } else if (theme === "light") { + body.classList.add("light-theme"); + } else if (theme === "auto") { + // Check system preference for dark mode + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + body.classList.add("dark-theme"); + } else { + body.classList.add("light-theme"); + } + + // Listen for system theme changes + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { + body.classList.remove("dark-theme", "light-theme"); + body.classList.add(e.matches ? "dark-theme" : "light-theme"); + }); + } + } + // Show popup if the cookie doesn't exist window.onload = function() { + // Apply theme first + applyTheme(); + const atariAutoRedirect = getCookie('atariAutoRedirect'); if (atariAutoRedirect) { window.location.href = "https://ale.farama.org/environments/zaxxon";