browser_extension/js/main.js
// Adds the visual chat message to the message list
Adds the visual chat message to the message list
Adds the visual chat message to the message list
function addChatMessage(data, options) {
          var $typingMessages = getTypingMessages(data);
          options = options || {};
          if ($typingMessages.length !== 0) {
            options.fade = false;
            $typingMessages.remove();
          }
          var $username = $('.username');
          $username.innerHTML = data.username;
          var $usernameDiv = $('<span class="username"/>')
            .text(data.username)
            .css('color', getUsernameColor(data.username));
          var $messageBodyDiv = $('<span class="messageBody">')
            .text(data.message);
          var typingClass = data.typing ? 'typing' : '';
          var $messageDiv = $('<li class="message"/>')
            .data('username', data.username)
            .addClass(typingClass)
            .append($usernameDiv, $messageBodyDiv);
          addMessageElement($messageDiv, options);
        }
function addChatMessage ( data , options ) { var $typingMessages = getTypingMessages ( data ) ; options = options || { } ; if ( $typingMessages . length !== 0 ) { options . fade = false ; $typingMessages . remove ( ) ; } var $username = $ ( '.username' ) ; $username . innerHTML = data . username ; var $usernameDiv = $ ( '<span class="username"/>' ) . text ( data . username ) . css ( 'color' , getUsernameColor ( data . username ) ) ; var $messageBodyDiv = $ ( '<span class="messageBody">' ) . text ( data . message ) ; var typingClass = data . typing ? 'typing' : '' ; var $messageDiv = $ ( '<li class="message"/>' ) . data ( 'username' , data . username ) . addClass ( typingClass ) . append ( $usernameDiv , $messageBodyDiv ) ; addMessageElement ( $messageDiv , options ) ; }
Adds the visual chat message to the message list
Adds the visual chat message to the message list
// Don't fade the message in if there is an 'X was typing'