mirror of
				https://github.com/ether/etherpad-lite.git
				synced 2025-11-04 02:01:30 +01:00 
			
		
		
		
	Timeslider autoupdate on pad change
This commit is contained in:
		
							parent
							
								
									583743a3f9
								
							
						
					
					
						commit
						1faae5b756
					
				@ -467,32 +467,30 @@ 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()
 | 
			
		||||
    },
 | 
			
		||||
    handleMessageFromServer: function (obj)
 | 
			
		||||
    {
 | 
			
		||||
      debugLog("handleMessage:", arguments);
 | 
			
		||||
    var obj = arguments[0]['data'];
 | 
			
		||||
    var expectedType = "COLLABROOM";
 | 
			
		||||
 | 
			
		||||
    obj = JSON.parse(obj);
 | 
			
		||||
    if (obj['type'] == expectedType)
 | 
			
		||||
      if (obj.type == "COLLABROOM")
 | 
			
		||||
      {
 | 
			
		||||
      obj = obj['data'];
 | 
			
		||||
        obj = obj.data;
 | 
			
		||||
 | 
			
		||||
      if (obj['type'] == "NEW_CHANGES")
 | 
			
		||||
        if (obj.type == "NEW_CHANGES")
 | 
			
		||||
        {
 | 
			
		||||
          debugLog(obj);
 | 
			
		||||
          var changeset = Changeset.moveOpsToNewPool(
 | 
			
		||||
            obj.changeset, (new AttribPool()).fromJsonable(obj.apool), padContents.apool);
 | 
			
		||||
 | 
			
		||||
          var changesetBack = Changeset.inverse(
 | 
			
		||||
            obj.changeset, padContents.currentLines, padContents.alines, padContents.apool);
 | 
			
		||||
 | 
			
		||||
          var changesetBack = Changeset.moveOpsToNewPool(
 | 
			
		||||
        obj.changesetBack, (new AttribPool()).fromJsonable(obj.apool), padContents.apool);
 | 
			
		||||
            changesetBack, (new AttribPool()).fromJsonable(obj.apool), padContents.apool);
 | 
			
		||||
 | 
			
		||||
          loadedNewChangeset(changeset, changesetBack, obj.newRev - 1, obj.timeDelta);
 | 
			
		||||
        }
 | 
			
		||||
      else if (obj['type'] == "NEW_AUTHORDATA")
 | 
			
		||||
        else if (obj.type == "NEW_AUTHORDATA")
 | 
			
		||||
        {
 | 
			
		||||
          var authorMap = {};
 | 
			
		||||
          authorMap[obj.author] = obj.data;
 | 
			
		||||
@ -504,17 +502,22 @@ function loadBroadcastJS(socket, sendSocketMsg, fireWhenAllScriptsAreLoaded, Bro
 | 
			
		||||
 | 
			
		||||
          BroadcastSlider.setAuthors(authors);
 | 
			
		||||
        }
 | 
			
		||||
      else if (obj['type'] == "NEW_SAVEDREV")
 | 
			
		||||
        else if (obj.type == "NEW_SAVEDREV")
 | 
			
		||||
        {
 | 
			
		||||
          var savedRev = obj.savedRev;
 | 
			
		||||
          BroadcastSlider.addSavedRevision(savedRev.revNum, savedRev);
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
      else if(obj.type == "CHANGESET_REQ")
 | 
			
		||||
      {
 | 
			
		||||
        changesetLoader.handleSocketResponse(obj);
 | 
			
		||||
      }
 | 
			
		||||
      else
 | 
			
		||||
      {
 | 
			
		||||
      debugLog("incorrect message type: " + obj['type'] + ", expected " + expectedType);
 | 
			
		||||
        debugLog("Unknown message type: " + obj.type);
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  function handleSocketClosed(params)
 | 
			
		||||
  {
 | 
			
		||||
 | 
			
		||||
@ -360,6 +360,8 @@ function handshake()
 | 
			
		||||
      //this message advices the client to disconnect
 | 
			
		||||
      if (obj.disconnect)
 | 
			
		||||
      {
 | 
			
		||||
        console.warn("FORCED TO DISCONNECT");
 | 
			
		||||
        console.warn(obj);
 | 
			
		||||
        padconnectionstatus.disconnected(obj.disconnect);
 | 
			
		||||
        socket.disconnect();
 | 
			
		||||
        return;
 | 
			
		||||
 | 
			
		||||
@ -80,16 +80,11 @@ function init() {
 | 
			
		||||
      {
 | 
			
		||||
        handleClientVars(message);
 | 
			
		||||
      }
 | 
			
		||||
      else if(message.type == "CHANGESET_REQ")
 | 
			
		||||
      {
 | 
			
		||||
        changesetLoader.handleSocketResponse(message);
 | 
			
		||||
      }
 | 
			
		||||
      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]);
 | 
			
		||||
        changesetLoader.handleMessageFromServer(message);
 | 
			
		||||
      }
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user