summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--node/TimesliderMessageHandler.js5
-rw-r--r--static/js/broadcast_revisions.js11
-rw-r--r--static/timeslider.html8
3 files changed, 11 insertions, 13 deletions
diff --git a/node/TimesliderMessageHandler.js b/node/TimesliderMessageHandler.js
index 2212c110..67c76f74 100644
--- a/node/TimesliderMessageHandler.js
+++ b/node/TimesliderMessageHandler.js
@@ -81,6 +81,7 @@ exports.handleMessage = function(client, message)
function handleClientReady(client, message)
{
+ //send the timeslider client the clientVars, with this values its able to start
createTimesliderClientVars (message.padId, function(err, clientVars)
{
if(err) throw err;
@@ -89,6 +90,9 @@ function handleClientReady(client, message)
})
}
+/**
+ * Handles a request for a rough changeset, the timeslider client needs it
+ */
function handleChangesetRequest(client, message)
{
var granularity = message.data.granularity;
@@ -96,6 +100,7 @@ function handleChangesetRequest(client, message)
var end = start + (100 * granularity);
var padId = message.padId;
+ //build the requested rough changesets and send them back
getChangesetInfo(padId, start, end, granularity, function(err, changesetInfo)
{
if(err) throw err;
diff --git a/static/js/broadcast_revisions.js b/static/js/broadcast_revisions.js
index 31a14b38..0fb8061c 100644
--- a/static/js/broadcast_revisions.js
+++ b/static/js/broadcast_revisions.js
@@ -120,14 +120,3 @@ function loadBroadcastRevisionsJS()
};
}
}
-
- // revisionInfo.addChangeset(0, 5, "abcde")
- // revisionInfo.addChangeset(5, 10, "fghij")
- // revisionInfo.addChangeset(10, 11, "k")
- // revisionInfo.addChangeset(11, 12, "l")
- // revisionInfo.addChangeset(12, 13, "m")
- // revisionInfo.addChangeset(13, 14, "n")
- // revisionInfo.addChangeset(14, 15, "o")
- // revisionInfo.addChangeset(15, 20, "pqrst")
- //
- // print (revisionInfo.getPath(15, 0))
diff --git a/static/timeslider.html b/static/timeslider.html
index d27a5ef9..aa9a19ee 100644
--- a/static/timeslider.html
+++ b/static/timeslider.html
@@ -16,7 +16,6 @@
<script type="text/javascript">
// <![CDATA[
var clientVars = {};
- /*var clientVars = {"historicalAuthorData":{"g.y7pr6ar7tcoyvosu":{"colorId":20}},"totalRevs":80,"hooks":{},"disableRightBar":false,"revNum":80,"initialStyledContents":{"atext":{"text":"sdfWelcsdfsdome to Etsdfherpad v1.1!ASdasdf\nsdASASdsdsad\nThisdfs paASDASd text isasdf synchrsdfonisdfzed as dsfyou typasdfe, so that everyonsde viewiasdng thasdfs page sees theADS same tdsext. This allows you to collabasdforatessadf seamlaSDssly on documents!sddfsdf\n asdsdsd\nASdasdASDsddf\nsdaasdfsddsdfsdfsdf\nsdsfsd\n\n\nasdfsd\n\nasdf\nsda\nas\ns\nss\nss\na\nsd\n\nsd\nfsadf\nsd\nf\nsdf\nsadfs\nsdf\nsdf\nsf\nsdf\nsdffsd\nsdas\ndfsdf\n\n\n","attribs":"*0+3+4*0+5+9*0+3+c*0+7|1+1*0+c*1|1+1*1+3*0*1+3*1+4*0*1+5*1+9*0*1+4*1+7*0*1+3*1+3*0*1+3*1+7*0*1+3*1+7*0*1+4*1+i*0*1+2*1+7*0*1+3*1+5*0*1+4*1+f*0*1+3*1+7*0*1+2*1+v*0*1+4*1+5*0*1+5*1+6*0*1+3*1+i*0*1+7*1|1+1*1+1*0*1+7*1|1+1*0*1+d|1+1*0+j|1+1*0|r+2s|2+2"},"historicalAuthorData":{"g.y7pr6ar7tcoyvosu":{"colorId":20}},"apool":{"numToAttrib":{"0":["author","g.y7pr6ar7tcoyvosu"],"1":["underline","true"]},"nextNum":2}},"viewId":"test","fullWidth":false,"initialChangesets":[{"start":0,"forwardsChangesets":[],"timeDeltas":[],"granularity":100,"actualEndNum":0,"apool":{"numToAttrib":{},"nextNum":0},"backwardsChangesets":[]},{"start":0,"forwardsChangesets":["Z:1>5o+p*0+3|1+1*0+7|1+1+2e*0+3|2+1z*0+6|1+1$Welcome to Etherpad v1.1!ASd\nsdASASd\nThis pad text is synchronized as you type, so that everyone viewing this page sees theADS same text. This allows you to collaborate seamlessly on documents!\n \nASdasd\n","Z:5p>n=d*0+3|1=g=7*1|1=1*1=g*0*1+4*1=a*0*1+3*1=e*0*1+4*1=u-1*0*1+4*1=1k*0*1+4*1=b-1*0*1+3*1|2=l*1=6$sdfasdfsdfasdfasdfasdfaSD","Z:6c>n|1=w=7*0+5|1=1=7*0*1+5=1x*0*1+3|1=2u=1*0*1+3|1=1=6*0*1+3|1=1*0+3|1+1$sdsadASDASasdasdASDsda\n","Z:6z>p|2=19=w*0*1+3=49*0*1+4|1=1=4*0*1+4|1=1=9*0*1+4|1=1=3*0+a$sdfsddfsdsdsddfasdfsddsdf","Z:7o>s=4*0+3=r*0+4|2=e=3*0*1+3=19*0*1+3=t*0*1+2=18*0*1+2=14*0*1+5=v*0*1+3|3=o=d*0+3$sdfasdfsdfdsfsddsssadfsdfsdf","Z:8g>o*0+3=7*0+2|5=7r=g*0+3|1=1*0|3+9*0+6|1+1$sdfsdsdfsdsfsd\n\n\nasdfsd\n","Z:94>z|9=8w=6*0|c+v*0+4$\n\nasdf\nsda\nas\ns\nss\nss\na\nsd\n\nsd\nfsad","Z:a3>1d|l=9x=4*0|b+18*0+5$f\nsd\nf\nsdf\nsadfs\nsdf\nsdf\nsf\nsdf\nsdffsd\nsdas\ndfsdf"],"timeDeltas":[25,1875,6,5,6,5,5,5],"granularity":10,"actualEndNum":80,"apool":{"numToAttrib":{"0":["author","g.y7pr6ar7tcoyvosu"],"1":["underline","true"],"2":["underline",""]},"nextNum":3},"backwardsChangesets":["Z:5p\x3c5o|5-5o$","Z:6c\x3cn=d-3|1=g=7*2|1=1*2=g-4*2=a-3*2=e-4*2=u-4+1*2=1k-4*2=b-3+1*2|2=l*2=6$ie","Z:6z\x3cn|1=w=7-5|1=1=7-5=1x-3|1=2u=1-3|1=1=6-3|1=1|1-4$","Z:7o\x3cp|2=19=w-3=49-4|1=1=4-4|1=1=9-4|1=1=3-a$","Z:8g\x3cs=4-3=r-4|2=e=3-3=19-3=t-2=18-2=14-5=v-3|3=o=d-3$","Z:94\x3co-3=7-2|5=7r=g-3|1=1|4-g$","Z:a3\x3cz|9=8w=6|c-v-4$","Z:bg\x3c1d|l=9x=4|b-18-5$"]},{"start":80,"forwardsChangesets":["Z:bg>1|w=b9=5*0|1+1$\n"],"timeDeltas":[1],"granularity":1,"actualEndNum":81,"apool":{"numToAttrib":{"0":["author","g.y7pr6ar7tcoyvosu"]},"nextNum":1},"backwardsChangesets":["Z:bh\x3c1|w=b9=5|1-1$"]},{"start":0,"forwardsChangesets":["Z:1>5o+p*0+3|1+1*0+7|1+1+2e*0+3|2+1z*0+6|1+1$Welcome to Etherpad v1.1!ASd\nsdASASd\nThis pad text is synchronized as you type, so that everyone viewing this page sees theADS same text. This allows you to collaborate seamlessly on documents!\n \nASdasd\n","Z:5p>n=d*0+3|1=g=7*1|1=1*1=g*0*1+4*1=a*0*1+3*1=e*0*1+4*1=u-1*0*1+4*1=1k*0*1+4*1=b-1*0*1+3*1|2=l*1=6$sdfasdfsdfasdfasdfasdfaSD","Z:6c>n|1=w=7*0+5|1=1=7*0*1+5=1x*0*1+3|1=2u=1*0*1+3|1=1=6*0*1+3|1=1*0+3|1+1$sdsadASDASasdasdASDsda\n","Z:6z>p|2=19=w*0*1+3=49*0*1+4|1=1=4*0*1+4|1=1=9*0*1+4|1=1=3*0+a$sdfsddfsdsdsddfasdfsddsdf","Z:7o>s=4*0+3=r*0+4|2=e=3*0*1+3=19*0*1+3=t*0*1+2=18*0*1+2=14*0*1+5=v*0*1+3|3=o=d*0+3$sdfasdfsdfdsfsddsssadfsdfsdf","Z:8g>o*0+3=7*0+2|5=7r=g*0+3|1=1*0|3+9*0+6|1+1$sdfsdsdfsdsfsd\n\n\nasdfsd\n","Z:94>z|9=8w=6*0|c+v*0+4$\n\nasdf\nsda\nas\ns\nss\nss\na\nsd\n\nsd\nfsad","Z:a3>1d|l=9x=4*0|b+18*0+5$f\nsd\nf\nsdf\nsadfs\nsdf\nsdf\nsf\nsdf\nsdffsd\nsdas\ndfsdf"],"timeDeltas":[25,1875,6,5,6,5,5,5],"granularity":10,"actualEndNum":80,"apool":{"numToAttrib":{"0":["author","g.y7pr6ar7tcoyvosu"],"1":["underline","true"],"2":["underline",""]},"nextNum":3},"backwardsChangesets":["Z:5p\x3c5o|5-5o$","Z:6c\x3cn=d-3|1=g=7*2|1=1*2=g-4*2=a-3*2=e-4*2=u-4+1*2=1k-4*2=b-3+1*2|2=l*2=6$ie","Z:6z\x3cn|1=w=7-5|1=1=7-5=1x-3|1=2u=1-3|1=1=6-3|1=1|1-4$","Z:7o\x3cp|2=19=w-3=49-4|1=1=4-4|1=1=9-4|1=1=3-a$","Z:8g\x3cs=4-3=r-4|2=e=3-3=19-3=t-2=18-2=14-5=v-3|3=o=d-3$","Z:94\x3co-3=7-2|5=7r=g-3|1=1|4-g$","Z:a3\x3cz|9=8w=6|c-v-4$","Z:bg\x3c1d|l=9x=4|b-18-5$"]},{"start":80,"forwardsChangesets":["Z:bg>1|w=b9=5*0|1+1$\n"],"timeDeltas":[1],"granularity":1,"actualEndNum":81,"apool":{"numToAttrib":{"0":["author","g.y7pr6ar7tcoyvosu"]},"nextNum":1},"backwardsChangesets":["Z:bh\x3c1|w=b9=5|1-1$"]}],"sliderEnabled":true,"colorPalette":["#ffc7c7","#fff1c7","#e3ffc7","#c7ffd5","#c7ffff","#c7d5ff","#e3c7ff","#ffc7f1","#ff8f8f","#ffe38f","#c7ff8f","#8fffab","#8fffff","#8fabff","#c78fff","#ff8fe3","#d97979","#d9c179","#a9d979","#79d991","#79d9d9","#7991d9","#a979d9","#d979c1","#d9a9a9","#d9cda9","#c1d9a9","#a9d9b5","#a9d9d9","#a9b5d9","#c1a9d9","#d9a9cd"],"supportsSlider":true,"currentTime":1308076144078,"savedRevisions":[],"initialPadContents":"sdfWelcsdfsdome to Etsdfherpad v1.1!ASdasdf\nsdASASdsdsad\nThisdfs paASDASd text isasdf synchrsdfonisdfzed as dsfyou typasdfe, so that everyonsde viewiasdng thasdfs page sees theADS same tdsext. This allows you to collabasdforatessadf seamlaSDssly on documents!sddfsdf\n asdsdsd\nASdasdASDsddf\nsdaasdfsddsdfsdfsdf\nsdsfsd\n\n\nasdfsd\n\nasdf\nsda\nas\ns\nss\nss\na\nsd\n\nsd\nfsadf\nsd\nf\nsdf\nsadfs\nsdf\nsdf\nsf\nsdf\nsdffsd\nsdas\ndfsdf\n\n","padIdForUrl":"test"};*/
function createCookie(name,value,days)
{
@@ -56,6 +55,7 @@
$(window).load(function ()
{
+ //get the padId out of the url
var urlParts= document.URL.split("/");
padId = urlParts[urlParts.length-2];
@@ -74,11 +74,13 @@
socket = new io.Socket();
socket.connect();
+ //send the ready message once we're connected
socket.on('connect', function()
{
sendSocketMsg("CLIENT_READY", {});
});
+ //route the incoming messages
socket.on('message', function(message)
{
if(window.console) console.log(message);
@@ -90,11 +92,11 @@
else if(message.type == "CHANGESET_REQ")
{
changesetLoader.handleSocketResponse(message);
- //alert("answer!")
}
});
});
+ //sends a message over the socket
function sendSocketMsg(type, data)
{
var msg = { "component" : "timeslider",
@@ -114,10 +116,12 @@
//save the client Vars
clientVars = message.data;
+ //load all script that doesn't work without the clientVars
loadBroadcastSliderJS();
loadBroadcastRevisionsJS();
loadBroadcastJS();
+ //fire all start functions of these scripts, formerly fired with window.load
for(var i=0;i < fireWhenAllScriptsAreLoaded.length;i++)
{
fireWhenAllScriptsAreLoaded[i]();