🐐
This commit is contained in:
@@ -3,20 +3,30 @@
|
||||
<head><title>404 Not Found</title></head>
|
||||
<body>
|
||||
<center><h1>404 Not Found</h1></center>
|
||||
<hr><center>The page has been deleted</center>
|
||||
<hr><center id="msg">The page has been deleted.</center>
|
||||
<center id="undo" style="display:none"><br><a href="/">Restore website</a></center>
|
||||
<center id="count" style="display:none"><br><font size="7">10</font></center>
|
||||
<center id="quest" style="display:none"><br><button>Embark on a quest</button></center>
|
||||
<script>
|
||||
/* Restore hatch: clicking the heading undeletes the website */
|
||||
/* Restore hatch: clicking the heading undeletes the website. Undeleting
|
||||
also revokes the quest (no quest for the deleted website if the website
|
||||
isn't deleted) — but the save file survives for the next deletion */
|
||||
function restore() {
|
||||
try {
|
||||
localStorage.removeItem('siteDeleted');
|
||||
localStorage.removeItem('siteDeletedViews');
|
||||
localStorage.removeItem('questStarted');
|
||||
} catch (e) {}
|
||||
}
|
||||
document.querySelector('h1').addEventListener('click', function () {
|
||||
restore();
|
||||
location.replace('/');
|
||||
});
|
||||
/* Embarking unlocks quest.html; the page bounces visitors who never did */
|
||||
document.querySelector('#quest button').addEventListener('click', function () {
|
||||
try { localStorage.setItem('questStarted', '1'); } catch (e) {}
|
||||
location.href = '/quest.html';
|
||||
});
|
||||
/* Restoring is symmetric with deleting: it needs a confirmation too */
|
||||
document.querySelector('#undo a').addEventListener('click', function (e) {
|
||||
if (!confirm('Are you sure? This will restore the entire website.')) {
|
||||
@@ -26,12 +36,31 @@ document.querySelector('#undo a').addEventListener('click', function (e) {
|
||||
restore();
|
||||
});
|
||||
/* View 1 is the deletion, view 2 is the disbelieving reload (nothing
|
||||
changes; that's the point), view 3 gets the way out */
|
||||
changes; that's the point), view 3 gets the way out. Views 4-9 escalate
|
||||
for anyone who keeps reloading past the exit; view 10 drops the act and
|
||||
starts a countdown from 10 (one step per reload); at zero (view 20) the
|
||||
countdown gives way to the quest */
|
||||
var MSGS = {
|
||||
4: 'The page has still been deleted.',
|
||||
5: 'The page has been deleted for all eternity.',
|
||||
6: 'The page has been deleted. If only there was a way to restore it.',
|
||||
7: "The page has been deleted. Click the 'Restore website' button to restore it.",
|
||||
8: "The page has been deleted. Click the 'Restore website' button to restore it.",
|
||||
9: "The page has been deleted. Click the 'Restore website' button to restore it."
|
||||
};
|
||||
try {
|
||||
if (localStorage.getItem('siteDeleted')) {
|
||||
var views = 1 + (parseInt(localStorage.getItem('siteDeletedViews'), 10) || 0);
|
||||
localStorage.setItem('siteDeletedViews', views);
|
||||
if (views > 2) document.getElementById('undo').style.display = '';
|
||||
if (MSGS[views]) document.getElementById('msg').textContent = MSGS[views];
|
||||
if (views >= 20) {
|
||||
document.getElementById('quest').style.display = '';
|
||||
} else if (views >= 10) {
|
||||
var count = document.getElementById('count');
|
||||
count.style.display = '';
|
||||
count.querySelector('font').textContent = 20 - views;
|
||||
}
|
||||
}
|
||||
} catch (e) {}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user