2024-09-20 13:56:26 +01:00
---
title: Darkchambers
---
# Darkchambers
2024-09-19 12:17:30 +01:00
< html >
< head >
2024-10-05 14:21:59 +01:00
< title > Redirecting to Darkchambers's documentation< / title >
< style >
/* Basic styles for the popup */
.popup {
2025-04-02 21:49:43 +01:00
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5); /* Default background overlay */
z-index: 999;
justify-content: center;
align-items: center;
2024-10-05 14:21:59 +01:00
}
.popup-content {
2025-04-02 21:49:43 +01:00
background-color: #fff ; /* Default light content background */
padding: 20px;
border-radius: 10px;
text-align: center;
width: 300px;
2024-10-05 14:21:59 +01:00
}
2025-04-02 21:49:43 +01:00
.dark-theme .popup {
background-color: rgba(0, 0, 0, 0.7); /* Darker overlay for dark theme */
2025-03-28 13:40:21 +00:00
}
2025-04-02 21:49:43 +01:00
.dark-theme .popup-content {
background-color: #333 ; /* Dark content background */
color: #fff ; /* Light text for dark theme */
2025-03-28 13:40:21 +00:00
}
2025-04-02 21:49:43 +01:00
button {
margin-top: 10px;
padding: 5px 10px;
cursor: pointer;
2025-03-28 13:40:21 +00:00
}
2025-04-02 21:49:43 +01:00
/* Add spacing between checkbox and label text */
input[type="checkbox"] {
margin-right: 5px;
2024-10-05 14:21:59 +01:00
}
< / style >
2024-09-19 12:17:30 +01:00
< / head >
< body >
2024-09-20 13:56:26 +01:00
< p > If you are not redirected automatically, follow this < a href = "https://ale.farama.org/environments/darkchambers" > link to Darkchambers's new page< / a > .< / p >
2024-10-05 14:21:59 +01:00
< div id = "popup" class = "popup" >
< div class = "popup-content" >
2025-03-28 13:40:21 +00:00
< p > Darkchambers's documentation has moved to < b > ale.farama.org< / b > < / p >
2024-10-05 14:21:59 +01:00
< label >
< input type = "checkbox" id = "atariAutoRedirect" > Enable auto-redirect next time
< / label >
< br >
< button id = "atariRedirectBtn" > Redirect to the new website< / button >
< button id = "closePopupBtn" > Close< / button >
< / div >
< / div >
2024-09-19 12:17:30 +01:00
< / body >
2024-10-05 14:21:59 +01:00
< script >
// Function to get a cookie by name
function getCookie(name) {
console.log(`${document.cookie}` );
const value = `; ${document.cookie}` ;
const parts = value.split(`; ${name}=` );
if (parts.length === 2) {
return parts.pop().split(';').shift();
}
}
// Function to set a cookie
function setCookie(name, value, days) {
const date = new Date();
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
const expires = `expires=${date.toUTCString()}` ;
document.cookie = `${name}=${value}; ${expires}; path=/` ; // environments/atari/
}
2025-04-02 21:49:43 +01:00
// 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");
});
}
}
2024-10-05 14:21:59 +01:00
// Show popup if the cookie doesn't exist
window.onload = function() {
2025-04-02 21:49:43 +01:00
// Apply theme first
applyTheme();
2024-10-05 14:21:59 +01:00
const atariAutoRedirect = getCookie('atariAutoRedirect');
if (atariAutoRedirect) {
window.location.href = "https://ale.farama.org/environments/darkchambers";
} else {
document.getElementById('popup').style.display = 'flex';
}
};
// Close popup and handle the "Don't show again" option
document.getElementById('closePopupBtn').addEventListener('click', function() {
document.getElementById('popup').style.display = 'none';
});
document.getElementById('atariRedirectBtn').addEventListener("click", function() {
if (document.getElementById('atariAutoRedirect').checked) {
setCookie('atariAutoRedirect', 'true', 90); // Set cookie to not show for 90 days
}
console.log("redirecting");
window.location.href = "https://ale.farama.org/environments/darkchambers";
})
< / script >
2024-09-19 12:17:30 +01:00
< / html >