|
|
|
@ -158,15 +158,21 @@ define([
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// this is a little hack, it should go in it's own file.
|
|
|
|
|
// FIXME ok, so let's put it in its own file then
|
|
|
|
|
// TODO there should also be a 'clear recent pads' button
|
|
|
|
|
var rememberPad = function () {
|
|
|
|
|
// FIXME, this is overly complicated, use array methods
|
|
|
|
|
var recentPadsStr = localStorage['CryptPad_RECENTPADS'];
|
|
|
|
|
var recentPads = [];
|
|
|
|
|
if (recentPadsStr) { recentPads = JSON.parse(recentPadsStr); }
|
|
|
|
|
// TODO use window.location.hash or something like that
|
|
|
|
|
if (window.location.href.indexOf('#') === -1) { return; }
|
|
|
|
|
var now = new Date();
|
|
|
|
|
var out = [];
|
|
|
|
|
for (var i = recentPads.length; i >= 0; i--) {
|
|
|
|
|
if (recentPads[i] &&
|
|
|
|
|
// TODO precompute this time value, maybe make it configurable?
|
|
|
|
|
// FIXME precompute the date too, why getTime every time?
|
|
|
|
|
now.getTime() - recentPads[i][1] < (1000*60*60*24*30) &&
|
|
|
|
|
recentPads[i][0] !== window.location.href)
|
|
|
|
|
{
|
|
|
|
@ -175,7 +181,7 @@ define([
|
|
|
|
|
}
|
|
|
|
|
out.push([window.location.href, now.getTime()]);
|
|
|
|
|
localStorage['CryptPad_RECENTPADS'] = JSON.stringify(out);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var create = function ($container, myUserName, realtime) {
|
|
|
|
|
var toolbar = createRealtimeToolbar($container);
|
|
|
|
|