Changeset 2298 for sandbox/jabberit_messenger/trophy/js/trophyim.js
- Timestamp:
- 03/18/10 17:33:07 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sandbox/jabberit_messenger/trophy/js/trophyim.js
r2293 r2298 196 196 */ 197 197 chatHistory : {}, 198 198 199 /** Object: activeChats 199 200 * 200 201 * This object stores the currently active chats. 201 202 */ 202 activeChats : {current: null, divs: {}}, 203 /** Function: setCookie 203 204 activeChats : {current: null, divs: {}}, 205 206 /** Function: setCookie 204 207 * 205 208 * Sets cookie name/value pair. Date and path are auto-selected. … … 618 621 var message = 619 622 { 620 contact : contact,623 contact : "<font style='font-weight:bold; color:black;'>" + contact + "</font>", 621 624 msg : Strophe.getText(elems[0]) 622 625 }; … … 668 671 { 669 672 'idChatBox' : barjid + "__chatBox", 673 'jidTo' : barjid, 670 674 }; 671 672 675 673 676 var winChatBox = … … 787 790 var messageDiv = document.createElement("div"); 788 791 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 ; 790 793 791 794 chatBox.appendChild(messageDiv); … … 1061 1064 * Send message from chat input to user 1062 1065 */ 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]; 1067 1098 var active_jid = TrophyIM.activeChats['current']; 1068 if(TrophyIM.activeChats['current']) { 1099 1100 if(TrophyIM.activeChats['current']) 1101 { 1069 1102 var active_chat = 1070 1103 TrophyIM.activeChats['divs'][TrophyIM.activeChats['current']]; 1071 1104 var to = TrophyIM.activeChats['current']; 1072 if (active_chat['resource']) { 1105 if (active_chat['resource']) 1106 { 1073 1107 to += "/" + active_chat['resource']; 1074 1108 } 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 1078 1111 TrophyIM.addMessage("Me:\n" + message_input.value, 1079 1112 TrophyIM.activeChats['current']); 1080 1113 } 1114 1081 1115 message_input.value = ''; 1082 1116 message_input.focus(); 1117 */ 1083 1118 } 1084 1119 };
Note: See TracChangeset
for help on using the changeset viewer.