address more jshint complaints

pull/1/head
ansuz 9 years ago
parent f6c848385f
commit 967d636df9

@ -35,7 +35,7 @@ if (config.privKeyAndCertFiles) {
privKeyAndCerts = privKeyAndCerts + Fs.readFileSync(file); privKeyAndCerts = privKeyAndCerts + Fs.readFileSync(file);
}); });
var array = privKeyAndCerts.split('\n-----BEGIN '); 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; var privKey;
for (var i = 0; i < array.length; i++) { for (var i = 0; i < array.length; i++) {
if (array[i].indexOf('PRIVATE KEY-----\n') !== -1) { if (array[i].indexOf('PRIVATE KEY-----\n') !== -1) {
@ -49,7 +49,7 @@ if (config.privKeyAndCertFiles) {
cert: array.shift(), cert: array.shift(),
key: privKey, key: privKey,
ca: array ca: array
} };
} }
app.get('/api/config', function(req, res){ app.get('/api/config', function(req, res){

@ -1,7 +1,7 @@
define([], function () { define([], function () {
return function (n) { return function (n) {
n = n || 24; // default is 24 colours
var r = 0.6, var r = 0.6,
n = n || 24, // default is 24 colours
i = 0, i = 0,
t = [], t = [],
rgb = [0,2,4]; rgb = [0,2,4];

@ -69,10 +69,12 @@ define([
because otherwise special keybindings like ctrl-b and ctrl-i because otherwise special keybindings like ctrl-b and ctrl-i
would open bookmarks and info instead of applying bold/italic styles would open bookmarks and info instead of applying bold/italic styles
*/ */
docBody && bindEvents(docBody, if (docBody) {
bindEvents(docBody,
['textInput', 'keydown', 'keyup', 'select', 'cut', 'paste'], ['textInput', 'keydown', 'keyup', 'select', 'cut', 'paste'],
onEvent, onEvent,
unbind); unbind);
}
bindEvents(textarea, bindEvents(textarea,
['mousedown','mouseup','click','change'], ['mousedown','mouseup','click','change'],
onEvent, onEvent,
@ -179,10 +181,11 @@ define([
transformFunction: config.transformFunction transformFunction: config.transformFunction
}); });
if (config.onInit) {
config.onInit && config.onInit({ config.onInit({
realtime: realtime realtime: realtime
}); });
}
onEvent = function () { onEvent = function () {
if (isErrorState || initializing) { return; } if (isErrorState || initializing) { return; }
@ -198,9 +201,11 @@ define([
// execute an onReady callback if one was supplied // execute an onReady callback if one was supplied
// pass an object so we can extend this later // pass an object so we can extend this later
config.onReady && config.onReady({ if (config.onReady) {
config.onReady({
userList: userList userList: userList
}); });
}
}); });
var whoami = new RegExp(userName.replace(/\/\+/g, function (c) { var whoami = new RegExp(userName.replace(/\/\+/g, function (c) {
@ -231,7 +236,7 @@ define([
} else { } else {
//verbose("Received remote message"); //verbose("Received remote message");
// obviously this is only going to get called if // 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) { if (recoverableErrorCount >= MAX_RECOVERABLE_ERRORS) {
warn("Giving up!"); warn("Giving up!");
abort(socket, realtime); abort(socket, realtime);
socketChecker && clearInterval(socketChecker); if (socketChecker) { clearInterval(socketChecker); }
} }
} else { } else {
// TODO // TODO
} }
},200); },200);
bindAllEvents(textarea, doc, onEvent, false) bindAllEvents(textarea, doc, onEvent, false);
// attach textarea? // attach textarea?
sharejs.attach(textarea, realtime); sharejs.attach(textarea, realtime);

@ -111,7 +111,7 @@ define([
var txt = spinnerElement.textContent || '-'; var txt = spinnerElement.textContent || '-';
var inc = (reversed) ? -1 : 1; var inc = (reversed) ? -1 : 1;
spinnerElement.textContent = SPINNER[(SPINNER.indexOf(txt) + inc) % SPINNER.length]; 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.timeout = setTimeout(function () {
spinnerElement.textContent = ''; spinnerElement.textContent = '';
}, SPINNER_DISAPPEAR_TIME); }, SPINNER_DISAPPEAR_TIME);
@ -134,8 +134,7 @@ define([
} else if (userList.length === 2) { } else if (userList.length === 2) {
listElement.textContent = Messages.editingWithOneOtherPerson; listElement.textContent = Messages.editingWithOneOtherPerson;
} else { } else {
listElement.textContent = Messages.editingWith + ' ' + (userList.length - 1) + ' ' listElement.textContent = Messages.editingWith + ' ' + (userList.length - 1) + ' ' + Messages.otherPeople;
Messages.otherPeople;
} }
}; };

@ -69,7 +69,7 @@ define([
var showError = function (errorType, docHtml, moreInfo) { var showError = function (errorType, docHtml, moreInfo) {
$('body').append('<div class="modalBox"></div>'); $('body').append('<div class="modalBox"></div>');
var $modalbox = $('.modalBox') var $modalbox = $('.modalBox');
$modalbox.append(CONTENT + STYLE); $modalbox.append(CONTENT + STYLE);
$modalbox.find('.errorType').text(Messages['errorBox_errorType_' + errorType]); $modalbox.find('.errorType').text(Messages['errorBox_errorType_' + errorType]);

@ -95,7 +95,7 @@ define([
if (PARANOIA && getInnerHTML(dom) !== docText) { throw new Error(); } 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; return idx;
}; };

@ -45,6 +45,7 @@ define([
var interval = 100; var interval = 100;
var first = function () { var first = function () {
// FIXME assignment in conditional
if (Ckeditor = ifrw.CKEDITOR) { if (Ckeditor = ifrw.CKEDITOR) {
andThen(); andThen();
} else { } else {

@ -104,12 +104,12 @@ define([
/* FIXME /* FIXME
operational transform on json shouldn't be in all editors operational transform on json shouldn't be in all editors
just those transmitting/expecting JSON just those transmitting/expecting JSON
*/ console.log({
false && console.log({
text: text, text: text,
toTransform: toTransform, toTransform: toTransform,
transformBy: transformBy transformBy: transformBy
}); });
*/
var resultOp = ChainPad.Operation.transform0(text, toTransform, transformBy); var resultOp = ChainPad.Operation.transform0(text, toTransform, transformBy);
var text2 = ChainPad.Operation.apply(transformBy, text); var text2 = ChainPad.Operation.apply(transformBy, text);

Loading…
Cancel
Save