🐐
This commit is contained in:
@@ -4,12 +4,36 @@
|
||||
<body>
|
||||
<center><h1>404 Not Found</h1></center>
|
||||
<hr><center>The page has been deleted</center>
|
||||
<center id="undo" style="display:none"><br><a href="/">Restore website</a></center>
|
||||
<script>
|
||||
/* Restore hatch: clicking the heading undeletes the website */
|
||||
function restore() {
|
||||
try {
|
||||
localStorage.removeItem('siteDeleted');
|
||||
localStorage.removeItem('siteDeletedViews');
|
||||
} catch (e) {}
|
||||
}
|
||||
document.querySelector('h1').addEventListener('click', function () {
|
||||
try { localStorage.removeItem('siteDeleted'); } catch (e) {}
|
||||
restore();
|
||||
location.replace('/');
|
||||
});
|
||||
/* 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.')) {
|
||||
e.preventDefault();
|
||||
return;
|
||||
}
|
||||
restore();
|
||||
});
|
||||
/* View 1 is the deletion, view 2 is the disbelieving reload (nothing
|
||||
changes; that's the point), view 3 gets the way out */
|
||||
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 = '';
|
||||
}
|
||||
} catch (e) {}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user