Ignore:
Timestamp:
03/18/10 17:33:07 (14 years ago)
Author:
alexandrecorreia
Message:

Ticket #986 - Implementado envio das mensagens dentro das janelas.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sandbox/jabberit_messenger/trophy/js/trophyim.js

    r2293 r2298  
    196196     */ 
    197197    chatHistory : {}, 
     198     
    198199    /** Object: activeChats 
    199200     * 
    200201     *  This object stores the currently active chats. 
    201202     */ 
    202     activeChats : {current: null, divs: {}}, 
    203     /** Function: setCookie 
     203     
     204     activeChats : {current: null, divs: {}}, 
     205     
     206     /** Function: setCookie 
    204207     * 
    205208     *  Sets cookie name/value pair.  Date and path are auto-selected. 
     
    618621            var message =  
    619622            {  
    620                 contact : contact, 
     623                contact : "<font style='font-weight:bold; color:black;'>" + contact + "</font>", 
    621624                msg             : Strophe.getText(elems[0])      
    622625            }; 
     
    668671        { 
    669672                        'idChatBox' : barjid + "__chatBox", 
     673                        'jidTo'         : barjid, 
    670674        }; 
    671          
    672675         
    673676        var winChatBox =  
     
    787790        var messageDiv  = document.createElement("div"); 
    788791                messageDiv.style.margin = "3px 0px 3px 3px"; 
    789                 messageDiv.innerHTML    = "<font style='font-weight:bold;'>" + msg.contact + "</font> : " + msg.msg ; 
     792                messageDiv.innerHTML    = msg.contact + " : " + msg.msg ; 
    790793                 
    791794        chatBox.appendChild(messageDiv); 
     
    10611064     *  Send message from chat input to user 
    10621065     */ 
    1063     sendMessage : function(chat_box) { 
    1064         var message_input = 
    1065         getElementsByClassName('trophyimchatinput', null, 
    1066         chat_box.parentNode)[0]; 
     1066      
     1067    sendMessage : function() 
     1068    { 
     1069 
     1070        if( arguments.length > 0 ) 
     1071        { 
     1072                var jidTo = arguments[0]; 
     1073                var message_input = document.getElementById(jidTo + "__sendBox"); 
     1074             
     1075                if( message_input.value.replace(/^\s+|\s+$/g,"") != "" ) 
     1076                { 
     1077                        // Send Message 
     1078                        TrophyIM.connection.send($msg({to: jidTo, from: TrophyIM.connection.jid, type: 'chat'}).c('body').t(message_input.value).tree()); 
     1079                         
     1080                        var message =  
     1081                        { 
     1082                                        contact : "<font style='font-weight:bold; color:red;'>" + "Eu" + "</font>", 
     1083                                        msg : message_input.value 
     1084                        } 
     1085                         
     1086                        message_input.value = ''; 
     1087                         
     1088                        // Add Message in chatBox; 
     1089                        TrophyIM.addMessage( message, jidTo); 
     1090                } 
     1091        } 
     1092         
     1093         
     1094        /* 
     1095         * Codigo original comentado  
     1096         * 
     1097        var message_input = getElementsByClassName('trophyimchatinput', null, chat_box.parentNode)[0]; 
    10671098        var active_jid = TrophyIM.activeChats['current']; 
    1068         if(TrophyIM.activeChats['current']) { 
     1099         
     1100        if(TrophyIM.activeChats['current']) 
     1101        { 
    10691102            var active_chat = 
    10701103            TrophyIM.activeChats['divs'][TrophyIM.activeChats['current']]; 
    10711104            var to = TrophyIM.activeChats['current']; 
    1072             if (active_chat['resource']) { 
     1105            if (active_chat['resource']) 
     1106            { 
    10731107                to += "/" + active_chat['resource']; 
    10741108            } 
    1075             TrophyIM.connection.send($msg({to: to, from: 
    1076             TrophyIM.connection.jid, type: 'chat'}).c('body').t( 
    1077             message_input.value).tree()); 
     1109            TrophyIM.connection.send($msg({to: to, from: TrophyIM.connection.jid, type: 'chat'}).c('body').t(message_input.value).tree()); 
     1110             
    10781111            TrophyIM.addMessage("Me:\n" + message_input.value, 
    10791112            TrophyIM.activeChats['current']); 
    10801113        } 
     1114         
    10811115        message_input.value = ''; 
    10821116        message_input.focus(); 
     1117        */ 
    10831118    } 
    10841119}; 
Note: See TracChangeset for help on using the changeset viewer.