mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-26 10:26:15 -04:00
Unified timeslider and pad editing protocol / component
This commit is contained in:
parent
d08f3ff5ee
commit
914d79ad20
8 changed files with 359 additions and 578 deletions
|
@ -84,14 +84,14 @@ function loadBroadcastJS(socket, sendSocketMsg, fireWhenAllScriptsAreLoaded, Bro
|
|||
var appLevelDisconnectReason = null;
|
||||
|
||||
var padContents = {
|
||||
currentRevision: clientVars.revNum,
|
||||
currentTime: clientVars.currentTime,
|
||||
currentLines: Changeset.splitTextLines(clientVars.initialStyledContents.atext.text),
|
||||
currentRevision: clientVars.collab_client_vars.rev,
|
||||
currentTime: clientVars.collab_client_vars.time,
|
||||
currentLines: Changeset.splitTextLines(clientVars.collab_client_vars.initialAttributedText.text),
|
||||
currentDivs: null,
|
||||
// to be filled in once the dom loads
|
||||
apool: (new AttribPool()).fromJsonable(clientVars.initialStyledContents.apool),
|
||||
apool: (new AttribPool()).fromJsonable(clientVars.collab_client_vars.apool),
|
||||
alines: Changeset.splitAttributionLines(
|
||||
clientVars.initialStyledContents.atext.attribs, clientVars.initialStyledContents.atext.text),
|
||||
clientVars.collab_client_vars.initialAttributedText.attribs, clientVars.collab_client_vars.initialAttributedText.text),
|
||||
|
||||
// generates a jquery element containing HTML for a line
|
||||
lineToElement: function(line, aline)
|
||||
|
@ -432,19 +432,6 @@ function loadBroadcastJS(socket, sendSocketMsg, fireWhenAllScriptsAreLoaded, Bro
|
|||
var start = request.rev;
|
||||
var requestID = Math.floor(Math.random() * 100000);
|
||||
|
||||
/*var msg = { "component" : "timeslider",
|
||||
"type":"CHANGESET_REQ",
|
||||
"padId": padId,
|
||||
"token": token,
|
||||
"protocolVersion": 2,
|
||||
"data"
|
||||
{
|
||||
"start": start,
|
||||
"granularity": granularity
|
||||
}};
|
||||
|
||||
socket.send(msg);*/
|
||||
|
||||
sendSocketMsg("CHANGESET_REQ", {
|
||||
"start": start,
|
||||
"granularity": granularity,
|
||||
|
@ -452,19 +439,6 @@ function loadBroadcastJS(socket, sendSocketMsg, fireWhenAllScriptsAreLoaded, Bro
|
|||
});
|
||||
|
||||
self.reqCallbacks[requestID] = callback;
|
||||
|
||||
/*debugLog("loadinging revision", start, "through ajax");
|
||||
$.getJSON("/ep/pad/changes/" + clientVars.padIdForUrl + "?s=" + start + "&g=" + granularity, function (data, textStatus)
|
||||
{
|
||||
if (textStatus !== "success")
|
||||
{
|
||||
console.log(textStatus);
|
||||
BroadcastSlider.showReconnectUI();
|
||||
}
|
||||
self.handleResponse(data, start, granularity, callback);
|
||||
|
||||
setTimeout(self.loadFromQueue, 10); // load the next ajax function
|
||||
});*/
|
||||
},
|
||||
handleSocketResponse: function(message)
|
||||
{
|
||||
|
@ -493,7 +467,7 @@ function loadBroadcastJS(socket, sendSocketMsg, fireWhenAllScriptsAreLoaded, Bro
|
|||
revisionInfo.addChangeset(astart, aend, forwardcs, backwardcs, data.timeDeltas[i]);
|
||||
}
|
||||
if (callback) callback(start - 1, start + data.forwardsChangesets.length * granularity - 1);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function handleMessageFromServer()
|
||||
|
@ -686,7 +660,7 @@ function loadBroadcastJS(socket, sendSocketMsg, fireWhenAllScriptsAreLoaded, Bro
|
|||
}
|
||||
}
|
||||
|
||||
receiveAuthorData(clientVars.historicalAuthorData);
|
||||
receiveAuthorData(clientVars.collab_client_vars.historicalAuthorData);
|
||||
|
||||
return changesetLoader;
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ function loadBroadcastRevisionsJS()
|
|||
endRevision.addChangeset(fromIndex, backChangeset, -1 * timeDelta);
|
||||
}
|
||||
|
||||
revisionInfo.latest = clientVars.totalRevs || -1;
|
||||
revisionInfo.latest = clientVars.collab_client_vars.rev || -1;
|
||||
|
||||
revisionInfo.createNew = function(index)
|
||||
{
|
||||
|
|
|
@ -481,8 +481,8 @@ function loadBroadcastSliderJS(fireWhenAllScriptsAreLoaded)
|
|||
}
|
||||
|
||||
$("#timeslider").show();
|
||||
setSliderLength(clientVars.totalRevs);
|
||||
setSliderPosition(clientVars.revNum);
|
||||
setSliderLength(clientVars.collab_client_vars.rev);
|
||||
setSliderPosition(clientVars.collab_client_vars.rev);
|
||||
|
||||
_.each(clientVars.savedRevisions, function(revision)
|
||||
{
|
||||
|
|
|
@ -316,7 +316,7 @@ function handshake()
|
|||
receivedClientVars = true;
|
||||
|
||||
//set some client vars
|
||||
clientVars = obj;
|
||||
clientVars = obj.data;
|
||||
clientVars.userAgent = "Anonymous";
|
||||
clientVars.collab_client_vars.clientAgent = "Anonymous";
|
||||
|
||||
|
|
|
@ -87,6 +87,9 @@ function init() {
|
|||
else if(message.accessStatus)
|
||||
{
|
||||
$("body").html("<h2>You have no permission to access this pad</h2>")
|
||||
} else {
|
||||
console.warn("Unknown message type: " + message.type);
|
||||
console.warn(["XXX", message]);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -107,7 +110,7 @@ function sendSocketMsg(type, data)
|
|||
var sessionID = readCookie("sessionID");
|
||||
var password = readCookie("password");
|
||||
|
||||
var msg = { "component" : "timeslider",
|
||||
var msg = { "component" : "pad", // FIXME: Remove this stupidity!
|
||||
"type": type,
|
||||
"data": data,
|
||||
"padId": padId,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue