Changeset 2298 for sandbox/jabberit_messenger
- Timestamp:
- 03/18/10 17:33:07 (14 years ago)
- Location:
- sandbox/jabberit_messenger/trophy
- Files:
-
- 2 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 }; -
sandbox/jabberit_messenger/trophy/xsl/chatBox.xsl
r2293 r2298 4 4 5 5 <xsl:param name="idChatBox" /> 6 <xsl:param name="jidTo" /> 6 7 7 8 <xsl:template match="chat_box"> … … 10 11 <div id="{$idChatBox}" style="height:190px; width:370px; overflow-y:scroll"></div> 11 12 <div style="margin:2px;"> 12 <form name="chat" onsubmit="TrophyIM.sendMessage(this); return(false);"> 13 <div style="margin-top:0px; width:70px; height:93px; position:relative; float:right; background-image:url('images/photo.png');"></div> 14 <textarea class="trophyimchatinput" rows="5" cols="38"/> 15 </form> 16 </div> 17 <div style="margin-left:2px;"> 18 <input type="button" value="Send" onclick="TrophyIM.sendMessage(this)"/> 13 <div style="margin-top:0px; width:70px; height:93px; position:relative; float:right; background-image:url('images/photo.png');"></div> 14 <textarea id="{$jidTo}__sendBox" class="trophyimchatinput" rows="5" cols="38"></textarea> 15 <div style="margin-left:2px;"> 16 <input type="button" value="Send" onclick="TrophyIM.sendMessage('{$jidTo}')"/> 17 </div> 19 18 </div> 20 19 </div>
Note: See TracChangeset
for help on using the changeset viewer.