jshint compliance
This commit is contained in:
@@ -25,6 +25,7 @@ define([
|
||||
'/common/messages.js',
|
||||
'/bower_components/modalBox/modalBox-min.js'
|
||||
], function (Messages) {
|
||||
var $ = window.jQuery;
|
||||
|
||||
var STYLE = [
|
||||
'<style>',
|
||||
|
||||
@@ -19,7 +19,7 @@ define([
|
||||
'/common/otaml.js'
|
||||
], function () {
|
||||
|
||||
var $ = jQuery;
|
||||
var $ = window.jQuery;
|
||||
var Otaml = window.Otaml;
|
||||
var module = { exports: {} };
|
||||
var PARANOIA = true;
|
||||
|
||||
@@ -8,6 +8,11 @@
|
||||
* Build date: 8 December 2013
|
||||
*/
|
||||
|
||||
/*
|
||||
TODO FIXME use www/common/rangy if possible...
|
||||
|
||||
*/
|
||||
|
||||
(function(global) {
|
||||
var amdSupported = (typeof global.define == "function" && global.define.amd);
|
||||
|
||||
|
||||
@@ -268,7 +268,7 @@ console.log(new Error().stack);
|
||||
var incomingPatch = function () {
|
||||
if (isErrorState || initializing) { return; }
|
||||
userDocBeforePatch = userDocBeforePatch || getDocHTML(doc);
|
||||
if (PARANOIA && userDocBeforePatch != getDocHTML(doc)) {
|
||||
if (PARANOIA && userDocBeforePatch !== getDocHTML(doc)) {
|
||||
error(false, "userDocBeforePatch != getDocHTML(doc)");
|
||||
}
|
||||
var op = attempt(Otaml.makeTextOperation)(userDocBeforePatch, realtime.getUserDoc());
|
||||
|
||||
@@ -30,6 +30,8 @@ define([
|
||||
// How long to wait before determining that the connection is lost.
|
||||
var MAX_LAG_BEFORE_DISCONNECT = 30000;
|
||||
|
||||
var MAX_RECOVERABLE_ERRORS = 15;
|
||||
|
||||
var warn = function (x) { };
|
||||
var debug = function (x) { };
|
||||
//debug = function (x) { console.log(x) };
|
||||
@@ -409,7 +411,7 @@ define([
|
||||
if (initializing && userList.indexOf(userName) > -1) {
|
||||
initializing = false;
|
||||
$(textArea).val(realtime.getUserDoc());
|
||||
TextArea.attach($(textArea)[0], realtime);
|
||||
textArea.attach($(textArea)[0], realtime);
|
||||
$(textArea).removeAttr("disabled");
|
||||
}
|
||||
if (!initializing) {
|
||||
@@ -676,6 +678,7 @@ define([
|
||||
return onbeforeunload(ev);
|
||||
};
|
||||
var isErrorState = false;
|
||||
var recoverableErrorCount = 0;
|
||||
var error = function (recoverable, err) {
|
||||
console.log(new Error().stack);
|
||||
console.log('error: ' + err.stack);
|
||||
@@ -683,7 +686,9 @@ define([
|
||||
var realtime = socket.realtime;
|
||||
var docHtml = $(textArea).val();
|
||||
isErrorState = true;
|
||||
handleError(socket, realtime, err, docHtml, allMessages);
|
||||
|
||||
// FIXME pull this in from more mainline version
|
||||
//handleError(socket, realtime, err, docHtml, allMessages);
|
||||
};
|
||||
var attempt = function (func) {
|
||||
return function () {
|
||||
@@ -756,8 +761,8 @@ define([
|
||||
if (isErrorState || initializing) { return; }
|
||||
var textAreaVal = $(textArea).val();
|
||||
userDocBeforePatch = userDocBeforePatch || textAreaVal;
|
||||
if (userDocBeforePatch != textAreaVal) {
|
||||
//error(false, "userDocBeforePatch != textAreaVal");
|
||||
if (userDocBeforePatch !== textAreaVal) {
|
||||
//error(false, "userDocBeforePatch !== textAreaVal");
|
||||
}
|
||||
var op = attempt(Otaml.makeTextOperation)(userDocBeforePatch, realtime.getUserDoc());
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ define(function () {
|
||||
*/
|
||||
var applyChange = function(ctx, oldval, newval) {
|
||||
// Strings are immutable and have reference equality. I think this test is O(1), so its worth doing.
|
||||
if (oldval === newval) return;
|
||||
if (oldval === newval) { return; }
|
||||
|
||||
var commonStart = 0;
|
||||
while (oldval.charAt(commonStart) === newval.charAt(commonStart)) {
|
||||
@@ -130,7 +130,7 @@ var attachTextarea = function(elem, ctx, cmElem) {
|
||||
content = elem.value; // Not done on one line so the browser can do newline conversion.
|
||||
|
||||
if(!cmElem) {
|
||||
if (elem.scrollTop !== scrollTop) elem.scrollTop = scrollTop;
|
||||
if (elem.scrollTop !== scrollTop) { elem.scrollTop = scrollTop; }
|
||||
|
||||
// Setting the selection moves the cursor. We'll just have to let your
|
||||
// cursor drift if the element isn't active, though usually users don't
|
||||
|
||||
Reference in New Issue
Block a user