ChatWindow_wev8.js
1.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
function ChatWindow(para){
MessageWindow.call(this,para)
this.para=para;
}
ChatWindow.prototype=new MessageWindow();
ChatWindow.prototype._setChatList=function(){
this.objBody.append("<div class='chatList'></div><div style='clear:both'/>");
}
ChatWindow.prototype._createChat=function(){
this._setChatList();
}
ChatWindow.prototype._fixChatBody=function(){
var chatListWidth=70;
var msgWidth=parseInt(this.objBody[0].style.width)-chatListWidth-2;
var chatListHeight=parseInt(this.objBody[0].style.height)-4;
this.objBody.find(".chatList").css({float:'left',width:chatListWidth,height:'100%'});
this.objBody.find(".msg").css({float:'right',width:msgWidth});
}
ChatWindow.prototype._joinChat=function(){
XmppSend.joinToChat(this.para.sendTo,this.para.nickname);
}
ChatWindow.prototype.send=function(msg){
//send 消息
XmppSend.sendMessage(this.para.sendTo,msg);
//清空消息
this.objBody.find(".input").children("textarea").val('');
}
ChatWindow.prototype.addChateUser=function(cu){
//alert(nickname)
this.objBody.find(".chatList").append(cu.toString())
this.showMessage(cu.para.nick+rMsg.chatWindowJoinMeeting,"");
}
ChatWindow.prototype.removeChateUser=function(cu){
//alert(nickname)
if(cu.isAdmin()){
alert(rMsg.chatWindowAdminCloseMeeting);
this.remove();
Page.removeChat(this.para.sendTo);
} else {
this.objBody.find(".chatList").find("#"+cu.getChatDivId()).remove();
this.showMessage(cu.para.nick+rMsg.chatWindowLeaveMeeting,"");
}
}
//重载
ChatWindow.prototype._fixSize=function(){
this._fixWindow();
this._fixMessageBody();
this._fixChatBody();
}
ChatWindow.prototype._create=function(){
this._createBase();
this.objBody=this.objWindow.find(".body");
this._createMessage();
this._createToolbar();
this._createChat();
this._joinChat();
}