removed unused functions in collab_client
This commit is contained in:
parent
07ee836946
commit
ab7f7506b9
|
@ -189,95 +189,15 @@ function getCollabClient(ace2editor, serverVars, initialUserInfo, options, _pad)
|
|||
|
||||
function setUpSocket()
|
||||
{
|
||||
//oldSocketId = String(Math.floor(Math.random()*1e12));
|
||||
//socketId = String(Math.floor(Math.random()*1e12));
|
||||
/*socket = new io.Socket();
|
||||
socket.connect();*/
|
||||
|
||||
//socket.on('connect', function(){
|
||||
hiccupCount = 0;
|
||||
setChannelState("CONNECTED");
|
||||
/*var msg = { type:"CLIENT_READY", roomType:'padpage',
|
||||
roomName:'padpage/'+globalPadId,
|
||||
data: {
|
||||
lastRev:rev,
|
||||
userInfo:userSet[userId],
|
||||
stats: getStats() } };
|
||||
if (oldSocketId) {
|
||||
msg.data.isReconnectOf = oldSocketId;
|
||||
msg.data.isCommitPending = (state == "COMMITTING");
|
||||
}
|
||||
sendMessage(msg);*/
|
||||
doDeferredActions();
|
||||
|
||||
initialStartConnectTime = +new Date();
|
||||
// });
|
||||
/*socket.on('message', function(obj){
|
||||
if(window.console)
|
||||
console.log(obj);
|
||||
handleMessageFromServer(obj);
|
||||
});*/
|
||||
|
||||
/*var success = false;
|
||||
callCatchingErrors("setUpSocket", function() {
|
||||
appLevelDisconnectReason = null;
|
||||
|
||||
var oldSocketId = socketId;
|
||||
socketId = String(Math.floor(Math.random()*1e12));
|
||||
socket = new WebSocket(socketId);
|
||||
socket.onmessage = wrapRecordingErrors("socket.onmessage", handleMessageFromServer);
|
||||
socket.onclosed = wrapRecordingErrors("socket.onclosed", handleSocketClosed);
|
||||
socket.onopen = wrapRecordingErrors("socket.onopen", function() {
|
||||
hiccupCount = 0;
|
||||
setChannelState("CONNECTED");
|
||||
var msg = { type:"CLIENT_READY", roomType:'padpage',
|
||||
roomName:'padpage/'+globalPadId,
|
||||
data: {
|
||||
lastRev:rev,
|
||||
userInfo:userSet[userId],
|
||||
stats: getStats() } };
|
||||
if (oldSocketId) {
|
||||
msg.data.isReconnectOf = oldSocketId;
|
||||
msg.data.isCommitPending = (state == "COMMITTING");
|
||||
}
|
||||
sendMessage(msg);
|
||||
doDeferredActions();
|
||||
});
|
||||
socket.onhiccup = wrapRecordingErrors("socket.onhiccup", handleCometHiccup);
|
||||
socket.onlogmessage = dmesg;
|
||||
socket.connect();
|
||||
success = true;
|
||||
});
|
||||
if (success) {
|
||||
initialStartConnectTime = +new Date();
|
||||
}
|
||||
else {
|
||||
abandonConnection("initsocketfail");
|
||||
}*/
|
||||
}
|
||||
|
||||
var hiccupCount = 0;
|
||||
|
||||
function handleCometHiccup(params)
|
||||
{
|
||||
dmesg("HICCUP (connected:" + ( !! params.connected) + ")");
|
||||
var connectedNow = params.connected;
|
||||
if (!connectedNow)
|
||||
{
|
||||
hiccupCount++;
|
||||
// skip first "cut off from server" notification
|
||||
if (hiccupCount > 1)
|
||||
{
|
||||
setChannelState("RECONNECTING");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
hiccupCount = 0;
|
||||
setChannelState("CONNECTED");
|
||||
}
|
||||
}
|
||||
|
||||
function sendMessage(msg)
|
||||
{
|
||||
getSocket().json.send(
|
||||
|
@ -678,29 +598,4 @@ function getCollabClient(ace2editor, serverVars, initialUserInfo, options, _pad)
|
|||
return self;
|
||||
}
|
||||
|
||||
function selectElementContents(elem)
|
||||
{
|
||||
if ($.browser.msie)
|
||||
{
|
||||
var range = document.body.createTextRange();
|
||||
range.moveToElementText(elem);
|
||||
range.select();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (window.getSelection)
|
||||
{
|
||||
var browserSelection = window.getSelection();
|
||||
if (browserSelection)
|
||||
{
|
||||
var range = document.createRange();
|
||||
range.selectNodeContents(elem);
|
||||
browserSelection.removeAllRanges();
|
||||
browserSelection.addRange(range);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
exports.getCollabClient = getCollabClient;
|
||||
exports.selectElementContents = selectElementContents;
|
||||
|
|
Loading…
Reference in New Issue