Added recovery in error 404 page

This commit is contained in:
benweet 2014-04-22 00:18:45 +01:00
parent d4c3e83cde
commit 5252d20aac
2 changed files with 23 additions and 13 deletions

View File

@ -1,6 +1,6 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title>StackEdit - 404</title> <title>StackEdit - 404</title>
<link rel="canonical" href="https://stackedit.io/"> <link rel="canonical" href="https://stackedit.io/">
@ -9,13 +9,14 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="https://stackedit.io/res-min/themes/default.css"> <link rel="stylesheet" type="text/css" href="https://stackedit.io/res-min/themes/default.css">
</head> </head>
<body class="text-center"> <body class="text-center">
<br/> <br/>
<p> <p>
<a href="https://stackedit.io"><img src="https://stackedit.io/res-min/img/logo-promo-128.png" width="316" height="64" /></a> <a href="https://stackedit.io"><img src="https://stackedit.io/res-min/img/logo-promo-128.png" width="316" height="64" /></a>
</p> </p>
<p>404 &mdash; Page not found</p> <p>404 &mdash; Page not found</p>
<p><a href="/recovery.html">Need StackEdit recovery?</a></p>
</body> </body>
</html> </html>

View File

@ -1,6 +1,6 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title>StackEdit - Recovery</title> <title>StackEdit - Recovery</title>
<link rel="canonical" href="https://stackedit.io/"> <link rel="canonical" href="https://stackedit.io/">
@ -16,7 +16,15 @@
baseUrl: window.baseDir, baseUrl: window.baseDir,
deps: ['main'] deps: ['main']
}; };
setTimeout(function() { var timer = 5;
function waitTimer() {
try {
document.getElementById('timer').textContent = --timer;
}
catch(e) {}
if(timer) {
return setTimeout(waitTimer, 1000);
}
var failure = false; var failure = false;
try { try {
// Try to use StackEdit dependencies to save a file // Try to use StackEdit dependencies to save a file
@ -29,14 +37,15 @@
failure = true; failure = true;
} }
listFiles(); listFiles();
// Show finish messages // Show finish messages
var eltList = document.querySelectorAll(failure ? '.download-failure' : '.download-success'); var eltList = document.querySelectorAll(failure ? '.download-failure' : '.download-success');
for (var i = 0; i < eltList.length; ++i) { for (var i = 0; i < eltList.length; ++i) {
var elt = eltList[i]; var elt = eltList[i];
show(elt); show(elt);
} }
}, 5000); }
setTimeout(waitTimer, 1000);
function show(elt) { function show(elt) {
elt.className = elt.className.replace(/ hide/, ''); elt.className = elt.className.replace(/ hide/, '');
@ -50,14 +59,14 @@
"'": '&#39;', "'": '&#39;',
"/": '&#x2F;' "/": '&#x2F;'
}; };
function escapeHtml(string) { function escapeHtml(string) {
return String(string).replace(/[&<>"'\/]/g, function(s) { return String(string).replace(/[&<>"'\/]/g, function(s) {
return entityMap[s]; return entityMap[s];
}); });
} }
function listFiles() { function listFiles() {
// List files // List files
var fileListElt = document.querySelector('.file-list'); var fileListElt = document.querySelector('.file-list');
fileListElt.innerHTML = ''; fileListElt.innerHTML = '';
@ -76,7 +85,7 @@
fileListElt.appendChild(divElt); fileListElt.appendChild(divElt);
} }
} }
function removeFile(fileIndex) { function removeFile(fileIndex) {
var ok = confirm('Are you sure you want to remove "' + localStorage[fileIndex + '.title'] + '"?'); var ok = confirm('Are you sure you want to remove "' + localStorage[fileIndex + '.title'] + '"?');
if(ok) { if(ok) {
@ -89,7 +98,7 @@
listFiles(); listFiles();
} }
} }
function clearLocalStorage() { function clearLocalStorage() {
var ok = confirm('This will remove all your documents and settings. Are you sure?'); var ok = confirm('This will remove all your documents and settings. Are you sure?');
if(ok) { if(ok) {
@ -100,7 +109,7 @@
</script> </script>
<script src="res-min/require.js"></script> <script src="res-min/require.js"></script>
</head> </head>
<body> <body>
<div class="container"> <div class="container">
<br/> <br/>
@ -109,7 +118,7 @@
</a> </a>
<h3>StackEdit recovery</h3> <h3>StackEdit recovery</h3>
<p> <p>
<strong>The download of your documents and settings will start in 5 seconds...</strong> <strong>The download of your documents and settings will start in <span id="timer">5</span> seconds...</strong>
</p> </p>
<p>To import your documents and settings back in StackEdit:</p> <p>To import your documents and settings back in StackEdit:</p>
<blockquote> <blockquote>