From 9fc44cdf0c45918680eb99a595766fd0c4fd490a Mon Sep 17 00:00:00 2001 From: ansuz Date: Wed, 13 Jan 2016 05:43:58 -0500 Subject: [PATCH] add notes to clientside js files --- www/common/chainpad.js | 1 + www/common/otaml.js | 1 + www/common/toolbar.js | 8 +++++++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/www/common/chainpad.js b/www/common/chainpad.js index 275a774a4..375670c7a 100644 --- a/www/common/chainpad.js +++ b/www/common/chainpad.js @@ -487,6 +487,7 @@ var toString = Message.toString = function (msg) { var fromString = Message.fromString = function (str) { var msg = str; + // FIXME factor this as you did on the serverside code var unameLen = msg.substring(0,msg.indexOf(':')); msg = msg.substring(unameLen.length+1); var userName = msg.substring(0,Number(unameLen)); diff --git a/www/common/otaml.js b/www/common/otaml.js index 5ea64aef7..3c5482847 100644 --- a/www/common/otaml.js +++ b/www/common/otaml.js @@ -281,6 +281,7 @@ var transformB = function (html, toTransform, transformBy) { 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) { return transformB(html, toTransform, transformBy); diff --git a/www/common/toolbar.js b/www/common/toolbar.js index e53e638ea..f695858e4 100644 --- a/www/common/toolbar.js +++ b/www/common/toolbar.js @@ -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);