2013-10-20 14:00:08 +00:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html>
|
|
|
|
|
|
|
|
<head>
|
|
|
|
<title>StackEdit - Recovery</title>
|
|
|
|
<link rel="canonical" href="https://stackedit.io/">
|
|
|
|
<link rel="icon" href="res-min/img/stackedit-32.ico" type="image/x-icon">
|
|
|
|
<link rel="shortcut icon" href="res-min/img/stackedit-32.ico" type="image/x-icon">
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
<link rel="stylesheet" type="text/css" href="res-min/themes/default.css">
|
|
|
|
<script>
|
|
|
|
// Use http://.../?debug to serve original JavaScript files instead of minified
|
|
|
|
var baseDir = 'res-min';
|
|
|
|
var noStart = true;
|
|
|
|
var require = {
|
|
|
|
baseUrl: baseDir,
|
|
|
|
deps: ['main']
|
|
|
|
};
|
|
|
|
setTimeout(function() {
|
2013-11-03 11:31:45 +00:00
|
|
|
var failure = false;
|
2013-10-20 14:00:08 +00:00
|
|
|
try {
|
|
|
|
// Try to use StackEdit dependencies to save a file
|
|
|
|
var utils = require('utils');
|
|
|
|
utils.saveAs(JSON.stringify(localStorage), "StackEdit local storage.json");
|
|
|
|
}
|
|
|
|
catch (e) {
|
|
|
|
// Try something safer
|
|
|
|
document.getElementsByTagName('textarea')[0].value = JSON.stringify(localStorage);
|
2013-11-03 11:31:45 +00:00
|
|
|
failure = true;
|
|
|
|
}
|
|
|
|
listFiles();
|
|
|
|
|
|
|
|
// Show finish messages
|
|
|
|
var eltList = document.querySelectorAll(failure ? '.download-failure' : '.download-success');
|
|
|
|
for (var i = 0; i < eltList.length; ++i) {
|
|
|
|
var elt = eltList[i];
|
|
|
|
show(elt);
|
2013-10-20 14:00:08 +00:00
|
|
|
}
|
|
|
|
}, 5000);
|
|
|
|
|
2013-11-03 11:31:45 +00:00
|
|
|
function show(elt) {
|
|
|
|
elt.className = elt.className.replace(/ hide/, '');
|
|
|
|
}
|
|
|
|
|
|
|
|
function listFiles() {
|
|
|
|
// List files
|
|
|
|
var fileListElt = document.querySelector('.file-list');
|
|
|
|
fileListElt.innerHTML = '';
|
|
|
|
var fileIndexList = (localStorage['file.list'] || '').split(';');
|
|
|
|
for (var i = 0; i < fileIndexList.length; ++i) {
|
|
|
|
var fileIndex = fileIndexList[i];
|
|
|
|
if(!fileIndex) continue;
|
|
|
|
var fileTitle = localStorage[fileIndex + '.title'];
|
|
|
|
var divElt = document.createElement('div');
|
|
|
|
divElt.innerHTML = [
|
|
|
|
'<a href="javascript:removeFile(\'',
|
|
|
|
fileIndex,
|
|
|
|
'\')" class="icon-trash"></a> ',
|
|
|
|
fileTitle,
|
|
|
|
].join('');
|
|
|
|
fileListElt.appendChild(divElt);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function removeFile(fileIndex) {
|
|
|
|
var ok = confirm('Are you sure you want to remove "' + localStorage[fileIndex + '.title'] + '"?');
|
|
|
|
if(ok) {
|
2013-11-03 11:37:55 +00:00
|
|
|
// Protect against multiple windows
|
|
|
|
localStorage.removeItem('frontWindowId');
|
2013-11-03 11:31:45 +00:00
|
|
|
localStorage['file.list'] = localStorage['file.list'].replace(';' + fileIndex + ';', ';');
|
|
|
|
for (var key in localStorage){
|
|
|
|
key.indexOf(fileIndex) === 0 && localStorage.removeItem(key);
|
|
|
|
}
|
|
|
|
listFiles();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-10-20 14:00:08 +00:00
|
|
|
function clearLocalStorage() {
|
|
|
|
var ok = confirm('This will remove all your documents and settings. Are you sure?');
|
2013-11-03 11:31:45 +00:00
|
|
|
if(ok) {
|
|
|
|
localStorage.clear();
|
|
|
|
listFiles();
|
|
|
|
}
|
2013-10-20 14:00:08 +00:00
|
|
|
}
|
|
|
|
</script>
|
|
|
|
<script src="res-min/require.js"></script>
|
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
|
|
|
<div class="container">
|
|
|
|
<br/>
|
|
|
|
<a href="https://stackedit.io/">
|
|
|
|
<img src="res-min/img/stackedit-promo.png" width="240" height="60" />
|
|
|
|
</a>
|
|
|
|
<h3>StackEdit recovery</h3>
|
|
|
|
<p>
|
|
|
|
<strong>The download of your documents and settings will start in 5 seconds...</strong>
|
|
|
|
</p>
|
|
|
|
<p>To import your documents and settings back in StackEdit:</p>
|
|
|
|
<blockquote>
|
|
|
|
<i class="icon-provider-stackedit"></i>
|
|
|
|
<code>Menu</code>
|
|
|
|
<i class="icon-angle-right"></i>
|
|
|
|
<i class="icon-cog"></i>
|
|
|
|
<code>Settings</code>
|
|
|
|
<i class="icon-angle-right"></i>
|
|
|
|
<code>Utils</code>
|
|
|
|
<i class="icon-angle-right"></i>
|
|
|
|
<i class="icon-cog-alt"></i>
|
|
|
|
<code>Import docs & settings</code>
|
|
|
|
</blockquote>
|
|
|
|
<p class="download-success hide text-primary">
|
|
|
|
<strong>
|
|
|
|
<i class="icon-ok"></i>Documents and settings have been downloaded successfully.</strong>
|
|
|
|
</p>
|
|
|
|
<p class="download-failure hide text-danger">
|
|
|
|
<strong>
|
|
|
|
<i class="icon-cancel"></i>Download failed. Please copy/paste the following content in a file:</strong>
|
|
|
|
</p>
|
|
|
|
<p>
|
|
|
|
<textarea class="download-failure hide form-control" rows="10"></textarea>
|
|
|
|
</p>
|
2013-11-03 11:31:45 +00:00
|
|
|
<p class="download-success download-failure hide">To remove one document from the local storage
|
|
|
|
<a href="javascript:void(0)" onclick="show(document.querySelector('.file-list'))">click here</a>.</p>
|
|
|
|
<p class="file-list hide"></p>
|
|
|
|
<p class="download-success download-failure hide">To fully clear the local storage
|
|
|
|
<a href="javascript:void(0)" onclick="clearLocalStorage()">click here</a>.</p>
|
2013-10-20 14:00:08 +00:00
|
|
|
<p class="download-success download-failure hide">To reopen StackEdit
|
|
|
|
<a href="https://stackedit.io/">click here</a>.</p>
|
|
|
|
</div>
|
|
|
|
</body>
|
|
|
|
|
|
|
|
</html>
|