ControlWindow_wev8.js
4.44 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
var ControlWindow={
intMessagerWindowNum:0,
intMessagerZindex:100,
getWindowId:function(jid){
if(jid.indexOf("conference")!=-1){ //chat
return "chatWindow_"+Util.cutResourceAtFlag(jid);
} else { //message
return "mWindow_"+Util.cutResourceAtFlag(jid);
}
},
isWindowExist:function(jid){
var windowId=ControlWindow.getWindowId(jid);
return typeof window[windowId]=="object";
},
getWindow:function(jid,name,logo,userImg,user){
var windowId=ControlWindow.getWindowId(jid);
if(typeof window[windowId]=="object") {
return window[windowId]
} else {
if(jid.indexOf("conference")!=-1){ //chat
//list 一下会议
Page.refreshChatList();
return ControlWindow.createChatWindow(windowId,jid,name,logo,Config.ChatWindowWidth,Config.ChatWindowHeight,userImg);
} else { //message
return ControlWindow.createMessageWindow(windowId,jid,name,logo,Config.MessageWindowWidth,Config.MessageWindowHeight,userImg,user);
}
}
},
getWindowFromRecently:function(jid){
jid=Util.cutResource(jid);
document.getElementById("wmForWeb").dbClickJid(jid);
var windowId=ControlWindow.getWindowId(jid);
return window[windowId]
},
getWindowPos:function(width,height){
//var tepLeft=parseInt(screen.width)/2-parseInt(width)/2+ControlWindow.intMessagerWindowNum*20
//var tepTop=parseInt(screen.height)/2-parseInt(height)+ControlWindow.intMessagerWindowNum*20
//var tmpRight=(parseInt(width)+10)*ControlWindow.intMessagerWindowNum;
//var tmpBottom=0;
//ControlWindow.intMessagerWindowNum++;
var tmpLeft=parseInt(screen.width)/2-parseInt(width)+30*ControlWindow.intMessagerWindowNum+250;
var tmpTop=parseInt(screen.height)/2-parseInt(height)+100+40*ControlWindow.intMessagerWindowNum;
return {
left:tmpLeft,
top:tmpTop
}
},
createMessageWindow:function(windowId,jid,name,logo,width,height,userImg,user){
width=parseInt(width);
height=parseInt(height);
var postion=ControlWindow.getWindowPos(width,height);
var tmpLeft=postion.left;
var tmpTop=postion.top;
/*var str=windowId+"=new MessageWindow({ id:'"+windowId+"_dom',templateId:'windowTemplate',height:'"+height+"', width:'"+width+"',top:'"+top+"',left:'"+left+"',logoImg:'"+logo+"',name:'"+name+"',canDrag:'true',sendTo:'"+jid+"'})";
eval(str);
eval(windowId+".appendTo(document.body)");
return eval("window."+windowId);
*/
window[windowId]=new MessageWindow({id:windowId+"_dom",templateId:"windowTemplate",height:height, width:width,top:tmpTop,left:tmpLeft,logoImg:logo,name:name,canDrag:'true',sendTo:jid,userImg:userImg,user:user});
if(Config.target=="parent"){
window[windowId].appendTo($(parent.document.body));
} else {
window[windowId].appendTo(document.body);
}
return window[windowId];
},
createChatWindow:function(windowId,chatid,name,logo,width,height,userImg){
width=parseInt(width);
height=parseInt(height);
var postion=ControlWindow.getWindowPos(width,height);
var tmpLeft=postion.left;
var tmpTop=postion.top;
/*var str=windowId+"=new ChatWindow({ id:'"+windowId+"_dom',templateId:'windowTemplate',height:'"+height+"', width:'"+width+"',top:'"+top+"',left:'"+left+"',logoImg:'"+logo+"',name:'"+name+"',canDrag:'true',sendTo:'"+chatid+"',nickname:'"+nickname+"'})";
eval(str);
eval(windowId+".appendTo(document.body)");
return eval("window."+windowId);*/
window[windowId]=new ChatWindow({id:windowId+"_dom",templateId:"windowTemplate",height:height, width:width,top:tmpTop,left:tmpLeft,logoImg:logo,name:name,canDrag:'true',sendTo:chatid,nickname:nickname,userImg:userImg});
if(Config.target=="parent"){
window[windowId].appendTo(parent.document.body);
} else {
window[windowId].appendTo(document.body);
}
return window[windowId];
},
getBaseWindow:function(windowId,name,logo,width,height,left,top,el){
if(typeof window[windowId]=="object") {
return window[windowId]
} else {
return ControlWindow.createBaseWindow(windowId,name,logo,width,height,left,top,el);
}
},
createBaseWindow:function(windowId,name,logo,width,height,left,top,el){
width=parseInt(width);
height=parseInt(height);
window[windowId]=new BaseWindow({id:windowId+"_dom",templateId:"windowTemplate",height:height, width:width,top:top,left:left,logoImg:logo,name:name,canDrag:'true',el:el});
if(Config.target=="parent"){
window[windowId].appendTo(parent.document.body);
} else {
window[windowId].appendTo(document.body);
}
return window[windowId];
}
}