add notes to clientside js files

pull/1/head
ansuz 9 years ago
parent a8beeec0ad
commit 9fc44cdf0c

@ -487,6 +487,7 @@ var toString = Message.toString = function (msg) {
var fromString = Message.fromString = function (str) { var fromString = Message.fromString = function (str) {
var msg = str; var msg = str;
// FIXME factor this as you did on the serverside code
var unameLen = msg.substring(0,msg.indexOf(':')); var unameLen = msg.substring(0,msg.indexOf(':'));
msg = msg.substring(unameLen.length+1); msg = msg.substring(unameLen.length+1);
var userName = msg.substring(0,Number(unameLen)); var userName = msg.substring(0,Number(unameLen));

@ -281,6 +281,7 @@ var transformB = function (html, toTransform, transformBy) {
var out = Operation.merge(inverse, toApply); var out = Operation.merge(inverse, toApply);
}; };
// FIXME looks like the old transform is deprecated? figure out why
var transform = module.exports.transform = function (html, toTransform, transformBy) { var transform = module.exports.transform = function (html, toTransform, transformBy) {
return transformB(html, toTransform, transformBy); return transformB(html, toTransform, transformBy);

@ -158,15 +158,21 @@ define([
}; };
// this is a little hack, it should go in it's own file. // 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 () { var rememberPad = function () {
// FIXME, this is overly complicated, use array methods
var recentPadsStr = localStorage['CryptPad_RECENTPADS']; var recentPadsStr = localStorage['CryptPad_RECENTPADS'];
var recentPads = []; var recentPads = [];
if (recentPadsStr) { recentPads = JSON.parse(recentPadsStr); } if (recentPadsStr) { recentPads = JSON.parse(recentPadsStr); }
// TODO use window.location.hash or something like that
if (window.location.href.indexOf('#') === -1) { return; } if (window.location.href.indexOf('#') === -1) { return; }
var now = new Date(); var now = new Date();
var out = []; var out = [];
for (var i = recentPads.length; i >= 0; i--) { for (var i = recentPads.length; i >= 0; i--) {
if (recentPads[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) && now.getTime() - recentPads[i][1] < (1000*60*60*24*30) &&
recentPads[i][0] !== window.location.href) recentPads[i][0] !== window.location.href)
{ {
@ -175,7 +181,7 @@ define([
} }
out.push([window.location.href, now.getTime()]); out.push([window.location.href, now.getTime()]);
localStorage['CryptPad_RECENTPADS'] = JSON.stringify(out); localStorage['CryptPad_RECENTPADS'] = JSON.stringify(out);
} };
var create = function ($container, myUserName, realtime) { var create = function ($container, myUserName, realtime) {
var toolbar = createRealtimeToolbar($container); var toolbar = createRealtimeToolbar($container);

Loading…
Cancel
Save