Beispiel #1
0
Datei: pad.js Projekt: azul/5pad
 handleClientMessage: function(msg)
 {
   if (msg.type == 'suggestUserName')
   {
     if (msg.unnamedId == pad.myUserInfo.userId && msg.newName && !pad.myUserInfo.name)
     {
       pad.notifyChangeName(msg.newName);
       paduserlist.setMyUserInfo(pad.myUserInfo);
     }
   }
   else if (msg.type == 'chat')
   {
     //padchat.receiveChat(msg);
   }
   else if (msg.type == 'padtitle')
   {
     paddocbar.changeTitle(msg.title);
   }
   else if (msg.type == 'padpassword')
   {
     paddocbar.changePassword(msg.password);
   }
   else if (msg.type == 'newRevisionList')
   {
     padsavedrevs.newRevisionList(msg.revisionList);
   }
   else if (msg.type == 'revisionLabel')
   {
     padsavedrevs.newRevisionList(msg.revisionList);
   }
   else if (msg.type == 'padoptions')
   {
     var opts = msg.options;
     pad.handleOptionsChange(opts);
   }
   else if (msg.type == 'guestanswer')
   {
     // someone answered a prompt, remove it
     paduserlist.removeGuestPrompt(msg.guestId);
   }
 },
Beispiel #2
0
Datei: pad.js Projekt: azul/5pad
  handleIsFullyConnected: function(isConnected, isInitialConnect)
  {
    // load all images referenced from CSS, one at a time,
    // starting one second after connection is first established.
    if (isConnected && !pad.preloadedImages)
    {
      window.setTimeout(function()
      {
        if (!pad.preloadedImages)
        {
          pad.preloadImages();
          pad.preloadedImages = true;
        }
      }, 1000);
    }

    padsavedrevs.handleIsFullyConnected(isConnected);

    // pad.determineSidebarVisibility(isConnected && !isInitialConnect);
    pad.determineChatVisibility(isConnected && !isInitialConnect);
    pad.determineAuthorshipColorsVisibility();

  },
Beispiel #3
0
Datei: pad.js Projekt: azul/5pad
  _afterHandshake: function()
  {
    pad.clientTimeOffset = new Date().getTime() - clientVars.serverTimestamp;
  
    //initialize the chat
    chat.init(this);
    pad.initTime = +(new Date());
    pad.padOptions = clientVars.initialOptions;

    if ((!$.browser.msie) && (!($.browser.mozilla && $.browser.version.indexOf("1.8.") == 0)))
    {
      document.domain = document.domain; // for comet
    }

    // for IE
    if ($.browser.msie)
    {
      try
      {
        doc.execCommand("BackgroundImageCache", false, true);
      }
      catch (e)
      {}
    }

    // order of inits is important here:
    padcookie.init(clientVars.cookiePrefsToSet, this);
      
    $("#widthprefcheck").click(pad.toggleWidthPref);
    // $("#sidebarcheck").click(pad.togglewSidebar);

    pad.myUserInfo = {
      userId: clientVars.userId,
      name: clientVars.userName,
      ip: pad.getClientIp(),
      colorId: clientVars.userColor,
      userAgent: pad.getDisplayUserAgent()
    };

    if (clientVars.specialKey)
    {
      pad.myUserInfo.specialKey = clientVars.specialKey;
      if (clientVars.specialKeyTranslation)
      {
        $("#specialkeyarea").html("mode: " + String(clientVars.specialKeyTranslation).toUpperCase());
      }
    }
    paddocbar.init(
    {
      isTitleEditable: pad.getIsProPad(),
      initialTitle: clientVars.initialTitle,
      initialPassword: clientVars.initialPassword,
      guestPolicy: pad.padOptions.guestPolicy
    }, this);
    padimpexp.init(this);
    padsavedrevs.init(clientVars.initialRevisionList, this);

    padeditor.init(postAceInit, pad.padOptions.view || {}, this);

    paduserlist.init(pad.myUserInfo, this);
    //    padchat.init(clientVars.chatHistory, pad.myUserInfo);
    padconnectionstatus.init();
    padmodals.init(this);

    pad.collabClient = getCollabClient(padeditor.ace, clientVars.collab_client_vars, pad.myUserInfo, {
      colorPalette: pad.getColorPalette()
    }, pad);
    pad.collabClient.setOnUserJoin(pad.handleUserJoin);
    pad.collabClient.setOnUpdateUserInfo(pad.handleUserUpdate);
    pad.collabClient.setOnUserLeave(pad.handleUserLeave);
    pad.collabClient.setOnClientMessage(pad.handleClientMessage);
    pad.collabClient.setOnServerMessage(pad.handleServerMessage);
    pad.collabClient.setOnChannelStateChange(pad.handleChannelStateChange);
    pad.collabClient.setOnInternalAction(pad.handleCollabAction);

    function postAceInit()
    {
      padeditbar.init();
      setTimeout(function()
      {
        padeditor.ace.focus();
      }, 0);
      if(padcookie.getPref("chatAlwaysVisible")){ // if we have a cookie for always showing chat then show it
        chat.stickToScreen(true); // stick it to the screen
        $('#options-stickychat').prop("checked", true); // set the checkbox to on
      }
      if(padcookie.getPref("showAuthorshipColors") == false){
	pad.changeViewOption('showAuthorColors', false);
      }
    }
  },
Beispiel #4
0
 handleResizePage: function()
 {
   // Side-step circular reference. This should be injected.
   var padsavedrevs = require('pad_savedrevs').padsavedrevs;
   padsavedrevs.handleResizePage();
 },