use 4 spaces indent to match the default of jslint

this is the first step of making the code follow the default jslint behaviour,
I also manually changed some { } to make it reasonable in addition to replacing tabs
This commit is contained in:
Seven Du 2014-11-11 23:33:03 +08:00
parent ab24bde262
commit eb3a27ccee
3 changed files with 908 additions and 929 deletions

View File

@ -64,8 +64,9 @@
var newLine = [];
var index = 0;
for (var i = 0; i < elements.length; i++) {
if (index === 3) // Format of media starts from the fourth.
if (index === 3) { // Format of media starts from the fourth.
newLine[index++] = payload; // Put target payload to the first.
}
if (elements[i] !== payload) newLine[index++] = elements[i];
}
return newLine.join(' ');
@ -84,8 +85,7 @@
onICE: function() {},
onOfferSDP: function() {}
}
},
options);
}, options);
this.mediaData = {
SDP: null,
@ -402,7 +402,7 @@
video: this.options.useVideo,
audio: true
}, onSuccess, onError);
*/
*/
};

View File

@ -152,10 +152,11 @@
error : function(jqXHR, textStatus, errorThrown) {
try {
var response = $.parseJSON(jqXHR.responseText);
if ('console' in window) console.log(response);
error_cb(response.error, this);
}
catch (err) {
} catch (err) {
// Perhaps the responseText wasn't really a jsonrpc-error.
error_cb({ error: jqXHR.responseText }, this);
}
@ -353,12 +354,8 @@
if (socket.readyState < 1) {
// The websocket is not open yet; we have to set sending of the message in onopen.
self = this; // In closure below, this is set to the WebSocket. Use self instead.
$.JsonRpcClient.q.push(request_json);
}
else {
} else {
// We have a socket and it should be ready to send on.
socket.send(request_json);
}
@ -395,7 +392,7 @@
// Get the success callback.
var success_cb = this._ws_callbacks[response.id].success_cb;
/*
/*
// set the sessid if present
if ('sessid' in response.result && !this.options.sessid || (this.options.sessid != response.result.sessid)) {
this.options.sessid = response.result.sessid;
@ -403,17 +400,15 @@
console.log("setting session UUID to: " + this.options.sessid);
}
}
*/
*/
// Delete the callback from the storage.
delete this._ws_callbacks[response.id];
// Run callback with result as parameter.
success_cb(response.result, this);
return;
}
} else if ('error' in response && this._ws_callbacks[response.id]) {
// If this is an object with error, it is an error response.
else if ('error' in response && this._ws_callbacks[response.id]) {
// Get the error callback.
var error_cb = this._ws_callbacks[response.id].error_cb;
@ -457,9 +452,7 @@
if (self.options.onWSLogin) {
self.options.onWSLogin(false, self);
}
}
);
});
return;
}
@ -468,12 +461,10 @@
// Run callback with the error object as parameter.
error_cb(response.error, this);
return;
}
}
}
catch (err) {
} catch (err) {
// Probably an error while parsing a non json-string as json. All real JSON-RPC cases are
// handled above, and the fallback method is called below.
console.log("ERROR: "+ err);
@ -501,7 +492,6 @@
socket.send($.toJSON(msg));
}
}
}
};
@ -595,6 +585,7 @@
var error_cb = ('error_cb' in call) ? call.error_cb : undefined;
self.jsonrpcclient._wsCall(socket, call.request, success_cb, error_cb);
}
if (typeof all_done_cb === 'function') all_done_cb(result);
return;
}
@ -650,13 +641,16 @@
if (response.id === null || !(response.id in handlers)) {
// An error on a notify? Just log it to the console.
if ('console' in window) console.log(response);
} else {
handlers[response.id].error_cb(response.error, this);
}
else handlers[response.id].error_cb(response.error, this);
}
else {
} else {
// Here we should always have a correct id and no error.
if (!(response.id in handlers) && 'console' in window) console.log(response);
else handlers[response.id].success_cb(response.result, this);
if (!(response.id in handlers) && 'console' in window) {
console.log(response);
} else {
handlers[response.id].success_cb(response.result, this);
}
}
}

View File

@ -75,8 +75,7 @@
audioParams: {},
iceServers: false,
ringSleep: 6000
},
options);
}, options);
verto.sessid = $.cookie('verto_session_uuid') || generateGUID();
$.cookie('verto_session_uuid', verto.sessid, {
@ -84,9 +83,7 @@
});
verto.dialogs = {};
verto.callbacks = callbacks || {};
verto.eventSUBS = {};
verto.rpcClient = new $.JsonRpcClient({
@ -123,7 +120,6 @@
$.verto.prototype.iceServers = function(on) {
var verto = this;
verto.options.iceServers = on;
};
@ -1152,8 +1148,7 @@
onBroadcast: null,
onLaChange: null,
onLaRow: null
},
params);
}, params);
confMan.verto = verto;
confMan.serno = CONFMAN_SERNO++;
@ -1254,8 +1249,6 @@
return html;
}
var atitle = "";
var awidth = 0;
@ -1286,10 +1279,8 @@
}
confMan.lastTimeout = setTimeout(function() { $(confMan.params.displayID).html(confMan.destroyed ? "" : "Moderator Controls Ready<br><br>")}, 4000);
}
}
});
}
var row_callback = null;
@ -1303,7 +1294,6 @@
if (confMan.params.onLaRow) {
confMan.params.onLaRow(verto, confMan, $row, aData);
}
}
};
}
@ -1313,7 +1303,6 @@
callID: confMan.params.dialog ? confMan.params.dialog.callID : null
},
"onChange": function(obj, args) {
$(confMan.params.statusID).text("Conference Members: " + " (" + obj.arrayLen() + " Total)");
if (confMan.params.onLaChange) {
@ -1322,7 +1311,8 @@
},
"aaData": [],
"aoColumns": [{
"aoColumns": [
{
"sTitle": "ID"
},
{
@ -1341,8 +1331,8 @@
{
"sTitle": atitle,
"sWidth": awidth,
}],
}
],
"bAutoWidth": true,
"bDestroy": true,
"bSort": false,
@ -1401,8 +1391,7 @@
useStereo: verto.options.useStereo,
tag: verto.options.tag,
login: verto.options.login
},
params);
}, params);
dialog.verto = verto;
dialog.direction = direction;
@ -1476,7 +1465,6 @@
sdp: dialog.rtc.mediaData.SDP
});
}
};
RTCcallbacks.onICE = function(rtc) {
@ -1485,7 +1473,6 @@
console.log("offer", rtc.mediaData.candidate);
return;
}
};
RTCcallbacks.onError = function(e) {
@ -1841,8 +1828,7 @@
console.log("Dialog " + dialog.callID + "Answering Channel");
dialog.rtc.answer(params.sdp, function() {
dialog.setState($.verto.enum.state.active);
},
function(e) {
}, function(e) {
console.error(e);
dialog.hangup();
});
@ -1901,8 +1887,7 @@
console.log("Dialog " + dialog.callID + "Answering Channel");
dialog.setState($.verto.enum.state.active);
}
},
function(e) {
}, function(e) {
console.error(e);
dialog.hangup();
});