Skip to content

Commit

Permalink
Add popup for Atari documentation to alert users to new website (#1194)
Browse files Browse the repository at this point in the history
  • Loading branch information
pseudo-rnd-thoughts authored Oct 5, 2024
1 parent b4bee69 commit 259aa6a
Show file tree
Hide file tree
Showing 105 changed files with 8,506 additions and 211 deletions.
85 changes: 82 additions & 3 deletions docs/environments/atari.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,89 @@ lastpage:

<html>
<head>
<meta http-equiv="refresh" content="0; url=https://ale.farama.org/environments/">
<title>Redirecting to Atari Documentation's new home</title>
<title>Redirecting to Atari's documentation</title>
<style>
/* Basic styles for the popup */
.popup {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
z-index: 999;
justify-content: center;
align-items: center;
}
.popup-content {
background-color: #fff;
padding: 20px;
border-radius: 10px;
text-align: center;
width: 300px;
}
button {
margin-top: 10px;
padding: 5px 10px;
cursor: pointer;
}
</style>
</head>
<body>
<p>If you are not redirected automatically, follow this <a href="https://ale.farama.org/environments/">link to the new page</a>.</p>
<p>If you are not redirected automatically, follow this <a href="https://ale.farama.org/environments/">link to Atari's new page</a>.</p>
<div id="popup" class="popup">
<div class="popup-content">
<p>Atari's documentation has moved to <b>ale.farama.org</b></p>
<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>
</body>

<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/
}

// Show popup if the cookie doesn't exist
window.onload = function() {
const atariAutoRedirect = getCookie('atariAutoRedirect');
if (atariAutoRedirect) {
window.location.href = "https://ale.farama.org/environments/";
} 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/";
})
</script>
</html>
83 changes: 81 additions & 2 deletions docs/environments/atari/adventure.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,89 @@ title: Adventure

<html>
<head>
<meta http-equiv="refresh" content="0; url=https://ale.farama.org/environments/adventure">
<title>Redirecting to Atari Documentation's new home</title>
<title>Redirecting to Adventure's documentation</title>
<style>
/* Basic styles for the popup */
.popup {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
z-index: 999;
justify-content: center;
align-items: center;
}
.popup-content {
background-color: #fff;
padding: 20px;
border-radius: 10px;
text-align: center;
width: 300px;
}
button {
margin-top: 10px;
padding: 5px 10px;
cursor: pointer;
}
</style>
</head>
<body>
<p>If you are not redirected automatically, follow this <a href="https://ale.farama.org/environments/adventure">link to Adventure's new page</a>.</p>
<div id="popup" class="popup">
<div class="popup-content">
<p>Atari's documentation has moved to <b>ale.farama.org</b></p>
<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>
</body>

<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/
}

// Show popup if the cookie doesn't exist
window.onload = function() {
const atariAutoRedirect = getCookie('atariAutoRedirect');
if (atariAutoRedirect) {
window.location.href = "https://ale.farama.org/environments/adventure";
} 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/adventure";
})
</script>
</html>
83 changes: 81 additions & 2 deletions docs/environments/atari/air_raid.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,89 @@ title: Air Raid

<html>
<head>
<meta http-equiv="refresh" content="0; url=https://ale.farama.org/environments/air_raid">
<title>Redirecting to Atari Documentation's new home</title>
<title>Redirecting to Air Raid's documentation</title>
<style>
/* Basic styles for the popup */
.popup {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
z-index: 999;
justify-content: center;
align-items: center;
}
.popup-content {
background-color: #fff;
padding: 20px;
border-radius: 10px;
text-align: center;
width: 300px;
}
button {
margin-top: 10px;
padding: 5px 10px;
cursor: pointer;
}
</style>
</head>
<body>
<p>If you are not redirected automatically, follow this <a href="https://ale.farama.org/environments/air_raid">link to Air Raid's new page</a>.</p>
<div id="popup" class="popup">
<div class="popup-content">
<p>Atari's documentation has moved to <b>ale.farama.org</b></p>
<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>
</body>

<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/
}

// Show popup if the cookie doesn't exist
window.onload = function() {
const atariAutoRedirect = getCookie('atariAutoRedirect');
if (atariAutoRedirect) {
window.location.href = "https://ale.farama.org/environments/air_raid";
} 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/air_raid";
})
</script>
</html>
83 changes: 81 additions & 2 deletions docs/environments/atari/alien.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,89 @@ title: Alien

<html>
<head>
<meta http-equiv="refresh" content="0; url=https://ale.farama.org/environments/alien">
<title>Redirecting to Atari Documentation's new home</title>
<title>Redirecting to Alien's documentation</title>
<style>
/* Basic styles for the popup */
.popup {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
z-index: 999;
justify-content: center;
align-items: center;
}
.popup-content {
background-color: #fff;
padding: 20px;
border-radius: 10px;
text-align: center;
width: 300px;
}
button {
margin-top: 10px;
padding: 5px 10px;
cursor: pointer;
}
</style>
</head>
<body>
<p>If you are not redirected automatically, follow this <a href="https://ale.farama.org/environments/alien">link to Alien's new page</a>.</p>
<div id="popup" class="popup">
<div class="popup-content">
<p>Atari's documentation has moved to <b>ale.farama.org</b></p>
<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>
</body>

<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/
}

// Show popup if the cookie doesn't exist
window.onload = function() {
const atariAutoRedirect = getCookie('atariAutoRedirect');
if (atariAutoRedirect) {
window.location.href = "https://ale.farama.org/environments/alien";
} 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/alien";
})
</script>
</html>
Loading

0 comments on commit 259aa6a

Please sign in to comment.