reformat code for jshint compliance

This commit is contained in:
ansuz
2016-05-20 13:39:40 +02:00
parent baf523e9a5
commit 297d8c2d44
3 changed files with 50 additions and 49 deletions

View File

@@ -76,6 +76,41 @@ define([
myUserName = myID;
};
var config = {
//initialState: Messages.codeInitialState,
userName: userName,
websocketURL: Config.websocketURL,
channel: channel,
cryptKey: key,
crypto: Crypto,
setMyID: setMyID,
transformFunction: JsonOT.validate
};
var canonicalize = function (t) { return t.replace(/\r\n/g, '\n'); };
var initializing = true;
var onLocal = config.onLocal = function () {
if (initializing) { return; }
editor.save();
var textValue = canonicalize($textarea.val());
var obj = {content: textValue};
// append the userlist to the hyperjson structure
obj.metadata = userList;
// stringify the json and send it into chainpad
var shjson = stringify(obj);
module.patchText(shjson);
if (module.realtime.getUserDoc() !== shjson) {
console.error("realtime.getUserDoc() !== shjson");
}
};
var createChangeName = function(id, $container) {
var buttonElmt = $container.find('#'+id)[0];
buttonElmt.addEventListener("click", function() {
@@ -95,21 +130,6 @@ define([
});
};
var config = {
//initialState: Messages.codeInitialState,
userName: userName,
websocketURL: Config.websocketURL,
channel: channel,
cryptKey: key,
crypto: Crypto,
setMyID: setMyID,
transformFunction: JsonOT.validate
};
var canonicalize = function (t) { return t.replace(/\r\n/g, '\n'); };
var initializing = true;
var onInit = config.onInit = function (info) {
var $bar = $('#pad-iframe')[0].contentWindow.$('#cme_toolbox');
toolbarList = info.userList;
@@ -130,7 +150,7 @@ define([
// Update the local user data
addToUserList(userData);
}
}
};
var onReady = config.onReady = function (info) {
var realtime = module.realtime = info.realtime;
@@ -170,7 +190,7 @@ define([
}
}
return pos;
}
};
var posToCursor = function(position, newText) {
var cursor = {
@@ -181,7 +201,7 @@ define([
cursor.line = textLines.length - 1;
cursor.ch = textLines[cursor.line].length;
return cursor;
}
};
var onRemote = config.onRemote = function (info) {
if (initializing) { return; }
@@ -226,26 +246,6 @@ define([
}
};
var onLocal = config.onLocal = function () {
if (initializing) { return; }
editor.save();
var textValue = canonicalize($textarea.val());
var obj = {content: textValue};
// append the userlist to the hyperjson structure
obj.metadata = userList;
// stringify the json and send it into chainpad
var shjson = stringify(obj);
module.patchText(shjson);
if (module.realtime.getUserDoc() !== shjson) {
console.error("realtime.getUserDoc() !== shjson");
}
};
var onAbort = config.onAbort = function (info) {
// inform of network disconnect
setEditable(false);