diff --git a/server.js b/server.js index 5784e2292..6c912cfe4 100644 --- a/server.js +++ b/server.js @@ -35,7 +35,7 @@ if (config.privKeyAndCertFiles) { privKeyAndCerts = privKeyAndCerts + Fs.readFileSync(file); }); var array = privKeyAndCerts.split('\n-----BEGIN '); - for (var i = 1; i < array.length; i++) { array[i] = '-----BEGIN ' + array[i] } + for (var i = 1; i < array.length; i++) { array[i] = '-----BEGIN ' + array[i]; } var privKey; for (var i = 0; i < array.length; i++) { if (array[i].indexOf('PRIVATE KEY-----\n') !== -1) { @@ -49,7 +49,7 @@ if (config.privKeyAndCertFiles) { cert: array.shift(), key: privKey, ca: array - } + }; } app.get('/api/config', function(req, res){ diff --git a/www/common/rainbow.js b/www/common/rainbow.js index 765b42294..843755cf2 100644 --- a/www/common/rainbow.js +++ b/www/common/rainbow.js @@ -1,7 +1,7 @@ define([], function () { return function (n) { + n = n || 24; // default is 24 colours var r = 0.6, - n = n || 24, // default is 24 colours i = 0, t = [], rgb = [0,2,4]; diff --git a/www/common/realtime-input.js b/www/common/realtime-input.js index 146206dd1..ad0e03e71 100644 --- a/www/common/realtime-input.js +++ b/www/common/realtime-input.js @@ -69,10 +69,12 @@ define([ because otherwise special keybindings like ctrl-b and ctrl-i would open bookmarks and info instead of applying bold/italic styles */ - docBody && bindEvents(docBody, - ['textInput', 'keydown', 'keyup', 'select', 'cut', 'paste'], - onEvent, - unbind); + if (docBody) { + bindEvents(docBody, + ['textInput', 'keydown', 'keyup', 'select', 'cut', 'paste'], + onEvent, + unbind); + } bindEvents(textarea, ['mousedown','mouseup','click','change'], onEvent, @@ -179,10 +181,11 @@ define([ transformFunction: config.transformFunction }); - - config.onInit && config.onInit({ - realtime: realtime - }); + if (config.onInit) { + config.onInit({ + realtime: realtime + }); + } onEvent = function () { if (isErrorState || initializing) { return; } @@ -198,9 +201,11 @@ define([ // execute an onReady callback if one was supplied // pass an object so we can extend this later - config.onReady && config.onReady({ - userList: userList - }); + if (config.onReady) { + config.onReady({ + userList: userList + }); + } }); var whoami = new RegExp(userName.replace(/\/\+/g, function (c) { @@ -231,7 +236,7 @@ define([ } else { //verbose("Received remote message"); // obviously this is only going to get called if - onRemote && onRemote(realtime.getUserDoc()); + if (onRemote) { onRemote(realtime.getUserDoc()); } } } } @@ -271,14 +276,14 @@ define([ if (recoverableErrorCount >= MAX_RECOVERABLE_ERRORS) { warn("Giving up!"); abort(socket, realtime); - socketChecker && clearInterval(socketChecker); + if (socketChecker) { clearInterval(socketChecker); } } } else { // TODO } },200); - bindAllEvents(textarea, doc, onEvent, false) + bindAllEvents(textarea, doc, onEvent, false); // attach textarea? sharejs.attach(textarea, realtime); diff --git a/www/common/toolbar.js b/www/common/toolbar.js index f695858e4..4159ea0ac 100644 --- a/www/common/toolbar.js +++ b/www/common/toolbar.js @@ -111,7 +111,7 @@ define([ var txt = spinnerElement.textContent || '-'; var inc = (reversed) ? -1 : 1; spinnerElement.textContent = SPINNER[(SPINNER.indexOf(txt) + inc) % SPINNER.length]; - spinnerElement.timeout && clearTimeout(spinnerElement.timeout); + if (spinnerElement.timeout) { clearTimeout(spinnerElement.timeout); } spinnerElement.timeout = setTimeout(function () { spinnerElement.textContent = ''; }, SPINNER_DISAPPEAR_TIME); @@ -134,8 +134,7 @@ define([ } else if (userList.length === 2) { listElement.textContent = Messages.editingWithOneOtherPerson; } else { - listElement.textContent = Messages.editingWith + ' ' + (userList.length - 1) + ' ' - Messages.otherPeople; + listElement.textContent = Messages.editingWith + ' ' + (userList.length - 1) + ' ' + Messages.otherPeople; } }; diff --git a/www/pad/errorbox.js b/www/pad/errorbox.js index f0c214225..c6515316e 100644 --- a/www/pad/errorbox.js +++ b/www/pad/errorbox.js @@ -69,7 +69,7 @@ define([ var showError = function (errorType, docHtml, moreInfo) { $('body').append('
'); - var $modalbox = $('.modalBox') + var $modalbox = $('.modalBox'); $modalbox.append(CONTENT + STYLE); $modalbox.find('.errorType').text(Messages['errorBox_errorType_' + errorType]); diff --git a/www/pad/html-patcher.js b/www/pad/html-patcher.js index 8859c668e..5ed6617a0 100644 --- a/www/pad/html-patcher.js +++ b/www/pad/html-patcher.js @@ -95,7 +95,7 @@ define([ if (PARANOIA && getInnerHTML(dom) !== docText) { throw new Error(); } } - if (PARANOIA && docText.indexOf(content, idx) !== idx) { throw new Error() } + if (PARANOIA && docText.indexOf(content, idx) !== idx) { throw new Error(); } return idx; }; diff --git a/www/pad/main.js b/www/pad/main.js index 3fc1f5edd..668ba7ded 100644 --- a/www/pad/main.js +++ b/www/pad/main.js @@ -45,6 +45,7 @@ define([ var interval = 100; var first = function () { + // FIXME assignment in conditional if (Ckeditor = ifrw.CKEDITOR) { andThen(); } else { diff --git a/www/vdom/main.js b/www/vdom/main.js index 1f18f4f6f..d62289ce8 100644 --- a/www/vdom/main.js +++ b/www/vdom/main.js @@ -104,12 +104,12 @@ define([ /* FIXME operational transform on json shouldn't be in all editors just those transmitting/expecting JSON - */ - false && console.log({ + console.log({ text: text, toTransform: toTransform, transformBy: transformBy - }); + }); + */ var resultOp = ChainPad.Operation.transform0(text, toTransform, transformBy); var text2 = ChainPad.Operation.apply(transformBy, text);