address more jshint complaints

This commit is contained in:
ansuz 2016-02-12 11:39:37 +01:00
parent f6c848385f
commit 967d636df9
8 changed files with 30 additions and 25 deletions

View File

@ -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){

View File

@ -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];

View File

@ -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);

View File

@ -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;
}
};

View File

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

View File

@ -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;
};

View File

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

View File

@ -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);