mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-16 00:41:41 +00:00
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:
parent
ab24bde262
commit
eb3a27ccee
@ -64,8 +64,9 @@
|
|||||||
var newLine = [];
|
var newLine = [];
|
||||||
var index = 0;
|
var index = 0;
|
||||||
for (var i = 0; i < elements.length; i++) {
|
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.
|
newLine[index++] = payload; // Put target payload to the first.
|
||||||
|
}
|
||||||
if (elements[i] !== payload) newLine[index++] = elements[i];
|
if (elements[i] !== payload) newLine[index++] = elements[i];
|
||||||
}
|
}
|
||||||
return newLine.join(' ');
|
return newLine.join(' ');
|
||||||
@ -84,8 +85,7 @@
|
|||||||
onICE: function() {},
|
onICE: function() {},
|
||||||
onOfferSDP: function() {}
|
onOfferSDP: function() {}
|
||||||
}
|
}
|
||||||
},
|
}, options);
|
||||||
options);
|
|
||||||
|
|
||||||
this.mediaData = {
|
this.mediaData = {
|
||||||
SDP: null,
|
SDP: null,
|
||||||
|
@ -152,10 +152,11 @@
|
|||||||
error : function(jqXHR, textStatus, errorThrown) {
|
error : function(jqXHR, textStatus, errorThrown) {
|
||||||
try {
|
try {
|
||||||
var response = $.parseJSON(jqXHR.responseText);
|
var response = $.parseJSON(jqXHR.responseText);
|
||||||
|
|
||||||
if ('console' in window) console.log(response);
|
if ('console' in window) console.log(response);
|
||||||
|
|
||||||
error_cb(response.error, this);
|
error_cb(response.error, this);
|
||||||
}
|
} catch (err) {
|
||||||
catch (err) {
|
|
||||||
// Perhaps the responseText wasn't really a jsonrpc-error.
|
// Perhaps the responseText wasn't really a jsonrpc-error.
|
||||||
error_cb({ error: jqXHR.responseText }, this);
|
error_cb({ error: jqXHR.responseText }, this);
|
||||||
}
|
}
|
||||||
@ -353,12 +354,8 @@
|
|||||||
if (socket.readyState < 1) {
|
if (socket.readyState < 1) {
|
||||||
// The websocket is not open yet; we have to set sending of the message in onopen.
|
// 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.
|
self = this; // In closure below, this is set to the WebSocket. Use self instead.
|
||||||
|
|
||||||
$.JsonRpcClient.q.push(request_json);
|
$.JsonRpcClient.q.push(request_json);
|
||||||
|
} else {
|
||||||
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// We have a socket and it should be ready to send on.
|
// We have a socket and it should be ready to send on.
|
||||||
socket.send(request_json);
|
socket.send(request_json);
|
||||||
}
|
}
|
||||||
@ -410,10 +407,8 @@
|
|||||||
// Run callback with result as parameter.
|
// Run callback with result as parameter.
|
||||||
success_cb(response.result, this);
|
success_cb(response.result, this);
|
||||||
return;
|
return;
|
||||||
}
|
} else if ('error' in response && this._ws_callbacks[response.id]) {
|
||||||
|
|
||||||
// If this is an object with error, it is an error response.
|
// 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.
|
// Get the error callback.
|
||||||
var error_cb = this._ws_callbacks[response.id].error_cb;
|
var error_cb = this._ws_callbacks[response.id].error_cb;
|
||||||
@ -457,9 +452,7 @@
|
|||||||
if (self.options.onWSLogin) {
|
if (self.options.onWSLogin) {
|
||||||
self.options.onWSLogin(false, self);
|
self.options.onWSLogin(false, self);
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -468,12 +461,10 @@
|
|||||||
|
|
||||||
// Run callback with the error object as parameter.
|
// Run callback with the error object as parameter.
|
||||||
error_cb(response.error, this);
|
error_cb(response.error, this);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} catch (err) {
|
||||||
catch (err) {
|
|
||||||
// Probably an error while parsing a non json-string as json. All real JSON-RPC cases are
|
// 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.
|
// handled above, and the fallback method is called below.
|
||||||
console.log("ERROR: "+ err);
|
console.log("ERROR: "+ err);
|
||||||
@ -501,7 +492,6 @@
|
|||||||
socket.send($.toJSON(msg));
|
socket.send($.toJSON(msg));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -595,6 +585,7 @@
|
|||||||
var error_cb = ('error_cb' in call) ? call.error_cb : undefined;
|
var error_cb = ('error_cb' in call) ? call.error_cb : undefined;
|
||||||
self.jsonrpcclient._wsCall(socket, call.request, success_cb, error_cb);
|
self.jsonrpcclient._wsCall(socket, call.request, success_cb, error_cb);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof all_done_cb === 'function') all_done_cb(result);
|
if (typeof all_done_cb === 'function') all_done_cb(result);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -650,13 +641,16 @@
|
|||||||
if (response.id === null || !(response.id in handlers)) {
|
if (response.id === null || !(response.id in handlers)) {
|
||||||
// An error on a notify? Just log it to the console.
|
// An error on a notify? Just log it to the console.
|
||||||
if ('console' in window) console.log(response);
|
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.
|
// Here we should always have a correct id and no error.
|
||||||
if (!(response.id in handlers) && 'console' in window) console.log(response);
|
if (!(response.id in handlers) && 'console' in window) {
|
||||||
else handlers[response.id].success_cb(response.result, this);
|
console.log(response);
|
||||||
|
} else {
|
||||||
|
handlers[response.id].success_cb(response.result, this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,8 +75,7 @@
|
|||||||
audioParams: {},
|
audioParams: {},
|
||||||
iceServers: false,
|
iceServers: false,
|
||||||
ringSleep: 6000
|
ringSleep: 6000
|
||||||
},
|
}, options);
|
||||||
options);
|
|
||||||
|
|
||||||
verto.sessid = $.cookie('verto_session_uuid') || generateGUID();
|
verto.sessid = $.cookie('verto_session_uuid') || generateGUID();
|
||||||
$.cookie('verto_session_uuid', verto.sessid, {
|
$.cookie('verto_session_uuid', verto.sessid, {
|
||||||
@ -84,9 +83,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
verto.dialogs = {};
|
verto.dialogs = {};
|
||||||
|
|
||||||
verto.callbacks = callbacks || {};
|
verto.callbacks = callbacks || {};
|
||||||
|
|
||||||
verto.eventSUBS = {};
|
verto.eventSUBS = {};
|
||||||
|
|
||||||
verto.rpcClient = new $.JsonRpcClient({
|
verto.rpcClient = new $.JsonRpcClient({
|
||||||
@ -123,7 +120,6 @@
|
|||||||
|
|
||||||
$.verto.prototype.iceServers = function(on) {
|
$.verto.prototype.iceServers = function(on) {
|
||||||
var verto = this;
|
var verto = this;
|
||||||
|
|
||||||
verto.options.iceServers = on;
|
verto.options.iceServers = on;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1152,8 +1148,7 @@
|
|||||||
onBroadcast: null,
|
onBroadcast: null,
|
||||||
onLaChange: null,
|
onLaChange: null,
|
||||||
onLaRow: null
|
onLaRow: null
|
||||||
},
|
}, params);
|
||||||
params);
|
|
||||||
|
|
||||||
confMan.verto = verto;
|
confMan.verto = verto;
|
||||||
confMan.serno = CONFMAN_SERNO++;
|
confMan.serno = CONFMAN_SERNO++;
|
||||||
@ -1254,8 +1249,6 @@
|
|||||||
return html;
|
return html;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var atitle = "";
|
var atitle = "";
|
||||||
var awidth = 0;
|
var awidth = 0;
|
||||||
|
|
||||||
@ -1286,10 +1279,8 @@
|
|||||||
}
|
}
|
||||||
confMan.lastTimeout = setTimeout(function() { $(confMan.params.displayID).html(confMan.destroyed ? "" : "Moderator Controls Ready<br><br>")}, 4000);
|
confMan.lastTimeout = setTimeout(function() { $(confMan.params.displayID).html(confMan.destroyed ? "" : "Moderator Controls Ready<br><br>")}, 4000);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var row_callback = null;
|
var row_callback = null;
|
||||||
@ -1303,7 +1294,6 @@
|
|||||||
if (confMan.params.onLaRow) {
|
if (confMan.params.onLaRow) {
|
||||||
confMan.params.onLaRow(verto, confMan, $row, aData);
|
confMan.params.onLaRow(verto, confMan, $row, aData);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -1313,7 +1303,6 @@
|
|||||||
callID: confMan.params.dialog ? confMan.params.dialog.callID : null
|
callID: confMan.params.dialog ? confMan.params.dialog.callID : null
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
"onChange": function(obj, args) {
|
"onChange": function(obj, args) {
|
||||||
$(confMan.params.statusID).text("Conference Members: " + " (" + obj.arrayLen() + " Total)");
|
$(confMan.params.statusID).text("Conference Members: " + " (" + obj.arrayLen() + " Total)");
|
||||||
if (confMan.params.onLaChange) {
|
if (confMan.params.onLaChange) {
|
||||||
@ -1322,7 +1311,8 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
"aaData": [],
|
"aaData": [],
|
||||||
"aoColumns": [{
|
"aoColumns": [
|
||||||
|
{
|
||||||
"sTitle": "ID"
|
"sTitle": "ID"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -1341,8 +1331,8 @@
|
|||||||
{
|
{
|
||||||
"sTitle": atitle,
|
"sTitle": atitle,
|
||||||
"sWidth": awidth,
|
"sWidth": awidth,
|
||||||
|
}
|
||||||
}],
|
],
|
||||||
"bAutoWidth": true,
|
"bAutoWidth": true,
|
||||||
"bDestroy": true,
|
"bDestroy": true,
|
||||||
"bSort": false,
|
"bSort": false,
|
||||||
@ -1401,8 +1391,7 @@
|
|||||||
useStereo: verto.options.useStereo,
|
useStereo: verto.options.useStereo,
|
||||||
tag: verto.options.tag,
|
tag: verto.options.tag,
|
||||||
login: verto.options.login
|
login: verto.options.login
|
||||||
},
|
}, params);
|
||||||
params);
|
|
||||||
|
|
||||||
dialog.verto = verto;
|
dialog.verto = verto;
|
||||||
dialog.direction = direction;
|
dialog.direction = direction;
|
||||||
@ -1476,7 +1465,6 @@
|
|||||||
sdp: dialog.rtc.mediaData.SDP
|
sdp: dialog.rtc.mediaData.SDP
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
RTCcallbacks.onICE = function(rtc) {
|
RTCcallbacks.onICE = function(rtc) {
|
||||||
@ -1485,7 +1473,6 @@
|
|||||||
console.log("offer", rtc.mediaData.candidate);
|
console.log("offer", rtc.mediaData.candidate);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
RTCcallbacks.onError = function(e) {
|
RTCcallbacks.onError = function(e) {
|
||||||
@ -1841,8 +1828,7 @@
|
|||||||
console.log("Dialog " + dialog.callID + "Answering Channel");
|
console.log("Dialog " + dialog.callID + "Answering Channel");
|
||||||
dialog.rtc.answer(params.sdp, function() {
|
dialog.rtc.answer(params.sdp, function() {
|
||||||
dialog.setState($.verto.enum.state.active);
|
dialog.setState($.verto.enum.state.active);
|
||||||
},
|
}, function(e) {
|
||||||
function(e) {
|
|
||||||
console.error(e);
|
console.error(e);
|
||||||
dialog.hangup();
|
dialog.hangup();
|
||||||
});
|
});
|
||||||
@ -1901,8 +1887,7 @@
|
|||||||
console.log("Dialog " + dialog.callID + "Answering Channel");
|
console.log("Dialog " + dialog.callID + "Answering Channel");
|
||||||
dialog.setState($.verto.enum.state.active);
|
dialog.setState($.verto.enum.state.active);
|
||||||
}
|
}
|
||||||
},
|
}, function(e) {
|
||||||
function(e) {
|
|
||||||
console.error(e);
|
console.error(e);
|
||||||
dialog.hangup();
|
dialog.hangup();
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user